Added InAppBrowser menu items feature, Added hideCloseButton, hideDefaultMenuItems, menuButtonColor InAppBrowser settings
This commit is contained in:
parent
2da9db9769
commit
62431838d9
@ -1,7 +1,9 @@
|
||||
## 6.0.0-beta.24
|
||||
|
||||
- Added InAppWebView keep alive feature
|
||||
- Added InAppBrowser menu items feature
|
||||
- Added `hasJavaScriptHandler`, `hasUserScript`, `hasWebMessageListener` InAppWebViewController methods
|
||||
- Added `hideCloseButton`, `hideDefaultMenuItems`, `menuButtonColor` InAppBrowser settings
|
||||
- `HeadlessInAppWebView.webViewController` could be `null`
|
||||
- Removed `throwIfAlreadyOpened`, `throwIfNotOpened` InAppBrowser methods
|
||||
- Removed `throwIfAlreadyOpened`, `throwIfNotOpened` ChromeSafariBrowser methods
|
||||
|
@ -2,8 +2,11 @@ package com.pichillilorenzo.flutter_inappwebview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.http.SslCertificate;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@ -379,4 +382,8 @@ public class Util {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Drawable drawableFromBytes(Context context, byte[] data) {
|
||||
return new BitmapDrawable(context.getResources(), BitmapFactory.decodeByteArray(data, 0, data.length));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.pichillilorenzo.flutter_inappwebview.in_app_browser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
@ -18,9 +19,11 @@ import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.SearchView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
|
||||
import com.pichillilorenzo.flutter_inappwebview.R;
|
||||
import com.pichillilorenzo.flutter_inappwebview.Util;
|
||||
@ -28,7 +31,9 @@ import com.pichillilorenzo.flutter_inappwebview.find_interaction.FindInteraction
|
||||
import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshChannelDelegate;
|
||||
import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshLayout;
|
||||
import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshSettings;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.AndroidResource;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.Disposable;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.InAppBrowserMenuItem;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.URLRequest;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.UserScript;
|
||||
import com.pichillilorenzo.flutter_inappwebview.webview.WebViewChannelDelegate;
|
||||
@ -71,6 +76,7 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow
|
||||
public InAppBrowserManager manager;
|
||||
@Nullable
|
||||
public InAppBrowserChannelDelegate channelDelegate;
|
||||
public List<InAppBrowserMenuItem> menuItems = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -119,6 +125,10 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow
|
||||
|
||||
Map<String, Object> contextMenu = (Map<String, Object>) b.getSerializable("contextMenu");
|
||||
List<Map<String, Object>> initialUserScripts = (List<Map<String, Object>>) b.getSerializable("initialUserScripts");
|
||||
List<Map<String, Object>> menuItemList = (List<Map<String, Object>>) b.getSerializable("menuItems");
|
||||
for (Map<String, Object> menuItem : menuItemList) {
|
||||
menuItems.add(InAppBrowserMenuItem.fromMap(menuItem));
|
||||
}
|
||||
|
||||
InAppWebViewSettings webViewSettings = new InAppWebViewSettings();
|
||||
webViewSettings.parse(settingsMap);
|
||||
@ -191,10 +201,12 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow
|
||||
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
|
||||
if (progressBar != null) {
|
||||
if (customSettings.hideProgressBar)
|
||||
progressBar.setMax(0);
|
||||
else
|
||||
progressBar.setMax(100);
|
||||
}
|
||||
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayShowTitleEnabled(!customSettings.hideTitleBar);
|
||||
@ -210,6 +222,7 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu m) {
|
||||
menu = m;
|
||||
@ -220,16 +233,20 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow
|
||||
if (menu == null)
|
||||
return super.onCreateOptionsMenu(m);
|
||||
|
||||
if (menu instanceof MenuBuilder) {
|
||||
((MenuBuilder) menu).setOptionalIconsVisible(true);
|
||||
}
|
||||
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
// Inflate menu to add items to action bar if it is present.
|
||||
inflater.inflate(R.menu.menu_main, menu);
|
||||
|
||||
MenuItem menuItem = menu.findItem(R.id.menu_search);
|
||||
if (menuItem != null) {
|
||||
MenuItem menuSearchItem = menu.findItem(R.id.menu_search);
|
||||
if (menuSearchItem != null) {
|
||||
if (customSettings.hideUrlBar)
|
||||
menuItem.setVisible(false);
|
||||
menuSearchItem.setVisible(false);
|
||||
|
||||
searchView = (SearchView) menuItem.getActionView();
|
||||
searchView = (SearchView) menuSearchItem.getActionView();
|
||||
if (searchView != null) {
|
||||
searchView.setFocusable(true);
|
||||
|
||||
@ -278,6 +295,58 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow
|
||||
}
|
||||
}
|
||||
|
||||
if (customSettings.hideDefaultMenuItems) {
|
||||
MenuItem actionClose = menu.findItem(R.id.action_close);
|
||||
if (actionClose != null) {
|
||||
actionClose.setVisible(false);
|
||||
}
|
||||
MenuItem actionGoBack = menu.findItem(R.id.action_go_back);
|
||||
if (actionGoBack != null) {
|
||||
actionGoBack.setVisible(false);
|
||||
}
|
||||
MenuItem actionReload = menu.findItem(R.id.action_reload);
|
||||
if (actionReload != null) {
|
||||
actionReload.setVisible(false);
|
||||
}
|
||||
MenuItem actionGoForward = menu.findItem(R.id.action_go_forward);
|
||||
if (actionGoForward != null) {
|
||||
actionGoForward.setVisible(false);
|
||||
}
|
||||
MenuItem actionShare = menu.findItem(R.id.action_share);
|
||||
if (actionShare != null) {
|
||||
actionShare.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
for (final InAppBrowserMenuItem menuItem : menuItems) {
|
||||
int order = menuItem.getOrder() != null ? menuItem.getOrder() : Menu.NONE;
|
||||
MenuItem item = menu.add(Menu.NONE, menuItem.getId(), order, menuItem.getTitle());
|
||||
if (menuItem.isShowAsAction()) {
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
}
|
||||
Object icon = menuItem.getIcon();
|
||||
if (icon != null) {
|
||||
if (icon instanceof AndroidResource) {
|
||||
item.setIcon(((AndroidResource) icon).getIdentifier(this));
|
||||
} else {
|
||||
item.setIcon(Util.drawableFromBytes(this, (byte[]) icon));
|
||||
}
|
||||
String iconColor = menuItem.getIconColor();
|
||||
if (iconColor != null && !iconColor.isEmpty() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
item.getIcon().setTint(Color.parseColor(iconColor));
|
||||
}
|
||||
}
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(@NonNull MenuItem item) {
|
||||
if (channelDelegate != null) {
|
||||
channelDelegate.onMenuItemClicked(menuItem);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -427,10 +496,33 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow
|
||||
actionBar.setTitle(newSettings.toolbarTopFixedTitle);
|
||||
|
||||
if (menu != null && newSettingsMap.get("hideUrlBar") != null && customSettings.hideUrlBar != newSettings.hideUrlBar) {
|
||||
if (newSettings.hideUrlBar)
|
||||
menu.findItem(R.id.menu_search).setVisible(false);
|
||||
else
|
||||
menu.findItem(R.id.menu_search).setVisible(true);
|
||||
MenuItem menuSearchItem = menu.findItem(R.id.menu_search);
|
||||
if (menuSearchItem != null) {
|
||||
menuSearchItem.setVisible(!newSettings.hideUrlBar);
|
||||
}
|
||||
}
|
||||
|
||||
if (menu != null && newSettingsMap.get("hideDefaultMenuItems") != null && customSettings.hideDefaultMenuItems != newSettings.hideDefaultMenuItems) {
|
||||
MenuItem actionClose = menu.findItem(R.id.action_close);
|
||||
if (actionClose != null) {
|
||||
actionClose.setVisible(!newSettings.hideDefaultMenuItems);
|
||||
}
|
||||
MenuItem actionGoBack = menu.findItem(R.id.action_go_back);
|
||||
if (actionGoBack != null) {
|
||||
actionGoBack.setVisible(!newSettings.hideDefaultMenuItems);
|
||||
}
|
||||
MenuItem actionReload = menu.findItem(R.id.action_reload);
|
||||
if (actionReload != null) {
|
||||
actionReload.setVisible(!newSettings.hideDefaultMenuItems);
|
||||
}
|
||||
MenuItem actionGoForward = menu.findItem(R.id.action_go_forward);
|
||||
if (actionGoForward != null) {
|
||||
actionGoForward.setVisible(!newSettings.hideDefaultMenuItems);
|
||||
}
|
||||
MenuItem actionShare = menu.findItem(R.id.action_share);
|
||||
if (actionShare != null) {
|
||||
actionShare.setVisible(!newSettings.hideDefaultMenuItems);
|
||||
}
|
||||
}
|
||||
|
||||
customSettings = newSettings;
|
||||
|
@ -3,6 +3,7 @@ package com.pichillilorenzo.flutter_inappwebview.in_app_browser;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.ChannelDelegateImpl;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.InAppBrowserMenuItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -21,6 +22,14 @@ public class InAppBrowserChannelDelegate extends ChannelDelegateImpl {
|
||||
channel.invokeMethod("onBrowserCreated", obj);
|
||||
}
|
||||
|
||||
public void onMenuItemClicked(InAppBrowserMenuItem menuItem) {
|
||||
MethodChannel channel = getChannel();
|
||||
if (channel == null) return;
|
||||
Map<String, Object> obj = new HashMap<>();
|
||||
obj.put("id", menuItem.getId());
|
||||
channel.invokeMethod("onMenuItemClicked", obj);
|
||||
}
|
||||
|
||||
public void onExit() {
|
||||
MethodChannel channel = getChannel();
|
||||
if (channel == null) return;
|
||||
|
@ -181,6 +181,7 @@ public class InAppBrowserManager extends ChannelDelegateImpl {
|
||||
Integer windowId = (Integer) arguments.get("windowId");
|
||||
List<Map<String, Object>> initialUserScripts = (List<Map<String, Object>>) arguments.get("initialUserScripts");
|
||||
Map<String, Object> pullToRefreshInitialSettings = (Map<String, Object>) arguments.get("pullToRefreshSettings");
|
||||
List<Map<String, Object>> menuItems = (List<Map<String, Object>>) arguments.get("menuItems");
|
||||
|
||||
Bundle extras = new Bundle();
|
||||
extras.putString("fromActivity", activity.getClass().getName());
|
||||
@ -198,6 +199,7 @@ public class InAppBrowserManager extends ChannelDelegateImpl {
|
||||
extras.putInt("windowId", windowId != null ? windowId : -1);
|
||||
extras.putSerializable("initialUserScripts", (Serializable) initialUserScripts);
|
||||
extras.putSerializable("pullToRefreshInitialSettings", (Serializable) pullToRefreshInitialSettings);
|
||||
extras.putSerializable("menuItems", (Serializable) menuItems);
|
||||
startInAppBrowserActivity(activity, extras);
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ public class InAppBrowserSettings implements ISettings<InAppBrowserActivity> {
|
||||
public Boolean closeOnCannotGoBack = true;
|
||||
public Boolean allowGoBackWithBackButton = true;
|
||||
public Boolean shouldCloseOnBackButtonPressed = false;
|
||||
public Boolean hideDefaultMenuItems = false;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@ -68,6 +69,9 @@ public class InAppBrowserSettings implements ISettings<InAppBrowserActivity> {
|
||||
case "shouldCloseOnBackButtonPressed":
|
||||
shouldCloseOnBackButtonPressed = (Boolean) value;
|
||||
break;
|
||||
case "hideDefaultMenuItems":
|
||||
hideDefaultMenuItems = (Boolean) value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +92,7 @@ public class InAppBrowserSettings implements ISettings<InAppBrowserActivity> {
|
||||
settings.put("hideProgressBar", hideProgressBar);
|
||||
settings.put("allowGoBackWithBackButton", allowGoBackWithBackButton);
|
||||
settings.put("shouldCloseOnBackButtonPressed", shouldCloseOnBackButtonPressed);
|
||||
settings.put("hideDefaultMenuItems", hideDefaultMenuItems);
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,146 @@
|
||||
package com.pichillilorenzo.flutter_inappwebview.types;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.pichillilorenzo.flutter_inappwebview.Util;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class InAppBrowserMenuItem {
|
||||
private int id;
|
||||
|
||||
@NonNull
|
||||
private String title;
|
||||
|
||||
@Nullable
|
||||
private Integer order;
|
||||
|
||||
@Nullable
|
||||
private Object icon;
|
||||
|
||||
@Nullable
|
||||
private String iconColor;
|
||||
|
||||
private boolean showAsAction;
|
||||
|
||||
public InAppBrowserMenuItem(int id, @NonNull String title, @Nullable Integer order, @Nullable Object icon,
|
||||
@Nullable String iconColor, boolean showAsAction) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.order = order;
|
||||
this.icon = icon;
|
||||
this.iconColor = iconColor;
|
||||
this.showAsAction = showAsAction;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static InAppBrowserMenuItem fromMap(@Nullable Map<String, Object> map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
int id = (int) map.get("id");
|
||||
String title = (String) map.get("title");
|
||||
Integer order = (Integer) map.get("order");
|
||||
Object icon = map.get("icon");
|
||||
if (icon instanceof Map) {
|
||||
icon = AndroidResource.fromMap((Map<String, Object>) map.get("icon"));
|
||||
} else if (!(icon instanceof byte[])) {
|
||||
icon = null;
|
||||
}
|
||||
String iconColor = (String) map.get("iconColor");
|
||||
boolean showAsAction = Util.getOrDefault( map, "showAsAction", false);
|
||||
return new InAppBrowserMenuItem(id, title, order, icon, iconColor, showAsAction);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(@NonNull String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(@Nullable Integer order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Object getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(@Nullable Object icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getIconColor() {
|
||||
return iconColor;
|
||||
}
|
||||
|
||||
public void setIconColor(@Nullable String iconColor) {
|
||||
this.iconColor = iconColor;
|
||||
}
|
||||
|
||||
public boolean isShowAsAction() {
|
||||
return showAsAction;
|
||||
}
|
||||
|
||||
public void setShowAsAction(boolean showAsAction) {
|
||||
this.showAsAction = showAsAction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
InAppBrowserMenuItem that = (InAppBrowserMenuItem) o;
|
||||
|
||||
if (id != that.id) return false;
|
||||
if (showAsAction != that.showAsAction) return false;
|
||||
if (!title.equals(that.title)) return false;
|
||||
if (!Objects.equals(order, that.order)) return false;
|
||||
if (!Objects.equals(icon, that.icon)) return false;
|
||||
return Objects.equals(iconColor, that.iconColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id;
|
||||
result = 31 * result + title.hashCode();
|
||||
result = 31 * result + (order != null ? order.hashCode() : 0);
|
||||
result = 31 * result + (icon != null ? icon.hashCode() : 0);
|
||||
result = 31 * result + (iconColor != null ? iconColor.hashCode() : 0);
|
||||
result = 31 * result + (showAsAction ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InAppBrowserMenuItem{" +
|
||||
"id=" + id +
|
||||
", title='" + title + '\'' +
|
||||
", order=" + order +
|
||||
", icon=" + icon +
|
||||
", iconColor='" + iconColor + '\'' +
|
||||
", showAsAction=" + showAsAction +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -321,7 +321,8 @@ class ExchangeableObjectGenerator
|
||||
final fieldName = fieldElement.name;
|
||||
if (!fieldElement.isPrivate &&
|
||||
!fieldElement.isStatic &&
|
||||
!fieldElement.type.isDartCoreFunction) {
|
||||
!(fieldElement.type.isDartCoreFunction ||
|
||||
fieldElement.type is FunctionType)) {
|
||||
var value = "map['$fieldName']";
|
||||
final deprecationMessage = _coreCheckerDeprecated
|
||||
.firstAnnotationOfExact(fieldElement)
|
||||
@ -354,10 +355,10 @@ class ExchangeableObjectGenerator
|
||||
final constructorParameter = visitor.constructorParameters[fieldName];
|
||||
final isRequiredParameter = constructorParameter != null &&
|
||||
(constructorParameter.isRequiredNamed ||
|
||||
constructorParameter.isFinal ||
|
||||
constructorParameter.isFinal || fieldElement.isFinal ||
|
||||
!Util.typeIsNullable(constructorParameter.type)) &&
|
||||
!constructorParameter.hasDefaultValue;
|
||||
if (isRequiredParameter) {
|
||||
if (isRequiredParameter || fieldElement.isFinal) {
|
||||
requiredFields.add('$fieldName: $value,');
|
||||
} else {
|
||||
nonRequiredFields.add("instance.$fieldName = $value;");
|
||||
@ -402,23 +403,14 @@ class ExchangeableObjectGenerator
|
||||
classBuffer.writeln('///Converts instance to a map.');
|
||||
classBuffer.writeln('Map<String, dynamic> toMap() {');
|
||||
classBuffer.writeln('return {');
|
||||
for (final entry in methodEntriesSorted) {
|
||||
final methodElement = entry.value;
|
||||
final toMapMergeWith = _coreCheckerObjectMethod
|
||||
.firstAnnotationOf(methodElement)
|
||||
?.getField("toMapMergeWith")
|
||||
?.toBoolValue();
|
||||
if (toMapMergeWith == true) {
|
||||
classBuffer.writeln('...${methodElement.name}(),');
|
||||
}
|
||||
}
|
||||
final fieldElements = <FieldElement>[];
|
||||
if (superClass != null) {
|
||||
for (final fieldElement in superClass.element.fields) {
|
||||
if (!fieldElement.isPrivate &&
|
||||
!fieldElement.hasDeprecated &&
|
||||
!fieldElement.isStatic &&
|
||||
!fieldElement.type.isDartCoreFunction) {
|
||||
!(fieldElement.type.isDartCoreFunction ||
|
||||
fieldElement.type is FunctionType)) {
|
||||
fieldElements.add(fieldElement);
|
||||
}
|
||||
}
|
||||
@ -428,7 +420,8 @@ class ExchangeableObjectGenerator
|
||||
if (!fieldElement.isPrivate &&
|
||||
!fieldElement.hasDeprecated &&
|
||||
!fieldElement.isStatic &&
|
||||
!fieldElement.type.isDartCoreFunction) {
|
||||
!(fieldElement.type.isDartCoreFunction ||
|
||||
fieldElement.type is FunctionType)) {
|
||||
fieldElements.add(fieldElement);
|
||||
}
|
||||
}
|
||||
@ -436,7 +429,8 @@ class ExchangeableObjectGenerator
|
||||
if (!fieldElement.isPrivate &&
|
||||
!fieldElement.hasDeprecated &&
|
||||
!fieldElement.isStatic &&
|
||||
!fieldElement.type.isDartCoreFunction) {
|
||||
!(fieldElement.type.isDartCoreFunction ||
|
||||
fieldElement.type is FunctionType)) {
|
||||
final fieldName = fieldElement.name;
|
||||
var mapValue = fieldName;
|
||||
final customSerializer = _coreCheckerObjectProperty
|
||||
@ -458,6 +452,16 @@ class ExchangeableObjectGenerator
|
||||
classBuffer.writeln('"$fieldName": $mapValue,');
|
||||
}
|
||||
}
|
||||
for (final entry in methodEntriesSorted) {
|
||||
final methodElement = entry.value;
|
||||
final toMapMergeWith = _coreCheckerObjectMethod
|
||||
.firstAnnotationOf(methodElement)
|
||||
?.getField("toMapMergeWith")
|
||||
?.toBoolValue();
|
||||
if (toMapMergeWith == true) {
|
||||
classBuffer.writeln('...${methodElement.name}(),');
|
||||
}
|
||||
}
|
||||
classBuffer.writeln('};');
|
||||
classBuffer.writeln('}');
|
||||
}
|
||||
@ -494,7 +498,8 @@ class ExchangeableObjectGenerator
|
||||
if (!fieldElement.isPrivate &&
|
||||
!fieldElement.hasDeprecated &&
|
||||
!fieldElement.isStatic &&
|
||||
!fieldElement.type.isDartCoreFunction) {
|
||||
!(fieldElement.type.isDartCoreFunction ||
|
||||
fieldElement.type is FunctionType)) {
|
||||
fieldNames.add('$fieldName: \$$fieldName');
|
||||
}
|
||||
}
|
||||
@ -505,7 +510,8 @@ class ExchangeableObjectGenerator
|
||||
if (!fieldElement.isPrivate &&
|
||||
!fieldElement.hasDeprecated &&
|
||||
!fieldElement.isStatic &&
|
||||
!fieldElement.type.isDartCoreFunction) {
|
||||
!(fieldElement.type.isDartCoreFunction ||
|
||||
fieldElement.type is FunctionType)) {
|
||||
fieldNames.add('$fieldName: \$$fieldName');
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void customMenuItem() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -11,7 +6,7 @@ void customMenuItem() {
|
||||
: ![TargetPlatform.android, TargetPlatform.iOS]
|
||||
.contains(defaultTargetPlatform);
|
||||
|
||||
test('add custom menu item', () async {
|
||||
skippableTest('add custom menu item', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
chromeSafariBrowser.addMenuItem(ChromeSafariBrowserMenuItem(
|
||||
id: 2,
|
||||
@ -25,7 +20,7 @@ void customMenuItem() {
|
||||
expect(chromeSafariBrowser.isOpened(), true);
|
||||
expect(() async {
|
||||
await chromeSafariBrowser.open(url: TEST_CROSS_PLATFORM_URL_1);
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await expectLater(chromeSafariBrowser.firstPageLoaded.future, completes);
|
||||
await chromeSafariBrowser.close();
|
||||
|
@ -1,10 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void customTabs() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -13,8 +7,8 @@ void customTabs() {
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('Custom Tabs', () {
|
||||
test('custom referrer', () async {
|
||||
skippableGroup('Custom Tabs', () {
|
||||
skippableTest('custom referrer', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
|
||||
@ -26,7 +20,7 @@ void customTabs() {
|
||||
expect(chromeSafariBrowser.isOpened(), true);
|
||||
expect(() async {
|
||||
await chromeSafariBrowser.open(url: TEST_CROSS_PLATFORM_URL_1);
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await expectLater(chromeSafariBrowser.firstPageLoaded.future, completes);
|
||||
await chromeSafariBrowser.close();
|
||||
@ -34,7 +28,7 @@ void customTabs() {
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
});
|
||||
|
||||
test('single instance', () async {
|
||||
skippableTest('single instance', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
|
||||
@ -45,7 +39,7 @@ void customTabs() {
|
||||
expect(chromeSafariBrowser.isOpened(), true);
|
||||
expect(() async {
|
||||
await chromeSafariBrowser.open(url: TEST_CROSS_PLATFORM_URL_1);
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await expectLater(chromeSafariBrowser.firstPageLoaded.future, completes);
|
||||
await chromeSafariBrowser.close();
|
||||
@ -53,7 +47,7 @@ void customTabs() {
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
});
|
||||
|
||||
test('add custom action button and update icon', () async {
|
||||
skippableTest('add custom action button and update icon', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
var actionButtonIcon =
|
||||
await rootBundle.load('test_assets/images/flutter-logo.png');
|
||||
@ -71,7 +65,7 @@ void customTabs() {
|
||||
expect(chromeSafariBrowser.isOpened(), true);
|
||||
expect(() async {
|
||||
await chromeSafariBrowser.open(url: TEST_CROSS_PLATFORM_URL_1);
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await expectLater(chromeSafariBrowser.firstPageLoaded.future, completes);
|
||||
await chromeSafariBrowser.updateActionButton(
|
||||
@ -82,7 +76,7 @@ void customTabs() {
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
}, skip: shouldSkip);
|
||||
|
||||
test('mayLaunchUrl and launchUrl', () async {
|
||||
skippableTest('mayLaunchUrl and launchUrl', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
|
||||
@ -104,7 +98,7 @@ void customTabs() {
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
});
|
||||
|
||||
test('onNavigationEvent', () async {
|
||||
skippableTest('onNavigationEvent', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
|
||||
@ -118,7 +112,7 @@ void customTabs() {
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
});
|
||||
|
||||
test('add and update secondary toolbar', () async {
|
||||
skippableTest('add and update secondary toolbar', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
chromeSafariBrowser.setSecondaryToolbar(
|
||||
ChromeSafariBrowserSecondaryToolbar(
|
||||
@ -172,7 +166,7 @@ void customTabs() {
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
});
|
||||
|
||||
test('getMaxToolbarItems', () async {
|
||||
skippableTest('getMaxToolbarItems', () async {
|
||||
expect(await ChromeSafariBrowser.getMaxToolbarItems(),
|
||||
greaterThanOrEqualTo(0));
|
||||
});
|
||||
|
@ -1,17 +1,21 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
|
||||
import 'custom_menu_item.dart';
|
||||
import 'custom_tabs.dart';
|
||||
import 'open_and_close.dart';
|
||||
import 'trusted_web_activity.dart';
|
||||
import 'sf_safari_view_controller.dart';
|
||||
part 'custom_menu_item.dart';
|
||||
part 'custom_tabs.dart';
|
||||
part 'open_and_close.dart';
|
||||
part 'trusted_web_activity.dart';
|
||||
part 'sf_safari_view_controller.dart';
|
||||
|
||||
void main() {
|
||||
final shouldSkip =
|
||||
kIsWeb || [TargetPlatform.macOS].contains(defaultTargetPlatform);
|
||||
|
||||
group('ChromeSafariBrowser', () {
|
||||
skippableGroup('ChromeSafariBrowser', () {
|
||||
openAndClose();
|
||||
customMenuItem();
|
||||
customTabs();
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void openAndClose() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -11,7 +6,7 @@ void openAndClose() {
|
||||
: ![TargetPlatform.android, TargetPlatform.iOS]
|
||||
.contains(defaultTargetPlatform);
|
||||
|
||||
test('open and close', () async {
|
||||
skippableTest('open and close', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
|
||||
@ -50,7 +45,7 @@ void openAndClose() {
|
||||
expect(chromeSafariBrowser.isOpened(), true);
|
||||
expect(() async {
|
||||
await chromeSafariBrowser.open(url: TEST_CROSS_PLATFORM_URL_1);
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await expectLater(chromeSafariBrowser.firstPageLoaded.future, completes);
|
||||
await chromeSafariBrowser.close();
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void sfSafariViewController() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -12,8 +7,8 @@ void sfSafariViewController() {
|
||||
TargetPlatform.iOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('SF Safari View Controller', () {
|
||||
test('onCompletedInitialLoad did load successfully', () async {
|
||||
skippableGroup('SF Safari View Controller', () {
|
||||
skippableTest('onCompletedInitialLoad did load successfully', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
|
||||
@ -22,7 +17,7 @@ void sfSafariViewController() {
|
||||
expect(chromeSafariBrowser.isOpened(), true);
|
||||
expect(() async {
|
||||
await chromeSafariBrowser.open(url: TEST_CROSS_PLATFORM_URL_1);
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
expect(await chromeSafariBrowser.firstPageLoaded.future, true);
|
||||
await chromeSafariBrowser.close();
|
||||
@ -31,11 +26,11 @@ void sfSafariViewController() {
|
||||
});
|
||||
|
||||
// TODO: this test takes a lot of time to complete. Tested on iOS 16.0.
|
||||
// test('clearWebsiteData', () async {
|
||||
// skippableTest('clearWebsiteData', () async {
|
||||
// await expectLater(ChromeSafariBrowser.clearWebsiteData(), completes);
|
||||
// });
|
||||
|
||||
test('create and invalidate Prewarming Token', () async {
|
||||
skippableTest('create and invalidate Prewarming Token', () async {
|
||||
final prewarmingToken =
|
||||
await ChromeSafariBrowser.prewarmConnections([TEST_URL_1]);
|
||||
expect(prewarmingToken, isNotNull);
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void trustedWebActivity() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -12,8 +7,8 @@ void trustedWebActivity() {
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('Trusted Web Activity', () {
|
||||
test('basic', () async {
|
||||
skippableGroup('Trusted Web Activity', () {
|
||||
skippableTest('basic', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
|
||||
@ -24,7 +19,7 @@ void trustedWebActivity() {
|
||||
expect(chromeSafariBrowser.isOpened(), true);
|
||||
expect(() async {
|
||||
await chromeSafariBrowser.open(url: TEST_CROSS_PLATFORM_URL_1);
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await expectLater(chromeSafariBrowser.firstPageLoaded.future, completes);
|
||||
await chromeSafariBrowser.close();
|
||||
@ -32,7 +27,7 @@ void trustedWebActivity() {
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
});
|
||||
|
||||
test('single instance', () async {
|
||||
skippableTest('single instance', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
|
||||
@ -44,7 +39,7 @@ void trustedWebActivity() {
|
||||
expect(chromeSafariBrowser.isOpened(), true);
|
||||
expect(() async {
|
||||
await chromeSafariBrowser.open(url: TEST_CROSS_PLATFORM_URL_1);
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await expectLater(chromeSafariBrowser.firstPageLoaded.future, completes);
|
||||
await chromeSafariBrowser.close();
|
||||
@ -52,7 +47,7 @@ void trustedWebActivity() {
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
});
|
||||
|
||||
test('validate relationship', () async {
|
||||
skippableTest('validate relationship', () async {
|
||||
var chromeSafariBrowser = MyChromeSafariBrowser();
|
||||
expect(chromeSafariBrowser.isOpened(), false);
|
||||
|
||||
|
@ -1,12 +1,18 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'set_get_delete.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
|
||||
part 'set_get_delete.dart';
|
||||
|
||||
void main() {
|
||||
final shouldSkip = kIsWeb;
|
||||
|
||||
group('Cookie Manager', () {
|
||||
skippableGroup('Cookie Manager', () {
|
||||
setGetDelete();
|
||||
}, skip: shouldSkip);
|
||||
}
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void setGetDelete() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void setGetDelete() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('set, get, delete', (WidgetTester tester) async {
|
||||
skippableTestWidgets('set, get, delete', (WidgetTester tester) async {
|
||||
CookieManager cookieManager = CookieManager.instance();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void findInteractions() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,7 +9,7 @@ void findInteractions() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('find interactions', (WidgetTester tester) async {
|
||||
skippableTestWidgets('find interactions', (WidgetTester tester) async {
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final findInteractionController = FindInteractionController();
|
||||
|
||||
@ -71,7 +66,7 @@ void findInteractions() {
|
||||
}
|
||||
}, skip: shouldSkip);
|
||||
|
||||
testWidgets('onFindResultReceived', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onFindResultReceived', (WidgetTester tester) async {
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<int> numberOfMatchesCompleter = Completer<int>();
|
||||
final findInteractionController = FindInteractionController(
|
||||
|
@ -1,13 +1,18 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'find_interactions.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import '../util.dart';
|
||||
|
||||
part 'find_interactions.dart';
|
||||
|
||||
void main() {
|
||||
final shouldSkip =
|
||||
kIsWeb || [TargetPlatform.macOS].contains(defaultTargetPlatform);
|
||||
|
||||
group('FindInteractionController', () {
|
||||
skippableGroup('FindInteractionController', () {
|
||||
findInteractions();
|
||||
}, skip: shouldSkip);
|
||||
}
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void convertToInAppWebView() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -15,7 +8,7 @@ void convertToInAppWebView() {
|
||||
TargetPlatform.iOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('convert to InAppWebView', (WidgetTester tester) async {
|
||||
skippableTestWidgets('convert to InAppWebView', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void customSize() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void customSize() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('set and get custom size', () async {
|
||||
skippableTest('set and get custom size', () async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
||||
|
@ -1,13 +1,20 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'convert_to_inappwebview.dart';
|
||||
import 'take_screenshot.dart';
|
||||
import 'custom_size.dart';
|
||||
import 'run_and_dispose.dart';
|
||||
import 'set_get_settings.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
|
||||
part 'convert_to_inappwebview.dart';
|
||||
part 'take_screenshot.dart';
|
||||
part 'custom_size.dart';
|
||||
part 'run_and_dispose.dart';
|
||||
part 'set_get_settings.dart';
|
||||
|
||||
void main() {
|
||||
group('HeadlessInAppWebView', () {
|
||||
skippableGroup('HeadlessInAppWebView', () {
|
||||
runAndDispose();
|
||||
takeScreenshot();
|
||||
customSize();
|
||||
|
@ -1,10 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void runAndDispose() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -15,7 +9,7 @@ void runAndDispose() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('run and dispose', () async {
|
||||
skippableTest('run and dispose', () async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,10 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void setGetSettings() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -15,7 +9,7 @@ void setGetSettings() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('set/get settings', () async {
|
||||
skippableTest('set/get settings', () async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,12 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void takeScreenshot() {
|
||||
final shouldSkip = kIsWeb ||
|
||||
@ -16,7 +8,7 @@ void takeScreenshot() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('take screenshot', () async {
|
||||
skippableTest('take screenshot', () async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -0,0 +1,70 @@
|
||||
part of 'main.dart';
|
||||
|
||||
void customMenuItems() {
|
||||
final shouldSkip = kIsWeb
|
||||
? true
|
||||
: ![
|
||||
TargetPlatform.android,
|
||||
TargetPlatform.iOS,
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
skippableTest('custom menu items', () async {
|
||||
var inAppBrowser = new MyInAppBrowser();
|
||||
|
||||
final data = (await rootBundle.load('test_assets/images/flutter-logo.png'))
|
||||
.buffer
|
||||
.asUint8List();
|
||||
|
||||
inAppBrowser.addMenuItem(InAppBrowserMenuItem(
|
||||
id: 0,
|
||||
title: 'Menu Item 0',
|
||||
iconColor: Colors.black,
|
||||
order: 0,
|
||||
onClick: () {
|
||||
inAppBrowser.webViewController?.reload();
|
||||
},
|
||||
));
|
||||
inAppBrowser.addMenuItem(InAppBrowserMenuItem(
|
||||
id: 1,
|
||||
title: 'Menu Item 1',
|
||||
icon: data,
|
||||
showAsAction: true,
|
||||
order: 2,
|
||||
onClick: () {
|
||||
inAppBrowser.webViewController?.reload();
|
||||
},
|
||||
));
|
||||
|
||||
var icon = null;
|
||||
if ([
|
||||
TargetPlatform.iOS,
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform)) {
|
||||
icon = UIImage(systemName: 'ellipsis.circle');
|
||||
} else if (defaultTargetPlatform == TargetPlatform.android) {
|
||||
icon =
|
||||
AndroidResource.drawable(name: 'ic_menu_edit', defPackage: 'android');
|
||||
}
|
||||
inAppBrowser.addMenuItem(InAppBrowserMenuItem(
|
||||
id: 2,
|
||||
title: 'Menu Item 2',
|
||||
icon: icon,
|
||||
iconColor: Colors.red,
|
||||
showAsAction: true,
|
||||
order: 1,
|
||||
onClick: () {
|
||||
inAppBrowser.webViewController?.reload();
|
||||
},
|
||||
));
|
||||
|
||||
await inAppBrowser.openUrlRequest(
|
||||
urlRequest: URLRequest(url: TEST_URL_1),
|
||||
settings: InAppBrowserClassSettings(
|
||||
browserSettings: InAppBrowserSettings(hideDefaultMenuItems: true)));
|
||||
await inAppBrowser.browserCreated.future;
|
||||
await inAppBrowser.firstPageLoaded.future;
|
||||
|
||||
await expectLater(inAppBrowser.close(), completes);
|
||||
}, skip: shouldSkip);
|
||||
}
|
@ -1,9 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void hideAndShow() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,7 +9,7 @@ void hideAndShow() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('hide and show', () async {
|
||||
skippableTest('hide and show', () async {
|
||||
var inAppBrowser = new MyInAppBrowser();
|
||||
await inAppBrowser.openUrlRequest(
|
||||
urlRequest: URLRequest(url: TEST_URL_1),
|
||||
@ -28,5 +23,7 @@ void hideAndShow() {
|
||||
expect(await inAppBrowser.isHidden(), false);
|
||||
await expectLater(inAppBrowser.hide(), completes);
|
||||
expect(await inAppBrowser.isHidden(), true);
|
||||
|
||||
await expectLater(inAppBrowser.close(), completes);
|
||||
}, skip: shouldSkip);
|
||||
}
|
||||
|
@ -1,20 +1,27 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
|
||||
import 'open_data_and_close.dart';
|
||||
import 'open_file_and_close.dart';
|
||||
import 'open_url_and_close.dart';
|
||||
import 'set_get_settings.dart';
|
||||
import 'hide_and_show.dart';
|
||||
part 'open_data_and_close.dart';
|
||||
part 'open_file_and_close.dart';
|
||||
part 'open_url_and_close.dart';
|
||||
part 'set_get_settings.dart';
|
||||
part 'hide_and_show.dart';
|
||||
part 'custom_menu_items.dart';
|
||||
|
||||
void main() {
|
||||
final shouldSkip = kIsWeb;
|
||||
|
||||
group('InAppBrowser', () {
|
||||
skippableGroup('InAppBrowser', () {
|
||||
openUrlAndClose();
|
||||
openFileAndClose();
|
||||
openDataAndClose();
|
||||
setGetSettings();
|
||||
hideAndShow();
|
||||
customMenuItems();
|
||||
}, skip: shouldSkip);
|
||||
}
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void openDataAndClose() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,12 +9,12 @@ void openDataAndClose() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('open data and close', () async {
|
||||
skippableTest('open data and close', () async {
|
||||
var inAppBrowser = new MyInAppBrowser();
|
||||
expect(inAppBrowser.isOpened(), false);
|
||||
expect(() async {
|
||||
await inAppBrowser.show();
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await inAppBrowser.openData(
|
||||
data: """
|
||||
@ -46,7 +41,7 @@ void openDataAndClose() {
|
||||
expect(() async {
|
||||
await inAppBrowser.openUrlRequest(
|
||||
urlRequest: URLRequest(url: TEST_URL_1));
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await inAppBrowser.firstPageLoaded.future;
|
||||
var controller = inAppBrowser.webViewController;
|
||||
@ -56,6 +51,7 @@ void openDataAndClose() {
|
||||
expect(url, TEST_CROSS_PLATFORM_URL_1.toString());
|
||||
|
||||
await inAppBrowser.close();
|
||||
await inAppBrowser.browserClosed.future;
|
||||
expect(inAppBrowser.isOpened(), false);
|
||||
expect(inAppBrowser.webViewController, isNull);
|
||||
}, skip: shouldSkip);
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void openFileAndClose() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,12 +9,12 @@ void openFileAndClose() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('open file and close', () async {
|
||||
skippableTest('open file and close', () async {
|
||||
var inAppBrowser = new MyInAppBrowser();
|
||||
expect(inAppBrowser.isOpened(), false);
|
||||
expect(() async {
|
||||
await inAppBrowser.show();
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await inAppBrowser.openFile(
|
||||
assetFilePath: "test_assets/in_app_webview_initial_file_test.html");
|
||||
@ -28,7 +23,7 @@ void openFileAndClose() {
|
||||
expect(() async {
|
||||
await inAppBrowser.openUrlRequest(
|
||||
urlRequest: URLRequest(url: TEST_URL_1));
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await inAppBrowser.firstPageLoaded.future;
|
||||
var controller = inAppBrowser.webViewController;
|
||||
@ -38,6 +33,7 @@ void openFileAndClose() {
|
||||
expect(url, endsWith("in_app_webview_initial_file_test.html"));
|
||||
|
||||
await inAppBrowser.close();
|
||||
await inAppBrowser.browserClosed.future;
|
||||
expect(inAppBrowser.isOpened(), false);
|
||||
expect(inAppBrowser.webViewController, isNull);
|
||||
}, skip: shouldSkip);
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void openUrlAndClose() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,12 +9,12 @@ void openUrlAndClose() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('open url and close', () async {
|
||||
skippableTest('open url and close', () async {
|
||||
var inAppBrowser = new MyInAppBrowser();
|
||||
expect(inAppBrowser.isOpened(), false);
|
||||
expect(() async {
|
||||
await inAppBrowser.show();
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await inAppBrowser.openUrlRequest(urlRequest: URLRequest(url: TEST_URL_1));
|
||||
await inAppBrowser.browserCreated.future;
|
||||
@ -27,7 +22,7 @@ void openUrlAndClose() {
|
||||
expect(() async {
|
||||
await inAppBrowser.openUrlRequest(
|
||||
urlRequest: URLRequest(url: TEST_CROSS_PLATFORM_URL_1));
|
||||
}, throwsException);
|
||||
}, throwsAssertionError);
|
||||
|
||||
await inAppBrowser.firstPageLoaded.future;
|
||||
var controller = inAppBrowser.webViewController;
|
||||
@ -37,6 +32,7 @@ void openUrlAndClose() {
|
||||
expect(url, TEST_URL_1.toString());
|
||||
|
||||
await inAppBrowser.close();
|
||||
await inAppBrowser.browserClosed.future;
|
||||
expect(inAppBrowser.isOpened(), false);
|
||||
expect(inAppBrowser.webViewController, isNull);
|
||||
}, skip: shouldSkip);
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void setGetSettings() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,7 +9,7 @@ void setGetSettings() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('set/get settings', () async {
|
||||
skippableTest('set/get settings', () async {
|
||||
var inAppBrowser = new MyInAppBrowser();
|
||||
await inAppBrowser.openUrlRequest(
|
||||
urlRequest: URLRequest(url: TEST_URL_1),
|
||||
@ -34,5 +29,7 @@ void setGetSettings() {
|
||||
settings = await inAppBrowser.getSettings();
|
||||
expect(settings, isNotNull);
|
||||
expect(settings!.browserSettings.hideToolbarTop, false);
|
||||
|
||||
await expectLater(inAppBrowser.close(), completes);
|
||||
}, skip: shouldSkip);
|
||||
}
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void loadAssetFile(InAppLocalhostServer localhostServer) {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,7 +9,7 @@ void loadAssetFile(InAppLocalhostServer localhostServer) {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('load asset file', (WidgetTester tester) async {
|
||||
skippableTestWidgets('load asset file', (WidgetTester tester) async {
|
||||
expect(localhostServer.isRunning(), true);
|
||||
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
|
@ -1,13 +1,17 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import '../util.dart';
|
||||
|
||||
import 'load_asset_file.dart';
|
||||
part 'load_asset_file.dart';
|
||||
|
||||
void main() {
|
||||
final shouldSkip = kIsWeb;
|
||||
|
||||
group('InAppLocalhostServer', () {
|
||||
skippableGroup('InAppLocalhostServer', () {
|
||||
final InAppLocalhostServer localhostServer = InAppLocalhostServer();
|
||||
|
||||
setUpAll(() async {
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void applePayAPI() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -13,7 +8,7 @@ void applePayAPI() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('Apple Pay API enabled', (WidgetTester tester) async {
|
||||
skippableTestWidgets('Apple Pay API enabled', (WidgetTester tester) async {
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<String> alertMessageCompleter = Completer<String>();
|
||||
|
||||
|
@ -1,12 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void audioPlaybackPolicy() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -17,7 +9,7 @@ void audioPlaybackPolicy() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('Audio playback policy', () {
|
||||
skippableGroup('Audio playback policy', () {
|
||||
String audioTestBase64 = "";
|
||||
setUpAll(() async {
|
||||
final ByteData audioData =
|
||||
@ -48,7 +40,7 @@ void audioPlaybackPolicy() {
|
||||
audioTestBase64 = base64Encode(const Utf8Encoder().convert(audioTest));
|
||||
});
|
||||
|
||||
testWidgets('Auto media playback', (WidgetTester tester) async {
|
||||
skippableTestWidgets('Auto media playback', (WidgetTester tester) async {
|
||||
Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
Completer<void> pageStarted = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void clearCache() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void clearCache() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('clearCache', (WidgetTester tester) async {
|
||||
skippableTestWidgets('clearCache', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,6 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void clearClientCertPreferences() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -9,7 +7,7 @@ void clearClientCertPreferences() {
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('clearClientCertPreferences', () async {
|
||||
skippableTest('clearClientCertPreferences', () async {
|
||||
await expectLater(
|
||||
InAppWebViewController.clearClientCertPreferences(), completes);
|
||||
}, skip: shouldSkip);
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void clearFocus() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void clearFocus() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('clearFocus', (WidgetTester tester) async {
|
||||
skippableTestWidgets('clearFocus', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void clearSslPreferences() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,7 +7,7 @@ void clearSslPreferences() {
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('clearSslPreferences', (WidgetTester tester) async {
|
||||
skippableTestWidgets('clearSslPreferences', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void contentBlocker() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void contentBlocker() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('Content Blocker', (WidgetTester tester) async {
|
||||
skippableTestWidgets('Content Blocker', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void createPdf() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -15,7 +8,7 @@ void createPdf() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('createPdf', (WidgetTester tester) async {
|
||||
skippableTestWidgets('createPdf', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getCertificate() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void getCertificate() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('getCertificate', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getCertificate', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getContentHeight() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void getContentHeight() {
|
||||
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('getContentHeight', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getContentHeight', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,6 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getCurrentWebViewPackage() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -9,7 +7,7 @@ void getCurrentWebViewPackage() {
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('getCurrentWebViewPackage', () async {
|
||||
skippableTest('getCurrentWebViewPackage', () async {
|
||||
expect(await InAppWebViewController.getCurrentWebViewPackage(), isNotNull);
|
||||
}, skip: shouldSkip);
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getDefaultUserAgent() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -11,7 +9,7 @@ void getDefaultUserAgent() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('getDefaultUserAgent', () async {
|
||||
skippableTest('getDefaultUserAgent', () async {
|
||||
expect(await InAppWebViewController.getDefaultUserAgent(), isNotNull);
|
||||
}, skip: shouldSkip);
|
||||
}
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getFavicons() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void getFavicons() {
|
||||
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('getFavicons', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getFavicons', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getHtml() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void getHtml() {
|
||||
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('getHtml', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getHtml', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getMetaTags() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void getMetaTags() {
|
||||
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('getMetaTags', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getMetaTags', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getMetaThemeColor() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void getMetaThemeColor() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('getMetaThemeColor', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getMetaThemeColor', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getOriginalUrl() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void getOriginalUrl() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('getOriginalUrl', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getOriginalUrl', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getProgress() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void getProgress() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('getProgress', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getProgress', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,12 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void getTitle() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -33,7 +25,7 @@ void getTitle() {
|
||||
: TEST_WEB_PLATFORM_URL_1;
|
||||
var expectedValue = !kIsWeb ? 'Some title' : 'page';
|
||||
|
||||
testWidgets('getTitle', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getTitle', (WidgetTester tester) async {
|
||||
final Completer<void> pageStarted = Completer<void>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
|
@ -1,6 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void handlesURLScheme() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -10,7 +8,7 @@ void handlesURLScheme() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
test('handlesURLScheme', () async {
|
||||
skippableTest('handlesURLScheme', () async {
|
||||
expect(await InAppWebViewController.handlesURLScheme("http"), true);
|
||||
expect(await InAppWebViewController.handlesURLScheme("https"), true);
|
||||
}, skip: shouldSkip);
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../env.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void httpAuthCredentialDatabase() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,8 +9,8 @@ void httpAuthCredentialDatabase() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('Http Auth Credential Database', () {
|
||||
testWidgets('use saved credentials', (WidgetTester tester) async {
|
||||
skippableGroup('Http Auth Credential Database', () {
|
||||
skippableTestWidgets('use saved credentials', (WidgetTester tester) async {
|
||||
HttpAuthCredentialDatabase httpAuthCredentialDatabase =
|
||||
HttpAuthCredentialDatabase.instance();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
@ -83,7 +76,7 @@ void httpAuthCredentialDatabase() {
|
||||
expect(credentials, isEmpty);
|
||||
});
|
||||
|
||||
testWidgets('save credentials', (WidgetTester tester) async {
|
||||
skippableTestWidgets('save credentials', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void initialUrlRequest() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void initialUrlRequest() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('initial url request', () {
|
||||
skippableGroup('initial url request', () {
|
||||
final shouldSkipTest2 = kIsWeb
|
||||
? true
|
||||
: ![
|
||||
@ -24,7 +17,8 @@ void initialUrlRequest() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('launches with allowsBackForwardNavigationGestures true',
|
||||
skippableTestWidgets(
|
||||
'launches with allowsBackForwardNavigationGestures true',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
@ -66,7 +60,7 @@ void initialUrlRequest() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('basic', (WidgetTester tester) async {
|
||||
skippableTestWidgets('basic', (WidgetTester tester) async {
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void injectCSS() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,8 +11,8 @@ void injectCSS() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_ABOUT_BLANK : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
group('inject CSS', () {
|
||||
testWidgets('code', (WidgetTester tester) async {
|
||||
skippableGroup('inject CSS', () {
|
||||
skippableTestWidgets('code', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -58,7 +51,7 @@ void injectCSS() {
|
||||
expect(backgroundColor, 'rgb(0, 0, 255)');
|
||||
});
|
||||
|
||||
testWidgets('file from url', (WidgetTester tester) async {
|
||||
skippableTestWidgets('file from url', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -94,7 +87,7 @@ void injectCSS() {
|
||||
false);
|
||||
});
|
||||
|
||||
testWidgets('file from asset', (WidgetTester tester) async {
|
||||
skippableTestWidgets('file from asset', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void injectJavascriptFile() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,8 +11,8 @@ void injectJavascriptFile() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_ABOUT_BLANK : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
group('inject javascript file', () {
|
||||
testWidgets('from url', (WidgetTester tester) async {
|
||||
skippableGroup('inject javascript file', () {
|
||||
skippableTestWidgets('from url', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -81,7 +74,7 @@ void injectJavascriptFile() {
|
||||
false);
|
||||
});
|
||||
|
||||
testWidgets('from asset', (WidgetTester tester) async {
|
||||
skippableTestWidgets('from asset', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,12 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../env.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void interceptAjaxRequest() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -17,8 +9,8 @@ void interceptAjaxRequest() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('intercept ajax request', () {
|
||||
testWidgets('send string data', (WidgetTester tester) async {
|
||||
skippableGroup('intercept ajax request', () {
|
||||
skippableTestWidgets('send string data', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer shouldInterceptAjaxPostRequestCompleter =
|
||||
@ -100,7 +92,7 @@ void interceptAjaxRequest() {
|
||||
true);
|
||||
});
|
||||
|
||||
testWidgets('send json data', (WidgetTester tester) async {
|
||||
skippableTestWidgets('send json data', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer shouldInterceptAjaxPostRequestCompleter =
|
||||
@ -188,7 +180,8 @@ void interceptAjaxRequest() {
|
||||
true);
|
||||
});
|
||||
|
||||
testWidgets('send URLSearchParams data', (WidgetTester tester) async {
|
||||
skippableTestWidgets('send URLSearchParams data',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer shouldInterceptAjaxPostRequestCompleter =
|
||||
@ -272,7 +265,7 @@ void interceptAjaxRequest() {
|
||||
true);
|
||||
});
|
||||
|
||||
testWidgets('send FormData', (WidgetTester tester) async {
|
||||
skippableTestWidgets('send FormData', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer shouldInterceptAjaxPostRequestCompleter =
|
||||
|
@ -1,12 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../env.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void interceptFetchRequest() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -17,8 +9,8 @@ void interceptFetchRequest() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('intercept fetch request', () {
|
||||
testWidgets('send string data', (WidgetTester tester) async {
|
||||
skippableGroup('intercept fetch request', () {
|
||||
skippableTestWidgets('send string data', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<Map<String, dynamic>> fetchPostCompleter =
|
||||
@ -93,7 +85,7 @@ void interceptFetchRequest() {
|
||||
true);
|
||||
});
|
||||
|
||||
testWidgets('send json data', (WidgetTester tester) async {
|
||||
skippableTestWidgets('send json data', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<Map<String, dynamic>> fetchPostCompleter =
|
||||
@ -174,7 +166,8 @@ void interceptFetchRequest() {
|
||||
true);
|
||||
});
|
||||
|
||||
testWidgets('send URLSearchParams data', (WidgetTester tester) async {
|
||||
skippableTestWidgets('send URLSearchParams data',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<Map<String, dynamic>> fetchPostCompleter =
|
||||
@ -251,7 +244,7 @@ void interceptFetchRequest() {
|
||||
true);
|
||||
});
|
||||
|
||||
testWidgets('send FormData', (WidgetTester tester) async {
|
||||
skippableTestWidgets('send FormData', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<Map<String, dynamic>> fetchPostCompleter =
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void isLoading() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void isLoading() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('isLoading', (WidgetTester tester) async {
|
||||
skippableTestWidgets('isLoading', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageStarted = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void isSecureContext() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void isSecureContext() {
|
||||
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('isSecureContext', (WidgetTester tester) async {
|
||||
skippableTestWidgets('isSecureContext', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void javascriptCodeEvaluation() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void javascriptCodeEvaluation() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('javascript code evaluation', () {
|
||||
skippableGroup('javascript code evaluation', () {
|
||||
final shouldSkipTest1 = kIsWeb
|
||||
? false
|
||||
: ![
|
||||
@ -25,7 +18,7 @@ void javascriptCodeEvaluation() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('evaluateJavascript', (WidgetTester tester) async {
|
||||
skippableTestWidgets('evaluateJavascript', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -68,7 +61,7 @@ void javascriptCodeEvaluation() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('evaluateJavascript with content world',
|
||||
skippableTestWidgets('evaluateJavascript with content world',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
@ -113,7 +106,7 @@ void javascriptCodeEvaluation() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('callAsyncJavaScript', (WidgetTester tester) async {
|
||||
skippableTestWidgets('callAsyncJavaScript', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -174,7 +167,7 @@ void javascriptCodeEvaluation() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('callAsyncJavaScript with content world',
|
||||
skippableTestWidgets('callAsyncJavaScript with content world',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void javascriptDialogs() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,7 +9,7 @@ void javascriptDialogs() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('javascript dialogs', (WidgetTester tester) async {
|
||||
skippableTestWidgets('javascript dialogs', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../util.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void javascriptHandler() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void javascriptHandler() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('JavaScript Handler', (WidgetTester tester) async {
|
||||
skippableTestWidgets('JavaScript Handler', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageStarted = Completer<void>();
|
||||
|
76
example/integration_test/in_app_webview/keep_alive.dart
Normal file
76
example/integration_test/in_app_webview/keep_alive.dart
Normal file
@ -0,0 +1,76 @@
|
||||
part of 'main.dart';
|
||||
|
||||
void keepAlive() {
|
||||
final shouldSkip = kIsWeb
|
||||
? true
|
||||
: ![
|
||||
TargetPlatform.android,
|
||||
TargetPlatform.iOS,
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
final initialUrl =
|
||||
!kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
skippableTestWidgets('Keep Alive', (WidgetTester tester) async {
|
||||
final keepAlive = InAppWebViewKeepAlive();
|
||||
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<InAppWebViewController> controllerCompleter2 =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
final Completer<void> pageLoaded2 = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: InAppWebView(
|
||||
key: GlobalKey(),
|
||||
keepAlive: keepAlive,
|
||||
initialUrlRequest: URLRequest(url: initialUrl),
|
||||
onWebViewCreated: (controller) {
|
||||
controllerCompleter.complete(controller);
|
||||
},
|
||||
onLoadStop: (controller, url) {
|
||||
if (!pageLoaded.isCompleted &&
|
||||
initialUrl.toString() == url.toString()) {
|
||||
pageLoaded.complete();
|
||||
}
|
||||
if (!pageLoaded2.isCompleted &&
|
||||
TEST_CROSS_PLATFORM_URL_2.toString() == url.toString()) {
|
||||
pageLoaded2.complete();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final InAppWebViewController controller = await controllerCompleter.future;
|
||||
await pageLoaded.future;
|
||||
|
||||
await controller.loadUrl(
|
||||
urlRequest: URLRequest(url: TEST_CROSS_PLATFORM_URL_2));
|
||||
await pageLoaded2.future;
|
||||
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: InAppWebView(
|
||||
key: GlobalKey(),
|
||||
keepAlive: keepAlive,
|
||||
onWebViewCreated: (controller) {
|
||||
controllerCompleter2.complete(controller);
|
||||
},
|
||||
)),
|
||||
);
|
||||
final InAppWebViewController controller2 =
|
||||
await controllerCompleter2.future;
|
||||
|
||||
final String? currentUrl = (await controller2.getUrl())?.toString();
|
||||
expect(currentUrl, TEST_CROSS_PLATFORM_URL_2.toString());
|
||||
|
||||
await expectLater(
|
||||
InAppWebViewController.disposeKeepAlive(keepAlive), completes);
|
||||
}, skip: shouldSkip);
|
||||
}
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void loadData() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void loadData() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('loadData', (WidgetTester tester) async {
|
||||
skippableTestWidgets('loadData', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void loadFile() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void loadFile() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('loadFile', (WidgetTester tester) async {
|
||||
skippableTestWidgets('loadFile', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void loadFileUrl() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -15,7 +8,7 @@ void loadFileUrl() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('load file URL', () {
|
||||
skippableGroup('load file URL', () {
|
||||
late Directory appSupportDir;
|
||||
late File fileHtml;
|
||||
late File fileJs;
|
||||
@ -53,7 +46,8 @@ void loadFileUrl() {
|
||||
fileJs.writeAsStringSync(js);
|
||||
});
|
||||
|
||||
testWidgets('initialUrl with file:// scheme and allowingReadAccessTo',
|
||||
skippableTestWidgets(
|
||||
'initialUrl with file:// scheme and allowingReadAccessTo',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<ConsoleMessage?> consoleMessageShouldNotComplete =
|
||||
Completer<ConsoleMessage?>();
|
||||
@ -97,7 +91,8 @@ void loadFileUrl() {
|
||||
expect(consoleMessage.message, 'message');
|
||||
});
|
||||
|
||||
testWidgets('loadUrl with file:// scheme and allowingReadAccessTo argument',
|
||||
skippableTestWidgets(
|
||||
'loadUrl with file:// scheme and allowingReadAccessTo argument',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<ConsoleMessage?> consoleMessageShouldNotComplete =
|
||||
Completer<ConsoleMessage?>();
|
||||
|
@ -1,13 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void loadUrl() {
|
||||
final shouldSkip1 = kIsWeb
|
||||
@ -20,7 +11,7 @@ void loadUrl() {
|
||||
|
||||
var initialUrl = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('loadUrl', (WidgetTester tester) async {
|
||||
skippableTestWidgets('loadUrl', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> firstUrlLoad = Completer<String>();
|
||||
@ -62,7 +53,7 @@ void loadUrl() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('loadSimulatedRequest', (WidgetTester tester) async {
|
||||
skippableTestWidgets('loadSimulatedRequest', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> firstUrlLoad = Completer<String>();
|
||||
|
@ -1,95 +1,199 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:io';
|
||||
import 'dart:collection';
|
||||
|
||||
import 'apple_pay_api.dart';
|
||||
import 'audio_playback_policy.dart';
|
||||
import 'clear_cache.dart';
|
||||
import 'clear_client_cert_preferences.dart';
|
||||
import 'clear_focus.dart';
|
||||
import 'clear_ssl_preferences.dart';
|
||||
import 'content_blocker.dart';
|
||||
import 'create_pdf.dart';
|
||||
import 'get_certificate.dart';
|
||||
import 'get_content_height.dart';
|
||||
import 'get_current_web_view_package.dart';
|
||||
import 'get_default_user_agent.dart';
|
||||
import 'get_favicons.dart';
|
||||
import 'get_html.dart';
|
||||
import 'get_meta_tags.dart';
|
||||
import 'get_meta_theme_color.dart';
|
||||
import 'get_original_url.dart';
|
||||
import 'get_progress.dart';
|
||||
import 'get_title.dart';
|
||||
import 'handles_url_scheme.dart';
|
||||
import 'http_auth_credential_database.dart';
|
||||
import 'initial_url_request.dart';
|
||||
import 'inject_css.dart';
|
||||
import 'inject_javascript_file.dart';
|
||||
import 'intercept_ajax_request.dart';
|
||||
import 'intercept_fetch_request.dart';
|
||||
import 'is_loading.dart';
|
||||
import 'is_secure_context.dart';
|
||||
import 'javascript_code_evaluation.dart';
|
||||
import 'javascript_dialogs.dart';
|
||||
import 'javascript_handler.dart';
|
||||
import 'load_data.dart';
|
||||
import 'load_file.dart';
|
||||
import 'load_file_url.dart';
|
||||
import 'load_url.dart';
|
||||
import 'on_console_message.dart';
|
||||
import 'on_content_size_changed.dart';
|
||||
import 'on_download_start_request.dart';
|
||||
import 'on_js_before_unload.dart';
|
||||
import 'on_received_error.dart';
|
||||
import 'on_received_http_error.dart';
|
||||
import 'on_load_resource.dart';
|
||||
import 'on_load_resource_with_custom_scheme.dart';
|
||||
import 'on_navigation_response.dart';
|
||||
import 'on_page_commit_visible.dart';
|
||||
import 'on_permission_request.dart';
|
||||
import 'on_print.dart';
|
||||
import 'on_progress_changed.dart';
|
||||
import 'on_received_icon.dart';
|
||||
import 'on_received_touch_icon_url.dart';
|
||||
import 'safe_browsing.dart';
|
||||
import 'on_scroll_changed.dart';
|
||||
import 'on_title_changed.dart';
|
||||
import 'on_update_visited_history.dart';
|
||||
import 'on_window_blur.dart';
|
||||
import 'on_window_focus.dart';
|
||||
import 'page_down_up.dart';
|
||||
import 'pause_resume.dart';
|
||||
import 'programmatic_zoom_scale.dart';
|
||||
import 'pause_resume_timers.dart';
|
||||
import 'post_requests.dart';
|
||||
import 'print_current_page.dart';
|
||||
import 'programmatic_scroll.dart';
|
||||
import 'pull_to_refresh.dart';
|
||||
import 'reload.dart';
|
||||
import 'request_focus_node_href.dart';
|
||||
import 'request_image_ref.dart';
|
||||
import 'resize_webview.dart';
|
||||
import 'web_archive.dart';
|
||||
import 'set_custom_useragent.dart';
|
||||
import 'set_get_settings.dart';
|
||||
import 'set_web_contents_debugging_enabled.dart';
|
||||
import 'should_intercept_request.dart';
|
||||
import 'should_override_url_loading.dart';
|
||||
import 'ssl_request.dart';
|
||||
import 'stop_loading.dart';
|
||||
import 't_rex_runner_game.dart';
|
||||
import 'take_screenshot.dart';
|
||||
import 'user_scripts.dart';
|
||||
import 'video_playback_policy.dart';
|
||||
import 'web_history.dart';
|
||||
import 'web_message.dart';
|
||||
import 'webview_asset_loader.dart';
|
||||
import 'webview_windows.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import '../util.dart';
|
||||
import '../constants.dart';
|
||||
import '../env.dart';
|
||||
|
||||
part 'apple_pay_api.dart';
|
||||
|
||||
part 'audio_playback_policy.dart';
|
||||
|
||||
part 'clear_cache.dart';
|
||||
|
||||
part 'clear_client_cert_preferences.dart';
|
||||
|
||||
part 'clear_focus.dart';
|
||||
|
||||
part 'clear_ssl_preferences.dart';
|
||||
|
||||
part 'content_blocker.dart';
|
||||
|
||||
part 'create_pdf.dart';
|
||||
|
||||
part 'get_certificate.dart';
|
||||
|
||||
part 'get_content_height.dart';
|
||||
|
||||
part 'get_current_web_view_package.dart';
|
||||
|
||||
part 'get_default_user_agent.dart';
|
||||
|
||||
part 'get_favicons.dart';
|
||||
|
||||
part 'get_html.dart';
|
||||
|
||||
part 'get_meta_tags.dart';
|
||||
|
||||
part 'get_meta_theme_color.dart';
|
||||
|
||||
part 'get_original_url.dart';
|
||||
|
||||
part 'get_progress.dart';
|
||||
|
||||
part 'get_title.dart';
|
||||
|
||||
part 'handles_url_scheme.dart';
|
||||
|
||||
part 'http_auth_credential_database.dart';
|
||||
|
||||
part 'initial_url_request.dart';
|
||||
|
||||
part 'inject_css.dart';
|
||||
|
||||
part 'inject_javascript_file.dart';
|
||||
|
||||
part 'intercept_ajax_request.dart';
|
||||
|
||||
part 'intercept_fetch_request.dart';
|
||||
|
||||
part 'is_loading.dart';
|
||||
|
||||
part 'is_secure_context.dart';
|
||||
|
||||
part 'javascript_code_evaluation.dart';
|
||||
|
||||
part 'javascript_dialogs.dart';
|
||||
|
||||
part 'javascript_handler.dart';
|
||||
|
||||
part 'load_data.dart';
|
||||
|
||||
part 'load_file.dart';
|
||||
|
||||
part 'load_file_url.dart';
|
||||
|
||||
part 'load_url.dart';
|
||||
|
||||
part 'on_console_message.dart';
|
||||
|
||||
part 'on_content_size_changed.dart';
|
||||
|
||||
part 'on_download_start_request.dart';
|
||||
|
||||
part 'on_js_before_unload.dart';
|
||||
|
||||
part 'on_received_error.dart';
|
||||
|
||||
part 'on_received_http_error.dart';
|
||||
|
||||
part 'on_load_resource.dart';
|
||||
|
||||
part 'on_load_resource_with_custom_scheme.dart';
|
||||
|
||||
part 'on_navigation_response.dart';
|
||||
|
||||
part 'on_page_commit_visible.dart';
|
||||
|
||||
part 'on_permission_request.dart';
|
||||
|
||||
part 'on_print.dart';
|
||||
|
||||
part 'on_progress_changed.dart';
|
||||
|
||||
part 'on_received_icon.dart';
|
||||
|
||||
part 'on_received_touch_icon_url.dart';
|
||||
|
||||
part 'safe_browsing.dart';
|
||||
|
||||
part 'on_scroll_changed.dart';
|
||||
|
||||
part 'on_title_changed.dart';
|
||||
|
||||
part 'on_update_visited_history.dart';
|
||||
|
||||
part 'on_window_blur.dart';
|
||||
|
||||
part 'on_window_focus.dart';
|
||||
|
||||
part 'page_down_up.dart';
|
||||
|
||||
part 'pause_resume.dart';
|
||||
|
||||
part 'programmatic_zoom_scale.dart';
|
||||
|
||||
part 'pause_resume_timers.dart';
|
||||
|
||||
part 'post_requests.dart';
|
||||
|
||||
part 'print_current_page.dart';
|
||||
|
||||
part 'programmatic_scroll.dart';
|
||||
|
||||
part 'pull_to_refresh.dart';
|
||||
|
||||
part 'reload.dart';
|
||||
|
||||
part 'request_focus_node_href.dart';
|
||||
|
||||
part 'request_image_ref.dart';
|
||||
|
||||
part 'resize_webview.dart';
|
||||
|
||||
part 'web_archive.dart';
|
||||
|
||||
part 'set_custom_useragent.dart';
|
||||
|
||||
part 'set_get_settings.dart';
|
||||
|
||||
part 'set_web_contents_debugging_enabled.dart';
|
||||
|
||||
part 'should_intercept_request.dart';
|
||||
|
||||
part 'should_override_url_loading.dart';
|
||||
|
||||
part 'ssl_request.dart';
|
||||
|
||||
part 'stop_loading.dart';
|
||||
|
||||
part 't_rex_runner_game.dart';
|
||||
|
||||
part 'take_screenshot.dart';
|
||||
|
||||
part 'user_scripts.dart';
|
||||
|
||||
part 'video_playback_policy.dart';
|
||||
|
||||
part 'web_history.dart';
|
||||
|
||||
part 'web_message.dart';
|
||||
|
||||
part 'webview_asset_loader.dart';
|
||||
|
||||
part 'webview_windows.dart';
|
||||
|
||||
part 'keep_alive.dart';
|
||||
|
||||
void main() {
|
||||
final shouldSkip = [TargetPlatform.macOS].contains(defaultTargetPlatform);
|
||||
final shouldSkip = kIsWeb
|
||||
? false
|
||||
: ![
|
||||
TargetPlatform.android,
|
||||
TargetPlatform.iOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('InAppWebView', () {
|
||||
skippableGroup('InAppWebView', () {
|
||||
initialUrlRequest();
|
||||
setGetSettings();
|
||||
javascriptCodeEvaluation();
|
||||
@ -174,5 +278,6 @@ void main() {
|
||||
handlesURLScheme();
|
||||
webViewAssetLoader();
|
||||
onContentSizeChanged();
|
||||
keepAlive();
|
||||
}, skip: shouldSkip);
|
||||
}
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onConsoleMessage() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void onConsoleMessage() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onConsoleMessage', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onConsoleMessage', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<ConsoleMessage> onConsoleMessageCompleter =
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onContentSizeChanged() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -15,7 +8,7 @@ void onContentSizeChanged() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onContentSizeChanged', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onContentSizeChanged', (WidgetTester tester) async {
|
||||
final Completer<void> onContentSizeChangedCompleter = Completer<void>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../env.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onDownloadStartRequest() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void onDownloadStartRequest() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onDownloadStartRequest', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onDownloadStartRequest', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> onDownloadStartCompleter = Completer<String>();
|
||||
|
@ -1,8 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onJsBeforeUnload() {
|
||||
// final shouldSkip = kIsWeb
|
||||
@ -12,7 +8,7 @@ void onJsBeforeUnload() {
|
||||
// ].contains(defaultTargetPlatform);
|
||||
final shouldSkip = true;
|
||||
// on Android, for some reason, it works on an example app but not in this test
|
||||
testWidgets('onJsBeforeUnload', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onJsBeforeUnload', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> onJsBeforeUnloadCompleter = Completer<String>();
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onLoadResource() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,7 +9,7 @@ void onLoadResource() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onLoadResource', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onLoadResource', (WidgetTester tester) async {
|
||||
List<String> resourceList = [
|
||||
"https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css",
|
||||
"https://code.jquery.com/jquery-3.3.1.min.js",
|
||||
|
@ -1,10 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onLoadResourceWithCustomScheme() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -15,7 +9,8 @@ void onLoadResourceWithCustomScheme() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onLoadResourceWithCustomScheme', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onLoadResourceWithCustomScheme',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> imageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onNavigationResponse() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -15,8 +8,8 @@ void onNavigationResponse() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group("onNavigationResponse", () {
|
||||
testWidgets('allow navigation', (WidgetTester tester) async {
|
||||
skippableGroup('onNavigationResponse', () {
|
||||
skippableTestWidgets('allow navigation', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -49,7 +42,7 @@ void onNavigationResponse() {
|
||||
expect(url, TEST_URL_1.toString());
|
||||
});
|
||||
|
||||
testWidgets('cancel navigation', (WidgetTester tester) async {
|
||||
skippableTestWidgets('cancel navigation', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onPageCommitVisible() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void onPageCommitVisible() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onPageCommitVisible', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onPageCommitVisible', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> onPageCommitVisibleCompleter = Completer<String>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onPermissionRequest() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void onPermissionRequest() {
|
||||
|
||||
final expectedValue = [PermissionResourceType.CAMERA];
|
||||
|
||||
testWidgets('onPermissionRequest', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onPermissionRequest', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -66,7 +59,8 @@ void onPermissionRequest() {
|
||||
// TODO: this test is not working
|
||||
final shouldSkip2 = true;
|
||||
|
||||
testWidgets('onPermissionRequestCanceled', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onPermissionRequestCanceled',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onPrint() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void onPrint() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('onPrint', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onPrint', (WidgetTester tester) async {
|
||||
final Completer<String> onPrintCompleter = Completer<String>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onProgressChanged() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void onProgressChanged() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onProgressChanged', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onProgressChanged', (WidgetTester tester) async {
|
||||
final Completer<void> onProgressChangedCompleter = Completer<void>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onReceivedError() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,8 +9,8 @@ void onReceivedError() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('onReceivedError', () {
|
||||
testWidgets('invalid url', (WidgetTester tester) async {
|
||||
skippableGroup('onReceivedError', () {
|
||||
skippableTestWidgets('invalid url', (WidgetTester tester) async {
|
||||
final Completer<String> errorUrlCompleter = Completer<String>();
|
||||
final Completer<WebResourceErrorType> errorCodeCompleter =
|
||||
Completer<WebResourceErrorType>();
|
||||
@ -43,7 +36,7 @@ void onReceivedError() {
|
||||
expect(url, TEST_NOT_A_WEBSITE_URL.toString());
|
||||
});
|
||||
|
||||
testWidgets('event is not called with valid url',
|
||||
skippableTestWidgets('event is not called with valid url',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<void> onReceivedErrorCompleter = Completer<void>();
|
||||
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onReceivedHttpError() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void onReceivedHttpError() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onReceivedHttpError', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onReceivedHttpError', (WidgetTester tester) async {
|
||||
final Completer<String> errorUrlCompleter = Completer<String>();
|
||||
final Completer<int> statusCodeCompleter = Completer<int>();
|
||||
|
||||
|
@ -1,12 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onReceivedIcon() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -15,7 +7,7 @@ void onReceivedIcon() {
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onReceivedIcon', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onReceivedIcon', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,9 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onReceivedTouchIconUrl() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -12,7 +7,7 @@ void onReceivedTouchIconUrl() {
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('onReceivedTouchIconUrl', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onReceivedTouchIconUrl', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> onReceivedTouchIconUrlCompleter =
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onScrollChanged() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void onScrollChanged() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('onScrollChanged', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onScrollChanged', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onTitleChanged() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void onTitleChanged() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('onTitleChanged', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onTitleChanged', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onUpdateVisitedHistory() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void onUpdateVisitedHistory() {
|
||||
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('onUpdateVisitedHistory', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onUpdateVisitedHistory', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<String> firstPushCompleter = Completer<String>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onWindowBlur() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void onWindowBlur() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('onWindowBlur', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onWindowBlur', (WidgetTester tester) async {
|
||||
final Completer<void> onWindowBlurCompleter = Completer<void>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void onWindowFocus() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void onWindowFocus() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('onWindowFocus', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onWindowFocus', (WidgetTester tester) async {
|
||||
final Completer<void> onWindowFocusCompleter = Completer<void>();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void pageDownUp() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,7 +7,7 @@ void pageDownUp() {
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('pageDown/pageUp', (WidgetTester tester) async {
|
||||
skippableTestWidgets('pageDown/pageUp', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void pauseResume() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -14,7 +7,7 @@ void pauseResume() {
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('pause/resume', (WidgetTester tester) async {
|
||||
skippableTestWidgets('pause/resume', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void pauseResumeTimers() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void pauseResumeTimers() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('pause/resume timers', (WidgetTester tester) async {
|
||||
skippableTestWidgets('pause/resume timers', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,13 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../env.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void postRequests() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,8 +9,8 @@ void postRequests() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('POST requests', () {
|
||||
testWidgets('initialUrlRequest', (WidgetTester tester) async {
|
||||
skippableGroup('POST requests', () {
|
||||
skippableTestWidgets('initialUrlRequest', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> postPageLoaded = Completer<void>();
|
||||
@ -58,7 +49,7 @@ void postRequests() {
|
||||
expect(pContent, "HELLO FooBar!");
|
||||
});
|
||||
|
||||
testWidgets('loadUrl', (WidgetTester tester) async {
|
||||
skippableTestWidgets('loadUrl', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> postPageLoaded = Completer<void>();
|
||||
@ -104,7 +95,7 @@ void postRequests() {
|
||||
expect(pContent, "HELLO FooBar!");
|
||||
});
|
||||
|
||||
testWidgets('postUrl', (WidgetTester tester) async {
|
||||
skippableTestWidgets('postUrl', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> postPageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void printCurrentPage() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void printCurrentPage() {
|
||||
|
||||
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
testWidgets('printCurrentPage', (WidgetTester tester) async {
|
||||
skippableTestWidgets('printCurrentPage', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,12 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void programmaticScroll() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -17,7 +9,7 @@ void programmaticScroll() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('Programmatic Scroll', () {
|
||||
skippableGroup('Programmatic Scroll', () {
|
||||
final shouldSkipTest1 = kIsWeb
|
||||
? false
|
||||
: ![
|
||||
@ -26,7 +18,8 @@ void programmaticScroll() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('set and get scroll position', (WidgetTester tester) async {
|
||||
skippableTestWidgets('set and get scroll position',
|
||||
(WidgetTester tester) async {
|
||||
final String scrollTestPage = '''
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void programmaticZoomScale() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,14 +9,14 @@ void programmaticZoomScale() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
group('programmatic zoom scale', () {
|
||||
skippableGroup('programmatic zoom scale', () {
|
||||
final shouldSkipTest1 = kIsWeb
|
||||
? true
|
||||
: ![
|
||||
TargetPlatform.android,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('zoomIn/zoomOut', (WidgetTester tester) async {
|
||||
skippableTestWidgets('zoomIn/zoomOut', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -52,7 +45,7 @@ void programmaticZoomScale() {
|
||||
expect(await controller.zoomOut(), true);
|
||||
}, skip: shouldSkipTest1);
|
||||
|
||||
testWidgets('onZoomScaleChanged', (WidgetTester tester) async {
|
||||
skippableTestWidgets('onZoomScaleChanged', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -93,7 +86,7 @@ void programmaticZoomScale() {
|
||||
await expectLater(onZoomScaleChangedCompleter.future, completes);
|
||||
});
|
||||
|
||||
testWidgets('zoomBy', (WidgetTester tester) async {
|
||||
skippableTestWidgets('zoomBy', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -122,7 +115,7 @@ void programmaticZoomScale() {
|
||||
controller.zoomBy(zoomFactor: 3.0, animated: true), completes);
|
||||
});
|
||||
|
||||
testWidgets('getZoomScale', (WidgetTester tester) async {
|
||||
skippableTestWidgets('getZoomScale', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void pullToRefresh() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void pullToRefresh() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('launches with pull-to-refresh feature',
|
||||
skippableTestWidgets('launches with pull-to-refresh feature',
|
||||
(WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void reload() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -18,7 +11,7 @@ void reload() {
|
||||
|
||||
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
|
||||
|
||||
group('reload', () {
|
||||
skippableGroup('reload', () {
|
||||
final shouldSkipTest1 = kIsWeb
|
||||
? true
|
||||
: ![
|
||||
@ -26,7 +19,7 @@ void reload() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('from origin', (WidgetTester tester) async {
|
||||
skippableTestWidgets('from origin', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
@ -55,7 +48,7 @@ void reload() {
|
||||
await expectLater(controller.reloadFromOrigin(), completes);
|
||||
}, skip: shouldSkipTest1);
|
||||
|
||||
testWidgets('basic', (WidgetTester tester) async {
|
||||
skippableTestWidgets('basic', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final StreamController<String> pageLoads =
|
||||
|
@ -1,11 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
part of 'main.dart';
|
||||
|
||||
void requestFocusNodeHref() {
|
||||
final shouldSkip = kIsWeb
|
||||
@ -16,7 +9,7 @@ void requestFocusNodeHref() {
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
|
||||
testWidgets('requestFocusNodeHref', (WidgetTester tester) async {
|
||||
skippableTestWidgets('requestFocusNodeHref', (WidgetTester tester) async {
|
||||
final Completer<InAppWebViewController> controllerCompleter =
|
||||
Completer<InAppWebViewController>();
|
||||
final Completer<void> pageLoaded = Completer<void>();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user