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