updated tests, created InAppLocalHostServer platform interface and default implementation, use where possibile the non-Platform prefix class

This commit is contained in:
Lorenzo Pichilli 2023-11-18 01:17:45 +01:00
parent 1486b5af38
commit d37de77f36
125 changed files with 908 additions and 723 deletions

View File

@ -1,3 +1,9 @@
## 6.1.0-beta.1
### BREAKING CHANGES
Plugin conversion to a [Federated Plugin](https://docs.flutter.dev/packages-and-plugins/developing-packages#federated-plugins) to better support multiple environments and implementations.
## 6.0.0-beta.28 ## 6.0.0-beta.28
- Added `ProcessGlobalConfig` for Android WebViews - Added `ProcessGlobalConfig` for Android WebViews

View File

@ -11,8 +11,8 @@ void setGetDelete() {
skippableTestWidgets('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<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> pageLoaded = Completer<String>(); final Completer<String> pageLoaded = Completer<String>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
@ -20,12 +20,12 @@ void setGetDelete() {
onWebViewCreated: (controller) { onWebViewCreated: (controller) {
controllerCompleter.complete(controller); controllerCompleter.complete(controller);
}, },
onLoadStop: (controller, url) async {
pageLoaded.complete(url!.toString());
}
); );
if (defaultTargetPlatform == TargetPlatform.macOS) { if (defaultTargetPlatform == TargetPlatform.macOS) {
headlessWebView.onLoadStop = (controller, url) async {
pageLoaded.complete(url!.toString());
};
await headlessWebView.run(); await headlessWebView.run();
} else { } else {
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -9,8 +9,8 @@ void convertToInAppWebView() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('convert to InAppWebView', (WidgetTester tester) async { skippableTestWidgets('convert to InAppWebView', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
@ -18,22 +18,22 @@ void convertToInAppWebView() {
onWebViewCreated: (controller) { onWebViewCreated: (controller) {
controllerCompleter.complete(controller); controllerCompleter.complete(controller);
}, },
); onLoadStop: (controller, url) async {
headlessWebView.onLoadStop = (controller, url) async {
pageLoaded.complete(); pageLoaded.complete();
}; }
);
await headlessWebView.run(); await headlessWebView.run();
expect(headlessWebView.isRunning(), true); expect(headlessWebView.isRunning(), true);
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String? url = (await controller.getUrl())?.toString(); final String? url = (await controller.getUrl())?.toString();
expect(url, TEST_CROSS_PLATFORM_URL_1.toString()); expect(url, TEST_CROSS_PLATFORM_URL_1.toString());
final Completer<InAppWebViewController> widgetControllerCompleter = final Completer<PlatformInAppWebViewController> widgetControllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> loadedUrl = Completer<String>(); final Completer<String> loadedUrl = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
@ -54,7 +54,7 @@ void convertToInAppWebView() {
), ),
), ),
); );
final InAppWebViewController widgetController = final PlatformInAppWebViewController widgetController =
await widgetControllerCompleter.future; await widgetControllerCompleter.future;
expect(headlessWebView.isRunning(), false); expect(headlessWebView.isRunning(), false);

View File

@ -10,8 +10,8 @@ void customSize() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTest('set and get custom size', () async { skippableTest('set and get custom size', () async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
initialUrlRequest: URLRequest(url: TEST_CROSS_PLATFORM_URL_1), initialUrlRequest: URLRequest(url: TEST_CROSS_PLATFORM_URL_1),

View File

@ -10,8 +10,8 @@ void runAndDispose() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTest('run and dispose', () async { skippableTest('run and dispose', () async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
@ -19,15 +19,15 @@ void runAndDispose() {
onWebViewCreated: (controller) { onWebViewCreated: (controller) {
controllerCompleter.complete(controller); controllerCompleter.complete(controller);
}, },
); onLoadStop: (controller, url) async {
headlessWebView.onLoadStop = (controller, url) async {
pageLoaded.complete(); pageLoaded.complete();
}; }
);
await headlessWebView.run(); await headlessWebView.run();
expect(headlessWebView.isRunning(), true); expect(headlessWebView.isRunning(), true);
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String? url = (await controller.getUrl())?.toString(); final String? url = (await controller.getUrl())?.toString();

View File

@ -10,8 +10,8 @@ void setGetSettings() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTest('set/get settings', () async { skippableTest('set/get settings', () async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
@ -26,7 +26,7 @@ void setGetSettings() {
); );
await headlessWebView.run(); await headlessWebView.run();
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
var settings = await controller.getSettings(); var settings = await controller.getSettings();

View File

@ -9,8 +9,8 @@ void takeScreenshot() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTest('take screenshot', () async { skippableTest('take screenshot', () async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
@ -27,7 +27,7 @@ void takeScreenshot() {
await headlessWebView.run(); await headlessWebView.run();
expect(headlessWebView.isRunning(), true); expect(headlessWebView.isRunning(), true);
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String? url = (await controller.getUrl())?.toString(); final String? url = (await controller.getUrl())?.toString();

View File

@ -12,8 +12,8 @@ void loadAssetFile(InAppLocalhostServer localhostServer) {
skippableTestWidgets('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<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
initialUrlRequest: URLRequest( initialUrlRequest: URLRequest(
@ -40,7 +40,7 @@ void loadAssetFile(InAppLocalhostServer localhostServer) {
), ),
); );
} }
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
final String? currentUrl = (await controller.getUrl())?.toString(); final String? currentUrl = (await controller.getUrl())?.toString();
expect(currentUrl, 'http://localhost:8080/test_assets/index.html'); expect(currentUrl, 'http://localhost:8080/test_assets/index.html');

View File

@ -41,8 +41,8 @@ void audioPlaybackPolicy() {
}); });
skippableTestWidgets('Auto media playback', (WidgetTester tester) async { skippableTestWidgets('Auto media playback', (WidgetTester tester) async {
Completer<InAppWebViewController> controllerCompleter = Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
Completer<void> pageStarted = Completer<void>(); Completer<void> pageStarted = Completer<void>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
@ -69,7 +69,7 @@ void audioPlaybackPolicy() {
), ),
), ),
); );
InAppWebViewController controller = await controllerCompleter.future; PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageStarted.future; await pageStarted.future;
await pageLoaded.future; await pageLoaded.future;
@ -77,7 +77,7 @@ void audioPlaybackPolicy() {
await controller.evaluateJavascript(source: 'isPaused();'); await controller.evaluateJavascript(source: 'isPaused();');
expect(isPaused, false); expect(isPaused, false);
controllerCompleter = Completer<InAppWebViewController>(); controllerCompleter = Completer<PlatformInAppWebViewController>();
pageStarted = Completer<void>(); pageStarted = Completer<void>();
pageLoaded = Completer<void>(); pageLoaded = Completer<void>();

View File

@ -10,8 +10,8 @@ void clearCache() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('clearCache', (WidgetTester tester) async { skippableTestWidgets('clearCache', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void clearCache() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.clearCache(), completes); await expectLater(controller.clearCache(), completes);
}, skip: shouldSkip); }, skip: shouldSkip);

View File

@ -10,8 +10,8 @@ void clearFocus() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('clearFocus', (WidgetTester tester) async { skippableTestWidgets('clearFocus', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void clearFocus() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.clearFocus(), completes); await expectLater(controller.clearFocus(), completes);

View File

@ -8,8 +8,8 @@ void clearSslPreferences() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('clearSslPreferences', (WidgetTester tester) async { skippableTestWidgets('clearSslPreferences', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -28,7 +28,7 @@ void clearSslPreferences() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.clearSslPreferences(), completes); await expectLater(controller.clearSslPreferences(), completes);
}, skip: shouldSkip); }, skip: shouldSkip);

View File

@ -10,8 +10,8 @@ void contentBlocker() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('Content Blocker', (WidgetTester tester) async { skippableTestWidgets('Content Blocker', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(

View File

@ -9,8 +9,8 @@ void createPdf() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('createPdf', (WidgetTester tester) async { skippableTestWidgets('createPdf', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -29,7 +29,7 @@ void createPdf() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
var pdfConfiguration = PDFConfiguration( var pdfConfiguration = PDFConfiguration(

View File

@ -10,8 +10,8 @@ void getCertificate() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('getCertificate', (WidgetTester tester) async { skippableTestWidgets('getCertificate', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void getCertificate() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
var sslCertificate = await controller.getCertificate(); var sslCertificate = await controller.getCertificate();

View File

@ -12,8 +12,8 @@ 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;
skippableTestWidgets('getContentHeight', (WidgetTester tester) async { skippableTestWidgets('getContentHeight', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getContentHeight() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();

View File

@ -12,8 +12,8 @@ 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;
skippableTestWidgets('getFavicons', (WidgetTester tester) async { skippableTestWidgets('getFavicons', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getFavicons() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final List<Favicon>? favicons = await controller.getFavicons(); final List<Favicon>? favicons = await controller.getFavicons();

View File

@ -12,8 +12,8 @@ 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;
skippableTestWidgets('getHtml', (WidgetTester tester) async { skippableTestWidgets('getHtml', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getHtml() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String? html = await controller.getHtml(); final String? html = await controller.getHtml();

View File

@ -12,8 +12,8 @@ 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;
skippableTestWidgets('getMetaTags', (WidgetTester tester) async { skippableTestWidgets('getMetaTags', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getMetaTags() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
List<MetaTag> metaTags = await controller.getMetaTags(); List<MetaTag> metaTags = await controller.getMetaTags();

View File

@ -12,8 +12,8 @@ void getMetaThemeColor() {
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('getMetaThemeColor', (WidgetTester tester) async { skippableTestWidgets('getMetaThemeColor', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getMetaThemeColor() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
expect(await controller.getMetaThemeColor(), isNotNull); expect(await controller.getMetaThemeColor(), isNotNull);

View File

@ -12,8 +12,8 @@ void getOriginalUrl() {
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('getOriginalUrl', (WidgetTester tester) async { skippableTestWidgets('getOriginalUrl', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getOriginalUrl() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
var originUrl = (await controller.getOriginalUrl())?.toString(); var originUrl = (await controller.getOriginalUrl())?.toString();
expect(originUrl, url.toString()); expect(originUrl, url.toString());

View File

@ -10,8 +10,8 @@ void getProgress() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('getProgress', (WidgetTester tester) async { skippableTestWidgets('getProgress', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void getProgress() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final int? progress = await controller.getProgress(); final int? progress = await controller.getProgress();

View File

@ -28,8 +28,8 @@ void getTitle() {
skippableTestWidgets('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<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -49,7 +49,7 @@ void getTitle() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageStarted.future; await pageStarted.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -13,8 +13,8 @@ void httpAuthCredentialDatabase() {
skippableTestWidgets('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<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
httpAuthCredentialDatabase.setHttpAuthCredential( httpAuthCredentialDatabase.setHttpAuthCredential(
@ -50,7 +50,7 @@ void httpAuthCredentialDatabase() {
), ),
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -77,8 +77,8 @@ void httpAuthCredentialDatabase() {
}); });
skippableTestWidgets('save credentials', (WidgetTester tester) async { skippableTestWidgets('save credentials', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -107,7 +107,7 @@ void httpAuthCredentialDatabase() {
), ),
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -21,8 +21,8 @@ void initialUrlRequest() {
'launches with allowsBackForwardNavigationGestures true', '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<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -46,7 +46,7 @@ void initialUrlRequest() {
), ),
); );
await pageLoaded.future; await pageLoaded.future;
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
final String? currentUrl = (await controller.getUrl())?.toString(); final String? currentUrl = (await controller.getUrl())?.toString();
expect(currentUrl, TEST_URL_1.toString()); expect(currentUrl, TEST_URL_1.toString());
@ -62,8 +62,8 @@ void initialUrlRequest() {
skippableTestWidgets('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<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -82,7 +82,7 @@ void initialUrlRequest() {
); );
await pageLoaded.future; await pageLoaded.future;
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
final String? currentUrl = (await controller.getUrl())?.toString(); final String? currentUrl = (await controller.getUrl())?.toString();

View File

@ -13,8 +13,8 @@ void injectCSS() {
skippableGroup('inject CSS', () { skippableGroup('inject CSS', () {
skippableTestWidgets('code', (WidgetTester tester) async { skippableTestWidgets('code', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -33,7 +33,7 @@ void injectCSS() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -52,8 +52,8 @@ void injectCSS() {
}); });
skippableTestWidgets('file from url', (WidgetTester tester) async { skippableTestWidgets('file from url', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -72,7 +72,7 @@ void injectCSS() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -88,8 +88,8 @@ void injectCSS() {
}); });
skippableTestWidgets('file from asset', (WidgetTester tester) async { skippableTestWidgets('file from asset', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -108,7 +108,7 @@ void injectCSS() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -13,8 +13,8 @@ void injectJavascriptFile() {
skippableGroup('inject javascript file', () { skippableGroup('inject javascript file', () {
skippableTestWidgets('from url', (WidgetTester tester) async { skippableTestWidgets('from url', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> jQueryLoaded = Completer<void>(); final Completer<void> jQueryLoaded = Completer<void>();
final Completer<void> jQueryLoadError = Completer<void>(); final Completer<void> jQueryLoadError = Completer<void>();
@ -35,7 +35,7 @@ void injectJavascriptFile() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -75,8 +75,8 @@ void injectJavascriptFile() {
}); });
skippableTestWidgets('from asset', (WidgetTester tester) async { skippableTestWidgets('from asset', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -95,7 +95,7 @@ void injectJavascriptFile() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -11,8 +11,8 @@ void interceptAjaxRequest() {
skippableGroup('intercept ajax request', () { skippableGroup('intercept ajax request', () {
skippableTestWidgets('send string data', (WidgetTester tester) async { skippableTestWidgets('send string data', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer shouldInterceptAjaxPostRequestCompleter = final Completer shouldInterceptAjaxPostRequestCompleter =
Completer<void>(); Completer<void>();
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter = final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
@ -93,8 +93,8 @@ void interceptAjaxRequest() {
}); });
skippableTestWidgets('send json data', (WidgetTester tester) async { skippableTestWidgets('send json data', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer shouldInterceptAjaxPostRequestCompleter = final Completer shouldInterceptAjaxPostRequestCompleter =
Completer<void>(); Completer<void>();
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter = final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
@ -182,8 +182,8 @@ void interceptAjaxRequest() {
skippableTestWidgets('send URLSearchParams data', skippableTestWidgets('send URLSearchParams data',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer shouldInterceptAjaxPostRequestCompleter = final Completer shouldInterceptAjaxPostRequestCompleter =
Completer<void>(); Completer<void>();
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter = final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
@ -266,8 +266,8 @@ void interceptAjaxRequest() {
}); });
skippableTestWidgets('send FormData', (WidgetTester tester) async { skippableTestWidgets('send FormData', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer shouldInterceptAjaxPostRequestCompleter = final Completer shouldInterceptAjaxPostRequestCompleter =
Completer<void>(); Completer<void>();
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter = final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =

View File

@ -11,8 +11,8 @@ void interceptFetchRequest() {
skippableGroup('intercept fetch request', () { skippableGroup('intercept fetch request', () {
skippableTestWidgets('send string data', (WidgetTester tester) async { skippableTestWidgets('send string data', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<Map<String, dynamic>> fetchPostCompleter = final Completer<Map<String, dynamic>> fetchPostCompleter =
Completer<Map<String, dynamic>>(); Completer<Map<String, dynamic>>();
final Completer<void> shouldInterceptFetchPostRequestCompleter = final Completer<void> shouldInterceptFetchPostRequestCompleter =
@ -86,8 +86,8 @@ void interceptFetchRequest() {
}); });
skippableTestWidgets('send json data', (WidgetTester tester) async { skippableTestWidgets('send json data', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<Map<String, dynamic>> fetchPostCompleter = final Completer<Map<String, dynamic>> fetchPostCompleter =
Completer<Map<String, dynamic>>(); Completer<Map<String, dynamic>>();
final Completer<void> shouldInterceptFetchPostRequestCompleter = final Completer<void> shouldInterceptFetchPostRequestCompleter =
@ -168,8 +168,8 @@ void interceptFetchRequest() {
skippableTestWidgets('send URLSearchParams data', skippableTestWidgets('send URLSearchParams data',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<Map<String, dynamic>> fetchPostCompleter = final Completer<Map<String, dynamic>> fetchPostCompleter =
Completer<Map<String, dynamic>>(); Completer<Map<String, dynamic>>();
final Completer<void> shouldInterceptFetchPostRequestCompleter = final Completer<void> shouldInterceptFetchPostRequestCompleter =
@ -245,8 +245,8 @@ void interceptFetchRequest() {
}); });
skippableTestWidgets('send FormData', (WidgetTester tester) async { skippableTestWidgets('send FormData', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<Map<String, dynamic>> fetchPostCompleter = final Completer<Map<String, dynamic>> fetchPostCompleter =
Completer<Map<String, dynamic>>(); Completer<Map<String, dynamic>>();
final Completer<void> shouldInterceptFetchPostRequestCompleter = final Completer<void> shouldInterceptFetchPostRequestCompleter =

View File

@ -10,8 +10,8 @@ void isLoading() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('isLoading', (WidgetTester tester) async { skippableTestWidgets('isLoading', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageStarted = Completer<void>(); final Completer<void> pageStarted = Completer<void>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
@ -35,7 +35,7 @@ void isLoading() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageStarted.future; await pageStarted.future;
expect(await controller.isLoading(), true); expect(await controller.isLoading(), true);

View File

@ -12,8 +12,8 @@ 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;
skippableTestWidgets('isSecureContext', (WidgetTester tester) async { skippableTestWidgets('isSecureContext', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -33,7 +33,7 @@ void isSecureContext() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;
expect(await controller.isSecureContext(), true); expect(await controller.isSecureContext(), true);

View File

@ -19,8 +19,8 @@ void javascriptCodeEvaluation() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('evaluateJavascript', (WidgetTester tester) async { skippableTestWidgets('evaluateJavascript', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -38,7 +38,7 @@ void javascriptCodeEvaluation() {
), ),
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -63,8 +63,8 @@ void javascriptCodeEvaluation() {
skippableTestWidgets('evaluateJavascript with content world', skippableTestWidgets('evaluateJavascript with content world',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -82,7 +82,7 @@ void javascriptCodeEvaluation() {
), ),
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -107,8 +107,8 @@ void javascriptCodeEvaluation() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('callAsyncJavaScript', (WidgetTester tester) async { skippableTestWidgets('callAsyncJavaScript', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -126,7 +126,7 @@ void javascriptCodeEvaluation() {
), ),
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -169,8 +169,8 @@ void javascriptCodeEvaluation() {
skippableTestWidgets('callAsyncJavaScript with content world', skippableTestWidgets('callAsyncJavaScript with content world',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -188,7 +188,7 @@ void javascriptCodeEvaluation() {
), ),
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -10,8 +10,8 @@ void javascriptDialogs() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('javascript dialogs', (WidgetTester tester) async { skippableTestWidgets('javascript dialogs', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<JsAlertRequest> alertCompleter = final Completer<JsAlertRequest> alertCompleter =
Completer<JsAlertRequest>(); Completer<JsAlertRequest>();

View File

@ -10,8 +10,8 @@ void javascriptHandler() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('JavaScript Handler', (WidgetTester tester) async { skippableTestWidgets('JavaScript Handler', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
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<void> handlerFoo = Completer<void>(); final Completer<void> handlerFoo = Completer<void>();

View File

@ -15,10 +15,10 @@ void keepAlive() {
skippableTestWidgets('Keep Alive', (WidgetTester tester) async { skippableTestWidgets('Keep Alive', (WidgetTester tester) async {
final keepAlive = InAppWebViewKeepAlive(); final keepAlive = InAppWebViewKeepAlive();
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<InAppWebViewController> controllerCompleter2 = final Completer<PlatformInAppWebViewController> controllerCompleter2 =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> pageLoaded2 = Completer<void>(); final Completer<void> pageLoaded2 = Completer<void>();
@ -46,7 +46,7 @@ void keepAlive() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.loadUrl( await controller.loadUrl(
@ -64,7 +64,7 @@ void keepAlive() {
}, },
)), )),
); );
final InAppWebViewController controller2 = final PlatformInAppWebViewController controller2 =
await controllerCompleter2.future; await controllerCompleter2.future;
final String? currentUrl = (await controller2.getUrl())?.toString(); final String? currentUrl = (await controller2.getUrl())?.toString();

View File

@ -10,8 +10,8 @@ void loadData() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('loadData', (WidgetTester tester) async { skippableTestWidgets('loadData', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -31,7 +31,7 @@ void loadData() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;
final data = """ final data = """

View File

@ -10,8 +10,8 @@ void loadFile() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('loadFile', (WidgetTester tester) async { skippableTestWidgets('loadFile', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -31,7 +31,7 @@ void loadFile() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;
await controller.loadFile( await controller.loadFile(

View File

@ -12,8 +12,8 @@ void loadUrl() {
var initialUrl = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var initialUrl = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('loadUrl', (WidgetTester tester) async { skippableTestWidgets('loadUrl', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> firstUrlLoad = Completer<String>(); final Completer<String> firstUrlLoad = Completer<String>();
final Completer<String> loadedUrl = Completer<String>(); final Completer<String> loadedUrl = Completer<String>();
@ -38,7 +38,7 @@ void loadUrl() {
), ),
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
expect(await firstUrlLoad.future, initialUrl.toString()); expect(await firstUrlLoad.future, initialUrl.toString());
await controller.loadUrl( await controller.loadUrl(
@ -54,8 +54,8 @@ void loadUrl() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('loadSimulatedRequest', (WidgetTester tester) async { skippableTestWidgets('loadSimulatedRequest', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> firstUrlLoad = Completer<String>(); final Completer<String> firstUrlLoad = Completer<String>();
final Completer<String> loadedUrl = Completer<String>(); final Completer<String> loadedUrl = Completer<String>();
@ -80,7 +80,7 @@ void loadUrl() {
), ),
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
expect(await firstUrlLoad.future, initialUrl.toString()); expect(await firstUrlLoad.future, initialUrl.toString());
final htmlCode = "<h1>Hello</h1>"; final htmlCode = "<h1>Hello</h1>";

View File

@ -10,8 +10,8 @@ void onConsoleMessage() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onConsoleMessage', (WidgetTester tester) async { skippableTestWidgets('onConsoleMessage', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<ConsoleMessage> onConsoleMessageCompleter = final Completer<ConsoleMessage> onConsoleMessageCompleter =
Completer<ConsoleMessage>(); Completer<ConsoleMessage>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -10,8 +10,8 @@ void onDownloadStartRequest() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onDownloadStartRequest', (WidgetTester tester) async { skippableTestWidgets('onDownloadStartRequest', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> onDownloadStartCompleter = Completer<String>(); final Completer<String> onDownloadStartCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(

View File

@ -9,8 +9,8 @@ void onJsBeforeUnload() {
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
skippableTestWidgets('onJsBeforeUnload', (WidgetTester tester) async { skippableTestWidgets('onJsBeforeUnload', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> onJsBeforeUnloadCompleter = Completer<String>(); final Completer<String> onJsBeforeUnloadCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -11,8 +11,8 @@ void onLoadResourceWithCustomScheme() {
skippableTestWidgets('onLoadResourceWithCustomScheme', skippableTestWidgets('onLoadResourceWithCustomScheme',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> imageLoaded = Completer<void>(); final Completer<void> imageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -10,8 +10,8 @@ void onNavigationResponse() {
skippableGroup('onNavigationResponse', () { skippableGroup('onNavigationResponse', () {
skippableTestWidgets('allow navigation', (WidgetTester tester) async { skippableTestWidgets('allow navigation', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<String> onNavigationResponseCompleter = final Completer<String> onNavigationResponseCompleter =
Completer<String>(); Completer<String>();
@ -43,8 +43,8 @@ void onNavigationResponse() {
}); });
skippableTestWidgets('cancel navigation', (WidgetTester tester) async { skippableTestWidgets('cancel navigation', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<String> onNavigationResponseCompleter = final Completer<String> onNavigationResponseCompleter =
Completer<String>(); Completer<String>();

View File

@ -10,8 +10,8 @@ void onPageCommitVisible() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onPageCommitVisible', (WidgetTester tester) async { skippableTestWidgets('onPageCommitVisible', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> onPageCommitVisibleCompleter = Completer<String>(); final Completer<String> onPageCommitVisibleCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -12,8 +12,8 @@ void onPermissionRequest() {
final expectedValue = [PermissionResourceType.CAMERA]; final expectedValue = [PermissionResourceType.CAMERA];
skippableTestWidgets('onPermissionRequest', (WidgetTester tester) async { skippableTestWidgets('onPermissionRequest', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<List<PermissionResourceType>> onPermissionRequestCompleter = final Completer<List<PermissionResourceType>> onPermissionRequestCompleter =
Completer<List<PermissionResourceType>>(); Completer<List<PermissionResourceType>>();
@ -40,7 +40,7 @@ void onPermissionRequest() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: "document.querySelector('#camera').click();"); source: "document.querySelector('#camera').click();");
@ -61,8 +61,8 @@ void onPermissionRequest() {
skippableTestWidgets('onPermissionRequestCanceled', skippableTestWidgets('onPermissionRequestCanceled',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<List<PermissionResourceType>> onPermissionRequestCompleter = final Completer<List<PermissionResourceType>> onPermissionRequestCompleter =
Completer<List<PermissionResourceType>>(); Completer<List<PermissionResourceType>>();
@ -99,7 +99,7 @@ void onPermissionRequest() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: "document.querySelector('#camera').click();"); source: "document.querySelector('#camera').click();");

View File

@ -8,8 +8,8 @@ void onReceivedIcon() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onReceivedIcon', (WidgetTester tester) async { skippableTestWidgets('onReceivedIcon', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<Uint8List> onReceivedIconCompleter = Completer<Uint8List>(); final Completer<Uint8List> onReceivedIconCompleter = Completer<Uint8List>();

View File

@ -8,8 +8,8 @@ void onReceivedTouchIconUrl() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onReceivedTouchIconUrl', (WidgetTester tester) async { skippableTestWidgets('onReceivedTouchIconUrl', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> onReceivedTouchIconUrlCompleter = final Completer<String> onReceivedTouchIconUrlCompleter =
Completer<String>(); Completer<String>();

View File

@ -12,8 +12,8 @@ void onScrollChanged() {
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('onScrollChanged', (WidgetTester tester) async { skippableTestWidgets('onScrollChanged', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> onScrollChangedCompleter = Completer<void>(); final Completer<void> onScrollChangedCompleter = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -37,7 +37,7 @@ void onScrollChanged() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();

View File

@ -12,8 +12,8 @@ void onTitleChanged() {
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('onTitleChanged', (WidgetTester tester) async { skippableTestWidgets('onTitleChanged', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> onTitleChangedCompleter = Completer<void>(); final Completer<void> onTitleChangedCompleter = Completer<void>();
@ -40,7 +40,7 @@ void onTitleChanged() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();
await controller.evaluateJavascript( await controller.evaluateJavascript(

View File

@ -12,8 +12,8 @@ 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;
skippableTestWidgets('onUpdateVisitedHistory', (WidgetTester tester) async { skippableTestWidgets('onUpdateVisitedHistory', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> firstPushCompleter = Completer<String>(); final Completer<String> firstPushCompleter = Completer<String>();
final Completer<String> secondPushCompleter = Completer<String>(); final Completer<String> secondPushCompleter = Completer<String>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
@ -42,7 +42,7 @@ void onUpdateVisitedHistory() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.evaluateJavascript(source: """ await controller.evaluateJavascript(source: """

View File

@ -8,8 +8,8 @@ void pageDownUp() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('pageDown/pageUp', (WidgetTester tester) async { skippableTestWidgets('pageDown/pageUp', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -28,7 +28,7 @@ void pageDownUp() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));

View File

@ -8,8 +8,8 @@ void pauseResume() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('pause/resume', (WidgetTester tester) async { skippableTestWidgets('pause/resume', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -28,7 +28,7 @@ void pauseResume() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.pause(), completes); await expectLater(controller.pause(), completes);
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));

View File

@ -10,8 +10,8 @@ void pauseResumeTimers() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('pause/resume timers', (WidgetTester tester) async { skippableTestWidgets('pause/resume timers', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void pauseResumeTimers() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.evaluateJavascript(source: """ await controller.evaluateJavascript(source: """

View File

@ -11,8 +11,8 @@ void postRequests() {
skippableGroup('POST requests', () { skippableGroup('POST requests', () {
skippableTestWidgets('initialUrlRequest', (WidgetTester tester) async { skippableTestWidgets('initialUrlRequest', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> postPageLoaded = Completer<void>(); final Completer<void> postPageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -36,7 +36,7 @@ void postRequests() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await postPageLoaded.future; await postPageLoaded.future;
@ -50,8 +50,8 @@ void postRequests() {
}); });
skippableTestWidgets('loadUrl', (WidgetTester tester) async { skippableTestWidgets('loadUrl', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> postPageLoaded = Completer<void>(); final Completer<void> postPageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -72,7 +72,7 @@ void postRequests() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
var postData = Uint8List.fromList(utf8.encode("name=FooBar")); var postData = Uint8List.fromList(utf8.encode("name=FooBar"));
@ -96,8 +96,8 @@ void postRequests() {
}); });
skippableTestWidgets('postUrl', (WidgetTester tester) async { skippableTestWidgets('postUrl', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> postPageLoaded = Completer<void>(); final Completer<void> postPageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -118,7 +118,7 @@ void postRequests() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
var postData = Uint8List.fromList(utf8.encode("name=FooBar")); var postData = Uint8List.fromList(utf8.encode("name=FooBar"));

View File

@ -12,8 +12,8 @@ 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;
skippableTestWidgets('printCurrentPage', (WidgetTester tester) async { skippableTestWidgets('printCurrentPage', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void printCurrentPage() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();
await expectLater(controller.printCurrentPage(), completes); await expectLater(controller.printCurrentPage(), completes);

View File

@ -49,8 +49,8 @@ void programmaticScroll() {
: TEST_WEB_PLATFORM_URL_1; : TEST_WEB_PLATFORM_URL_1;
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -67,7 +67,7 @@ void programmaticScroll() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -127,8 +127,8 @@ void programmaticScroll() {
base64Encode(const Utf8Encoder().convert(scrollTestPage)); base64Encode(const Utf8Encoder().convert(scrollTestPage));
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -148,7 +148,7 @@ void programmaticScroll() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.scrollTo(x: 0, y: 0); await controller.scrollTo(x: 0, y: 0);

View File

@ -17,8 +17,8 @@ void programmaticZoomScale() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('zoomIn/zoomOut', (WidgetTester tester) async { skippableTestWidgets('zoomIn/zoomOut', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -37,7 +37,7 @@ void programmaticZoomScale() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
expect(await controller.zoomIn(), true); expect(await controller.zoomIn(), true);
@ -46,8 +46,8 @@ void programmaticZoomScale() {
}, skip: shouldSkipTest1); }, skip: shouldSkipTest1);
skippableTestWidgets('onZoomScaleChanged', (WidgetTester tester) async { skippableTestWidgets('onZoomScaleChanged', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> onZoomScaleChangedCompleter = Completer<void>(); final Completer<void> onZoomScaleChangedCompleter = Completer<void>();
@ -76,7 +76,7 @@ void programmaticZoomScale() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
listenForScaleChange = true; listenForScaleChange = true;
@ -87,8 +87,8 @@ void programmaticZoomScale() {
}); });
skippableTestWidgets('zoomBy', (WidgetTester tester) async { skippableTestWidgets('zoomBy', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -107,7 +107,7 @@ void programmaticZoomScale() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -116,8 +116,8 @@ void programmaticZoomScale() {
}); });
skippableTestWidgets('getZoomScale', (WidgetTester tester) async { skippableTestWidgets('getZoomScale', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -136,7 +136,7 @@ void programmaticZoomScale() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -11,8 +11,8 @@ void pullToRefresh() {
skippableTestWidgets('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<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final pullToRefreshController = PullToRefreshController( final pullToRefreshController = PullToRefreshController(
settings: PullToRefreshSettings( settings: PullToRefreshSettings(
color: Colors.blue, color: Colors.blue,
@ -38,7 +38,7 @@ void pullToRefresh() {
), ),
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
final String? currentUrl = (await controller.getUrl())?.toString(); final String? currentUrl = (await controller.getUrl())?.toString();
expect(currentUrl, TEST_URL_1.toString()); expect(currentUrl, TEST_URL_1.toString());
}, skip: shouldSkip); }, skip: shouldSkip);

View File

@ -20,8 +20,8 @@ void reload() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('from origin', (WidgetTester tester) async { skippableTestWidgets('from origin', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -42,15 +42,15 @@ void reload() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.reloadFromOrigin(), completes); await expectLater(controller.reloadFromOrigin(), completes);
}, skip: shouldSkipTest1); }, skip: shouldSkipTest1);
skippableTestWidgets('basic', (WidgetTester tester) async { skippableTestWidgets('basic', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -69,7 +69,7 @@ void reload() {
), ),
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
String? reloadUrl = await pageLoads.stream.first; String? reloadUrl = await pageLoads.stream.first;
expect(reloadUrl, url.toString()); expect(reloadUrl, url.toString());

View File

@ -10,8 +10,8 @@ void requestFocusNodeHref() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('requestFocusNodeHref', (WidgetTester tester) async { skippableTestWidgets('requestFocusNodeHref', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void requestFocusNodeHref() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.requestFocusNodeHref(), completes); await expectLater(controller.requestFocusNodeHref(), completes);

View File

@ -10,8 +10,8 @@ void requestImageRef() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('requestImageRef', (WidgetTester tester) async { skippableTestWidgets('requestImageRef', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void requestImageRef() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.requestImageRef(), completes); await expectLater(controller.requestImageRef(), completes);

View File

@ -31,8 +31,8 @@ void resizeWebView() {
final Completer<void> resizeCompleter = Completer<void>(); final Completer<void> resizeCompleter = Completer<void>();
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<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final GlobalKey key = GlobalKey(); final GlobalKey key = GlobalKey();
final InAppWebView webView = InAppWebView( final InAppWebView webView = InAppWebView(

View File

@ -10,7 +10,7 @@ void setCustomUserAgent() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('set custom userAgent', (WidgetTester tester) async { skippableTestWidgets('set custom userAgent', (WidgetTester tester) async {
final Completer controllerCompleter1 = Completer<InAppWebViewController>(); final Completer controllerCompleter1 = Completer<PlatformInAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,

View File

@ -12,8 +12,8 @@ void setGetSettings() {
final url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1; final url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('set/get settings', (WidgetTester tester) async { skippableTestWidgets('set/get settings', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void setGetSettings() {
), ),
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
InAppWebViewSettings? settings = await controller.getSettings(); InAppWebViewSettings? settings = await controller.getSettings();

View File

@ -15,8 +15,8 @@ void shouldInterceptRequest() {
]; ];
List<String> resourceLoaded = []; List<String> resourceLoaded = [];
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> loadedResourceCompleter = Completer<void>(); final Completer<void> loadedResourceCompleter = Completer<void>();

View File

@ -16,8 +16,8 @@ void shouldOverrideUrlLoading() {
base64Encode(const Utf8Encoder().convert(page)); base64Encode(const Utf8Encoder().convert(page));
skippableTestWidgets('can allow requests', (WidgetTester tester) async { skippableTestWidgets('can allow requests', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -43,7 +43,7 @@ void shouldOverrideUrlLoading() {
); );
await pageLoads.stream.first; // Wait for initial page load. await pageLoads.stream.first; // Wait for initial page load.
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: 'location.href = "$TEST_URL_2"'); source: 'location.href = "$TEST_URL_2"');
@ -65,8 +65,8 @@ void shouldOverrideUrlLoading() {
testWidgets( testWidgets(
'allow requests on iOS only if navigationType == NavigationType.LINK_ACTIVATED', 'allow requests on iOS only if navigationType == NavigationType.LINK_ACTIVATED',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -94,7 +94,7 @@ void shouldOverrideUrlLoading() {
); );
await pageLoads.stream.first; // Wait for initial page load. await pageLoads.stream.first; // Wait for initial page load.
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: 'location.href = "$TEST_URL_2"'); source: 'location.href = "$TEST_URL_2"');
@ -120,8 +120,8 @@ void shouldOverrideUrlLoading() {
}, skip: shouldSkipTest2); }, skip: shouldSkipTest2);
skippableTestWidgets('can block requests', (WidgetTester tester) async { skippableTestWidgets('can block requests', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -147,7 +147,7 @@ void shouldOverrideUrlLoading() {
); );
await pageLoads.stream.first; // Wait for initial page load. await pageLoads.stream.first; // Wait for initial page load.
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: 'location.href = "$TEST_URL_4"'); source: 'location.href = "$TEST_URL_4"');
@ -169,8 +169,8 @@ void shouldOverrideUrlLoading() {
skippableTestWidgets('supports asynchronous decisions', skippableTestWidgets('supports asynchronous decisions',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -197,7 +197,7 @@ void shouldOverrideUrlLoading() {
); );
await pageLoads.stream.first; // Wait for initial page load. await pageLoads.stream.first; // Wait for initial page load.
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: 'location.href = "$TEST_URL_2"'); source: 'location.href = "$TEST_URL_2"');

View File

@ -10,8 +10,8 @@ void sslRequest() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('SSL request', (WidgetTester tester) async { skippableTestWidgets('SSL request', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -40,7 +40,7 @@ void sslRequest() {
), ),
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String h1Content = await controller.evaluateJavascript( final String h1Content = await controller.evaluateJavascript(

View File

@ -10,8 +10,8 @@ void stopLoading() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('stopLoading', (WidgetTester tester) async { skippableTestWidgets('stopLoading', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -34,7 +34,7 @@ void stopLoading() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
if (defaultTargetPlatform == TargetPlatform.android) { if (defaultTargetPlatform == TargetPlatform.android) {
await pageLoaded.future; await pageLoaded.future;

View File

@ -10,8 +10,8 @@ void tRexRunnerGame() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('T-Rex Runner game', (WidgetTester tester) async { skippableTestWidgets('T-Rex Runner game', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -10,8 +10,8 @@ void takeScreenshot() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('takeScreenshot', (WidgetTester tester) async { skippableTestWidgets('takeScreenshot', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void takeScreenshot() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));

View File

@ -11,8 +11,8 @@ void userScripts() {
skippableGroup('user scripts', () { skippableGroup('user scripts', () {
skippableTestWidgets('initialUserScripts', (WidgetTester tester) async { skippableTestWidgets('initialUserScripts', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -47,7 +47,7 @@ void userScripts() {
), ),
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -71,8 +71,8 @@ void userScripts() {
skippableTestWidgets('add/remove user scripts', skippableTestWidgets('add/remove user scripts',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -92,7 +92,7 @@ void userScripts() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;

View File

@ -50,8 +50,8 @@ void videoPlaybackPolicy() {
}); });
skippableTestWidgets('Auto media playback', (WidgetTester tester) async { skippableTestWidgets('Auto media playback', (WidgetTester tester) async {
Completer<InAppWebViewController> controllerCompleter = Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -74,14 +74,14 @@ void videoPlaybackPolicy() {
), ),
), ),
); );
InAppWebViewController controller = await controllerCompleter.future; PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
bool isPaused = bool isPaused =
await controller.evaluateJavascript(source: 'isPaused();'); await controller.evaluateJavascript(source: 'isPaused();');
expect(isPaused, false); expect(isPaused, false);
controllerCompleter = Completer<InAppWebViewController>(); controllerCompleter = Completer<PlatformInAppWebViewController>();
pageLoaded = Completer<void>(); pageLoaded = Completer<void>();
// We change the key to re-create a new webview as we change the mediaPlaybackRequiresUserGesture // We change the key to re-create a new webview as we change the mediaPlaybackRequiresUserGesture
@ -123,8 +123,8 @@ void videoPlaybackPolicy() {
skippableTestWidgets( skippableTestWidgets(
'Video plays inline when allowsInlineMediaPlayback is true', 'Video plays inline when allowsInlineMediaPlayback is true',
(WidgetTester tester) async { (WidgetTester tester) async {
Completer<InAppWebViewController> controllerCompleter = Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
Completer<void> onEnterFullscreenCompleter = Completer<void>(); Completer<void> onEnterFullscreenCompleter = Completer<void>();
@ -167,8 +167,8 @@ void videoPlaybackPolicy() {
testWidgets( testWidgets(
'Video plays fullscreen when allowsInlineMediaPlayback is false', 'Video plays fullscreen when allowsInlineMediaPlayback is false',
(WidgetTester tester) async { (WidgetTester tester) async {
Completer<InAppWebViewController> controllerCompleter = Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
Completer<void> onEnterFullscreenCompleter = Completer<void>(); Completer<void> onEnterFullscreenCompleter = Completer<void>();
@ -212,8 +212,8 @@ void videoPlaybackPolicy() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
// on Android, entering fullscreen requires user interaction // on Android, entering fullscreen requires user interaction
skippableTestWidgets('exit fullscreen event', (WidgetTester tester) async { skippableTestWidgets('exit fullscreen event', (WidgetTester tester) async {
Completer<InAppWebViewController> controllerCompleter = Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
Completer<void> onExitFullscreenCompleter = Completer<void>(); Completer<void> onExitFullscreenCompleter = Completer<void>();
@ -242,7 +242,7 @@ void videoPlaybackPolicy() {
), ),
); );
InAppWebViewController controller = await controllerCompleter.future; PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await Future.delayed(Duration(seconds: 2)); await Future.delayed(Duration(seconds: 2));

View File

@ -18,8 +18,8 @@ void webArchive() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('create data', (WidgetTester tester) async { skippableTestWidgets('create data', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -38,7 +38,7 @@ void webArchive() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -46,8 +46,8 @@ void webArchive() {
}, skip: shouldSkipTest1); }, skip: shouldSkipTest1);
skippableTestWidgets('save', (WidgetTester tester) async { skippableTestWidgets('save', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -66,7 +66,7 @@ void webArchive() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -20,8 +20,8 @@ void webHistory() {
skippableTestWidgets('get history list and go back/forward', skippableTestWidgets('get history list and go back/forward',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -39,7 +39,7 @@ void webHistory() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));
@ -119,8 +119,8 @@ void webHistory() {
skippableTestWidgets('go back/forward on web platform', skippableTestWidgets('go back/forward on web platform',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -140,7 +140,7 @@ void webHistory() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await tester.pump(); await tester.pump();
@ -178,8 +178,8 @@ void webHistory() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('clearHistory', (WidgetTester tester) async { skippableTestWidgets('clearHistory', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -199,7 +199,7 @@ void webHistory() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;
await controller.loadUrl(urlRequest: URLRequest(url: TEST_URL_1)); await controller.loadUrl(urlRequest: URLRequest(url: TEST_URL_1));

View File

@ -12,8 +12,8 @@ void webMessage() {
skippableGroup('WebMessage', () { skippableGroup('WebMessage', () {
skippableTestWidgets('WebMessageChannel post String', skippableTestWidgets('WebMessageChannel post String',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer webMessageCompleter = Completer<String>(); final Completer webMessageCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -81,8 +81,8 @@ void webMessage() {
skippableTestWidgets('WebMessageChannel post ArrayBuffer', skippableTestWidgets('WebMessageChannel post ArrayBuffer',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer webMessageCompleter = Completer<String>(); final Completer webMessageCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -167,8 +167,8 @@ void webMessage() {
skippableTestWidgets('WebMessageListener post String', skippableTestWidgets('WebMessageListener post String',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer webMessageCompleter = Completer<String>(); final Completer webMessageCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
@ -177,7 +177,7 @@ void webMessage() {
child: InAppWebView( child: InAppWebView(
key: GlobalKey(), key: GlobalKey(),
onWebViewCreated: (controller) async { onWebViewCreated: (controller) async {
await controller.addWebMessageListener(WebMessageListener( await InAppWebViewController.fromPlatform(platform: controller).addWebMessageListener(WebMessageListener(
jsObjectName: "myTestObj", jsObjectName: "myTestObj",
allowedOriginRules: Set.from(["https://*.example.com"]), allowedOriginRules: Set.from(["https://*.example.com"]),
onPostMessage: onPostMessage:
@ -222,8 +222,8 @@ void webMessage() {
skippableTestWidgets('WebMessageListener post ArrayBuffer', skippableTestWidgets('WebMessageListener post ArrayBuffer',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer webMessageCompleter = Completer<String>(); final Completer webMessageCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
@ -232,7 +232,7 @@ void webMessage() {
child: InAppWebView( child: InAppWebView(
key: GlobalKey(), key: GlobalKey(),
onWebViewCreated: (controller) async { onWebViewCreated: (controller) async {
await controller.addWebMessageListener(WebMessageListener( await InAppWebViewController.fromPlatform(platform: controller).addWebMessageListener(WebMessageListener(
jsObjectName: "myTestObj", jsObjectName: "myTestObj",
allowedOriginRules: Set.from(["https://*.example.com"]), allowedOriginRules: Set.from(["https://*.example.com"]),
onPostMessage: onPostMessage:

View File

@ -8,8 +8,8 @@ void webViewAssetLoader() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('WebViewAssetLoader', (WidgetTester tester) async { skippableTestWidgets('WebViewAssetLoader', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> pageLoaded = Completer<String>(); final Completer<String> pageLoaded = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
@ -25,7 +25,7 @@ void webViewAssetLoader() {
allowContentAccess: false, allowContentAccess: false,
webViewAssetLoader: WebViewAssetLoader( webViewAssetLoader: WebViewAssetLoader(
domain: TEST_WEBVIEW_ASSET_LOADER_DOMAIN, domain: TEST_WEBVIEW_ASSET_LOADER_DOMAIN,
pathHandlers: [AssetsPathHandler(path: '/assets/')])), pathHandlers: [AssetsPathHandler(path: '/assets/')]).platform),
onWebViewCreated: (controller) { onWebViewCreated: (controller) {
controllerCompleter.complete(controller); controllerCompleter.complete(controller);
}, },
@ -36,7 +36,7 @@ void webViewAssetLoader() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
final url = await pageLoaded.future; final url = await pageLoaded.future;
expect(url, TEST_WEBVIEW_ASSET_LOADER_URL.toString()); expect(url, TEST_WEBVIEW_ASSET_LOADER_URL.toString());

View File

@ -20,8 +20,8 @@ void webViewWindows() {
skippableTestWidgets('onCreateWindow return false', skippableTestWidgets('onCreateWindow return false',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -63,8 +63,8 @@ void webViewWindows() {
skippableTestWidgets('onCreateWindow return true', skippableTestWidgets('onCreateWindow return true',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<int> onCreateWindowCompleter = Completer<int>(); final Completer<int> onCreateWindowCompleter = Completer<int>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -91,7 +91,7 @@ void webViewWindows() {
var windowId = await onCreateWindowCompleter.future; var windowId = await onCreateWindowCompleter.future;
final Completer windowControllerCompleter = final Completer windowControllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> windowPageLoaded = Completer<String>(); final Completer<String> windowPageLoaded = Completer<String>();
final Completer<void> onCloseWindowCompleter = Completer<void>(); final Completer<void> onCloseWindowCompleter = Completer<void>();
@ -137,8 +137,8 @@ void webViewWindows() {
skippableTestWidgets( skippableTestWidgets(
'window.open() with target _blank opens in same window', 'window.open() with target _blank opens in same window',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -160,7 +160,7 @@ void webViewWindows() {
), ),
); );
await pageLoads.stream.first; await pageLoads.stream.first;
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
@ -181,8 +181,8 @@ void webViewWindows() {
// 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
skippableTestWidgets('can open new window and go back', skippableTestWidgets('can open new window and go back',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -205,7 +205,7 @@ void webViewWindows() {
), ),
); );
await pageLoads.stream.first; await pageLoads.stream.first;
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await tester.pump(); await tester.pump();
@ -264,8 +264,8 @@ void webViewWindows() {
'''; ''';
final String openWindowTestBase64 = final String openWindowTestBase64 =
base64Encode(const Utf8Encoder().convert(openWindowTest)); base64Encode(const Utf8Encoder().convert(openWindowTest));
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<void> pageLoadCompleter = Completer<void>(); final Completer<void> pageLoadCompleter = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -290,7 +290,7 @@ void webViewWindows() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoadCompleter.future; await pageLoadCompleter.future;
@ -309,8 +309,8 @@ void webViewWindows() {
// on Web, opening a new window during tests makes crash // on Web, opening a new window during tests makes crash
skippableTestWidgets('onCreateWindow called on Web', skippableTestWidgets('onCreateWindow called on Web',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> onCreateWindowCalled = Completer<String>(); final Completer<String> onCreateWindowCalled = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -334,7 +334,7 @@ void webViewWindows() {
), ),
); );
final InAppWebViewController controller = final PlatformInAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: "window.open('$TEST_CROSS_PLATFORM_URL_1');"); source: "window.open('$TEST_CROSS_PLATFORM_URL_1');");

View File

@ -9,7 +9,7 @@ void apply() {
skippableTestWidgets('apply', (WidgetTester tester) async { skippableTestWidgets('apply', (WidgetTester tester) async {
await expectLater( await expectLater(
PlatformProcessGlobalConfig.instance().apply( ProcessGlobalConfig.instance().apply(
settings: ProcessGlobalConfigSettings( settings: ProcessGlobalConfigSettings(
dataDirectorySuffix: dataDirectorySuffix:
(await WebViewFeature.isStartupFeatureSupported( (await WebViewFeature.isStartupFeatureSupported(

View File

@ -9,15 +9,15 @@ void clearAndSetProxyOverride() {
skippableTestWidgets('clear and set proxy override', skippableTestWidgets('clear and set proxy override',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter = final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>(); Completer<PlatformInAppWebViewController>();
final Completer<String> pageLoaded = Completer<String>(); final Completer<String> pageLoaded = Completer<String>();
var proxyAvailable = var proxyAvailable =
await WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE); await WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE);
if (proxyAvailable) { if (proxyAvailable) {
PlatformProxyController proxyController = PlatformProxyController.instance(); ProxyController proxyController = ProxyController.instance();
await proxyController.clearProxyOverride(); await proxyController.clearProxyOverride();
await proxyController.setProxyOverride( await proxyController.setProxyOverride(
@ -42,7 +42,7 @@ void clearAndSetProxyOverride() {
), ),
); );
final InAppWebViewController controller = await controllerCompleter.future; final PlatformInAppWebViewController controller = await controllerCompleter.future;
final String url = await pageLoaded.future; final String url = await pageLoaded.future;
expect(url, TEST_URL_HTTP_EXAMPLE.toString()); expect(url, TEST_URL_HTTP_EXAMPLE.toString());

View File

@ -17,8 +17,8 @@ void setServiceWorkerClient() {
WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST); WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
if (swAvailable && swInterceptAvailable) { if (swAvailable && swInterceptAvailable) {
PlatformServiceWorkerController serviceWorkerController = ServiceWorkerController serviceWorkerController =
PlatformServiceWorkerController.instance(); ServiceWorkerController.instance();
await serviceWorkerController.setServiceWorkerClient(null); await serviceWorkerController.setServiceWorkerClient(null);
} }

View File

@ -16,8 +16,8 @@ void shouldInterceptRequest() {
WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST); WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
if (swAvailable && swInterceptAvailable) { if (swAvailable && swInterceptAvailable) {
PlatformServiceWorkerController serviceWorkerController = ServiceWorkerController serviceWorkerController =
PlatformServiceWorkerController.instance(); ServiceWorkerController.instance();
await serviceWorkerController.setServiceWorkerClient(ServiceWorkerClient( await serviceWorkerController.setServiceWorkerClient(ServiceWorkerClient(
shouldInterceptRequest: (request) async { shouldInterceptRequest: (request) async {

View File

@ -18,8 +18,8 @@ import 'tracing_controller/main.dart' as tracing_controller_tests;
void main() { void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); IntegrationTestWidgetsFlutterBinding.ensureInitialized();
WebView.debugLoggingSettings.usePrint = true; PlatformInAppWebViewController.debugLoggingSettings.usePrint = true;
WebView.debugLoggingSettings.maxLogMessageLength = 7000; PlatformInAppWebViewController.debugLoggingSettings.maxLogMessageLength = 7000;
InAppBrowser.debugLoggingSettings.usePrint = true; InAppBrowser.debugLoggingSettings.usePrint = true;
InAppBrowser.debugLoggingSettings.maxLogMessageLength = 7000; InAppBrowser.debugLoggingSettings.maxLogMessageLength = 7000;
PlatformChromeSafariBrowser.debugLoggingSettings.usePrint = true; PlatformChromeSafariBrowser.debugLoggingSettings.usePrint = true;

View File

@ -7,7 +7,7 @@ import 'main.dart';
class HeadlessInAppWebViewExampleScreen extends StatefulWidget { class HeadlessInAppWebViewExampleScreen extends StatefulWidget {
@override @override
_HeadlessInAppWebViewExampleScreenState createState() => _HeadlessInAppWebViewExampleScreenState createState() =>
new _HeadlessInAppWebViewExampleScreenState(); _HeadlessInAppWebViewExampleScreenState();
} }
class _HeadlessInAppWebViewExampleScreenState class _HeadlessInAppWebViewExampleScreenState
@ -23,7 +23,7 @@ class _HeadlessInAppWebViewExampleScreenState
? WebUri("https://flutter.dev") ? WebUri("https://flutter.dev")
: WebUri("http://localhost:${Uri.base.port}/page.html"); : WebUri("http://localhost:${Uri.base.port}/page.html");
headlessWebView = new HeadlessInAppWebView( headlessWebView = HeadlessInAppWebView(
initialUrlRequest: URLRequest(url: url), initialUrlRequest: URLRequest(url: url),
initialSettings: InAppWebViewSettings( initialSettings: InAppWebViewSettings(
isInspectable: kDebugMode, isInspectable: kDebugMode,
@ -88,7 +88,8 @@ class _HeadlessInAppWebViewExampleScreenState
child: ElevatedButton( child: ElevatedButton(
onPressed: () async { onPressed: () async {
if (headlessWebView?.isRunning() ?? false) { if (headlessWebView?.isRunning() ?? false) {
await headlessWebView?.webViewController?.evaluateJavascript( await headlessWebView?.webViewController
?.evaluateJavascript(
source: """console.log('Here is the message!');"""); source: """console.log('Here is the message!');""");
} else { } else {
ScaffoldMessenger.of(context).showSnackBar(SnackBar( ScaffoldMessenger.of(context).showSnackBar(SnackBar(

View File

@ -66,7 +66,7 @@ class MyInAppBrowser extends InAppBrowser {
class InAppBrowserExampleScreen extends StatefulWidget { class InAppBrowserExampleScreen extends StatefulWidget {
@override @override
_InAppBrowserExampleScreenState createState() => _InAppBrowserExampleScreenState createState() =>
new _InAppBrowserExampleScreenState(); _InAppBrowserExampleScreenState();
} }
class _InAppBrowserExampleScreenState extends State<InAppBrowserExampleScreen> { class _InAppBrowserExampleScreenState extends State<InAppBrowserExampleScreen> {

View File

@ -9,7 +9,7 @@ import 'main.dart';
class InAppWebViewExampleScreen extends StatefulWidget { class InAppWebViewExampleScreen extends StatefulWidget {
@override @override
_InAppWebViewExampleScreenState createState() => _InAppWebViewExampleScreenState createState() =>
new _InAppWebViewExampleScreenState(); _InAppWebViewExampleScreenState();
} }
class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> { class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {

View File

@ -15,7 +15,7 @@ import 'package:pointer_interceptor/pointer_interceptor.dart';
// import 'package:permission_handler/permission_handler.dart'; // import 'package:permission_handler/permission_handler.dart';
InAppLocalhostServer localhostServer = InAppLocalhostServer localhostServer =
new InAppLocalhostServer(documentRoot: 'assets'); InAppLocalhostServer(documentRoot: 'assets');
Future main() async { Future main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -130,7 +130,7 @@ PointerInterceptor myDrawer({required BuildContext context}) {
class MyApp extends StatefulWidget { class MyApp extends StatefulWidget {
@override @override
_MyAppState createState() => new _MyAppState(); _MyAppState createState() => _MyAppState();
} }
class _MyAppState extends State<MyApp> { class _MyAppState extends State<MyApp> {

View File

@ -12,7 +12,7 @@ class WebAuthenticationSessionExampleScreen extends StatefulWidget {
class _WebAuthenticationSessionExampleScreenState class _WebAuthenticationSessionExampleScreenState
extends State<WebAuthenticationSessionExampleScreen> { extends State<WebAuthenticationSessionExampleScreen> {
PlatformWebAuthenticationSession? session; WebAuthenticationSession? session;
String? token; String? token;
@override @override

View File

@ -1,25 +0,0 @@
// This is a basic Flutter integration test.
//
// Since integration tests run in a full Flutter application, they can interact
// with the host side of a plugin implementation, unlike Dart unit tests.
//
// For more information about Flutter integration tests, please see
// https://docs.flutter.dev/cookbook/testing/integration/introduction
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('getPlatformVersion test', (WidgetTester tester) async {
final FlutterInappwebviewAndroid plugin = FlutterInappwebviewAndroid();
final String? version = await plugin.getPlatformVersion();
// The version string depends on the host platform running the test, so
// just assert that some non-empty string is returned.
expect(version?.isNotEmpty, true);
});
}

View File

@ -1,63 +0,0 @@
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
final _flutterInappwebviewAndroidPlugin = FlutterInappwebviewAndroid();
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
platformVersion =
await _flutterInappwebviewAndroidPlugin.getPlatformVersion() ?? 'Unknown platform version';
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
),
);
}
}

View File

@ -1,27 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_inappwebview_android_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
});
}

View File

@ -322,9 +322,7 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
return PlatformViewLink( return PlatformViewLink(
// Setting a default key using `params` ensures the `PlatformViewLink` // Setting a default key using `params` ensures the `PlatformViewLink`
// recreates the PlatformView when changes are made. // recreates the PlatformView when changes are made.
key: _androidParams.key ?? key: _androidParams.key,
ValueKey<AndroidInAppWebViewWidgetCreationParams>(
params as AndroidInAppWebViewWidgetCreationParams),
viewType: 'com.pichillilorenzo/flutter_inappwebview', viewType: 'com.pichillilorenzo/flutter_inappwebview',
surfaceFactory: ( surfaceFactory: (
BuildContext context, BuildContext context,

View File

@ -1,27 +0,0 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android_method_channel.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
MethodChannelInAppWebViewFlutterAndroid platform = MethodChannelInAppWebViewFlutterAndroid();
const MethodChannel channel = MethodChannel('flutter_inappwebview_android');
setUp(() {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(
channel,
(MethodCall methodCall) async {
return '42';
},
);
});
tearDown(() {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(channel, null);
});
test('getPlatformVersion', () async {
expect(await platform.getPlatformVersion(), '42');
});
}

View File

@ -1,29 +0,0 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android_platform_interface.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class MockFlutterInappwebviewAndroidPlatform
with MockPlatformInterfaceMixin
implements InAppWebViewFlutterAndroid {
@override
Future<String?> getPlatformVersion() => Future.value('42');
}
void main() {
final InAppWebViewFlutterAndroid initialPlatform = InAppWebViewFlutterAndroid.instance;
test('$MethodChannelInAppWebViewFlutterAndroid is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelInAppWebViewFlutterAndroid>());
});
test('getPlatformVersion', () async {
FlutterInappwebviewAndroid flutterInappwebviewAndroidPlugin = FlutterInappwebviewAndroid();
MockFlutterInappwebviewAndroidPlatform fakePlatform = MockFlutterInappwebviewAndroidPlatform();
InAppWebViewFlutterAndroid.instance = fakePlatform;
expect(await flutterInappwebviewAndroidPlugin.getPlatformVersion(), '42');
});
}

View File

@ -2,9 +2,33 @@ import 'dart:io';
import 'dart:async'; import 'dart:async';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart' show rootBundle; import 'package:flutter/services.dart' show rootBundle;
import 'mime_type_resolver.dart'; import 'mime_type_resolver.dart';
import 'platform_in_app_localhost_server.dart';
/// Object specifying creation parameters for creating a [DefaultInAppLocalhostServer].
///
/// When adding additional fields make sure they can be null or have a default
/// value to avoid breaking changes. See [PlatformInAppLocalhostServerCreationParams] for
/// more information.
@immutable
class DefaultInAppLocalhostServerCreationParams
extends PlatformInAppLocalhostServerCreationParams {
/// Creates a new [DefaultInAppLocalhostServerCreationParams] instance.
const DefaultInAppLocalhostServerCreationParams(
// This parameter prevents breaking changes later.
// ignore: avoid_unused_constructor_parameters
PlatformInAppLocalhostServerCreationParams params,
) : super();
/// Creates a [DefaultInAppLocalhostServerCreationParams] instance based on [PlatformInAppLocalhostServerCreationParams].
factory DefaultInAppLocalhostServerCreationParams.fromPlatformInAppLocalhostServerCreationParams(
PlatformInAppLocalhostServerCreationParams params) {
return DefaultInAppLocalhostServerCreationParams(params);
}
}
///This class allows you to create a simple server on `http://localhost:[port]/` ///This class allows you to create a simple server on `http://localhost:[port]/`
///in order to be able to load your assets file on a local server. ///in order to be able to load your assets file on a local server.
@ -14,7 +38,7 @@ import 'mime_type_resolver.dart';
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
///- MacOS ///- MacOS
class InAppLocalhostServer { class DefaultInAppLocalhostServer extends PlatformInAppLocalhostServer {
bool _started = false; bool _started = false;
HttpServer? _server; HttpServer? _server;
int _port = 8080; int _port = 8080;
@ -22,24 +46,14 @@ class InAppLocalhostServer {
String _directoryIndex = 'index.html'; String _directoryIndex = 'index.html';
String _documentRoot = './'; String _documentRoot = './';
///- [port] represents the port of the server. The default value is `8080`. /// Creates a new [DefaultInAppLocalhostServer].
/// DefaultInAppLocalhostServer(PlatformInAppLocalhostServerCreationParams params)
///- [directoryIndex] represents the index file to use. The default value is `index.html`. : super.implementation(
/// params is DefaultInAppLocalhostServerCreationParams
///- [documentRoot] represents the document root path to serve. The default value is `./`. ? params
/// : DefaultInAppLocalhostServerCreationParams
///- The optional argument [shared] specifies whether additional `HttpServer` .fromPlatformInAppLocalhostServerCreationParams(params),
/// objects can bind to the same combination of `address`, `port` and `v6Only`. ) {
/// If `shared` is `true` and more `HttpServer`s from this isolate or other
/// isolates are bound to the port, then the incoming connections will be
/// distributed among all the bound `HttpServer`s. Connections can be
/// distributed over multiple isolates this way.
InAppLocalhostServer({
int port = 8080,
String directoryIndex = 'index.html',
String documentRoot = './',
bool shared = false,
}) {
this._port = port; this._port = port;
this._directoryIndex = directoryIndex; this._directoryIndex = directoryIndex;
this._documentRoot = this._documentRoot =
@ -47,6 +61,18 @@ class InAppLocalhostServer {
this._shared = shared; this._shared = shared;
} }
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.port}
int get port => _port;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.directoryIndex}
String get directoryIndex => _directoryIndex;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.documentRoot}
String get documentRoot => _documentRoot;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.shared}
bool get shared => _shared;
///Starts the server on `http://localhost:[port]/`. ///Starts the server on `http://localhost:[port]/`.
/// ///
///**NOTE for iOS**: For the iOS Platform, you need to add the `NSAllowsLocalNetworking` key with `true` in the `Info.plist` file ///**NOTE for iOS**: For the iOS Platform, you need to add the `NSAllowsLocalNetworking` key with `true` in the `Info.plist` file

View File

@ -48,6 +48,16 @@ List<ContentBlocker> _deserializeContentBlockers(
return contentBlockers; return contentBlockers;
} }
Map<String, dynamic>? _serializeWebViewAssetLoader(
PlatformWebViewAssetLoader? webViewAssetLoader) {
return webViewAssetLoader?.toMap();
}
PlatformWebViewAssetLoader? _deserializeWebViewAssetLoader(
Map<String, dynamic>? map) {
return PlatformWebViewAssetLoader.static().fromMap(map);
}
///This class represents all the WebView settings available. ///This class represents all the WebView settings available.
@ExchangeableObject(copyMethod: true) @ExchangeableObject(copyMethod: true)
class InAppWebViewSettings_ { class InAppWebViewSettings_ {
@ -371,6 +381,9 @@ because there isn't any way to make the website data store non-persistent for th
///Use a [WebViewAssetLoader] instance to load local files including application's static assets and resources using http(s):// URLs. ///Use a [WebViewAssetLoader] instance to load local files including application's static assets and resources using http(s):// URLs.
///Loading local files using web-like URLs instead of `file://` is desirable as it is compatible with the Same-Origin policy. ///Loading local files using web-like URLs instead of `file://` is desirable as it is compatible with the Same-Origin policy.
@SupportedPlatforms(platforms: [AndroidPlatform()]) @SupportedPlatforms(platforms: [AndroidPlatform()])
@ExchangeableObjectProperty(
serializer: _serializeWebViewAssetLoader,
deserializer: _deserializeWebViewAssetLoader)
PlatformWebViewAssetLoader? webViewAssetLoader; PlatformWebViewAssetLoader? webViewAssetLoader;
///Sets the text zoom of the page in percent. The default value is `100`. ///Sets the text zoom of the page in percent. The default value is `100`.

View File

@ -1404,7 +1404,8 @@ class InAppWebViewSettings {
? UtilColor.fromStringRepresentation( ? UtilColor.fromStringRepresentation(
map['verticalScrollbarTrackColor']) map['verticalScrollbarTrackColor'])
: null, : null,
webViewAssetLoader: map['webViewAssetLoader'], webViewAssetLoader:
_deserializeWebViewAssetLoader(map['webViewAssetLoader']),
); );
instance.accessibilityIgnoresInvertColors = instance.accessibilityIgnoresInvertColors =
map['accessibilityIgnoresInvertColors']; map['accessibilityIgnoresInvertColors'];
@ -1686,7 +1687,7 @@ class InAppWebViewSettings {
"verticalScrollbarPosition": verticalScrollbarPosition?.toNativeValue(), "verticalScrollbarPosition": verticalScrollbarPosition?.toNativeValue(),
"verticalScrollbarThumbColor": verticalScrollbarThumbColor?.toHex(), "verticalScrollbarThumbColor": verticalScrollbarThumbColor?.toHex(),
"verticalScrollbarTrackColor": verticalScrollbarTrackColor?.toHex(), "verticalScrollbarTrackColor": verticalScrollbarTrackColor?.toHex(),
"webViewAssetLoader": webViewAssetLoader, "webViewAssetLoader": _serializeWebViewAssetLoader(webViewAssetLoader),
}; };
} }

View File

@ -7,6 +7,7 @@ import 'in_app_webview/platform_inappwebview_controller.dart';
import 'in_app_webview/platform_inappwebview_widget.dart'; import 'in_app_webview/platform_inappwebview_widget.dart';
import 'platform_cookie_manager.dart'; import 'platform_cookie_manager.dart';
import 'platform_http_auth_credentials_database.dart'; import 'platform_http_auth_credentials_database.dart';
import 'platform_in_app_localhost_server.dart';
import 'print_job/platform_print_job_controller.dart'; import 'print_job/platform_print_job_controller.dart';
import 'pull_to_refresh/platform_pull_to_refresh_controller.dart'; import 'pull_to_refresh/platform_pull_to_refresh_controller.dart';
import 'web_authentication_session/platform_web_authenticate_session.dart'; import 'web_authentication_session/platform_web_authenticate_session.dart';
@ -21,6 +22,7 @@ import 'platform_service_worker_controller.dart';
import 'platform_tracing_controller.dart'; import 'platform_tracing_controller.dart';
import 'platform_webview_asset_loader.dart'; import 'platform_webview_asset_loader.dart';
import 'platform_webview_feature.dart'; import 'platform_webview_feature.dart';
import 'in_app_localhost_server.dart';
/// Interface for a platform implementation of a WebView. /// Interface for a platform implementation of a WebView.
abstract class InAppWebViewPlatform extends PlatformInterface { abstract class InAppWebViewPlatform extends PlatformInterface {
@ -136,7 +138,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// ///
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [WebAuthenticationSession] in `flutter_inappwebview` instead. /// Look at using [WebAuthenticationSession] in `flutter_inappwebview` instead.
PlatformWebAuthenticationSession createPlatformWebAuthenticationSessionStatic() { PlatformWebAuthenticationSession
createPlatformWebAuthenticationSessionStatic() {
throw UnimplementedError( throw UnimplementedError(
'createPlatformWebAuthenticationSessionStatic is not implemented on the current platform.'); 'createPlatformWebAuthenticationSessionStatic is not implemented on the current platform.');
} }
@ -328,7 +331,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// ///
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [ServiceWorkerController] in `flutter_inappwebview` instead. /// Look at using [ServiceWorkerController] in `flutter_inappwebview` instead.
PlatformServiceWorkerController createPlatformServiceWorkerControllerStatic() { PlatformServiceWorkerController
createPlatformServiceWorkerControllerStatic() {
throw UnimplementedError( throw UnimplementedError(
'createPlatformServiceWorkerControllerStatic is not implemented on the current platform.'); 'createPlatformServiceWorkerControllerStatic is not implemented on the current platform.');
} }
@ -427,4 +431,13 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
throw UnimplementedError( throw UnimplementedError(
'createPlatformWebViewFeatureStatic is not implemented on the current platform.'); 'createPlatformWebViewFeatureStatic is not implemented on the current platform.');
} }
/// Creates a new empty [PlatformInAppLocalhostServer] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [DefaultInAppLocalhostServer] in `flutter_inappwebview` instead.
PlatformInAppLocalhostServer createPlatformInAppLocalhostServer(
PlatformInAppLocalhostServerCreationParams params) {
return DefaultInAppLocalhostServer(params);
}
} }

View File

@ -6,7 +6,6 @@ export 'chrome_safari_browser/main.dart';
export 'x509_certificate/main.dart'; export 'x509_certificate/main.dart';
export 'web_storage/main.dart'; export 'web_storage/main.dart';
export 'platform_cookie_manager.dart'; export 'platform_cookie_manager.dart';
export 'in_app_localhost_server.dart';
export 'content_blocker.dart'; export 'content_blocker.dart';
export 'platform_http_auth_credentials_database.dart'; export 'platform_http_auth_credentials_database.dart';
export 'context_menu/main.dart'; export 'context_menu/main.dart';
@ -22,13 +21,9 @@ export 'platform_service_worker_controller.dart';
export 'platform_webview_feature.dart' export 'platform_webview_feature.dart'
hide WebViewFeature_, AndroidWebViewFeature_; hide WebViewFeature_, AndroidWebViewFeature_;
export 'platform_proxy_controller.dart' hide ProxySettings_; export 'platform_proxy_controller.dart' hide ProxySettings_;
export 'platform_webview_asset_loader.dart' export 'platform_webview_asset_loader.dart';
hide
PlatformWebViewAssetLoader_,
PlatformPathHandler_,
PlatformAssetsPathHandler_,
PlatformResourcesPathHandler_,
PlatformInternalStoragePathHandler_;
export 'platform_tracing_controller.dart' hide TracingSettings_; export 'platform_tracing_controller.dart' hide TracingSettings_;
export 'platform_process_global_config.dart' export 'platform_process_global_config.dart'
hide ProcessGlobalConfigSettings_, ProcessGlobalConfigDirectoryBasePaths_; hide ProcessGlobalConfigSettings_, ProcessGlobalConfigDirectoryBasePaths_;
export 'platform_in_app_localhost_server.dart';
export 'in_app_localhost_server.dart';

View File

@ -0,0 +1,125 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
/// Object specifying creation parameters for creating a [PlatformInAppLocalhostServer].
///
/// Platform specific implementations can add additional fields by extending
/// this class.
@immutable
class PlatformInAppLocalhostServerCreationParams {
/// Used by the platform implementation to create a new [PlatformInAppLocalhostServer].
const PlatformInAppLocalhostServerCreationParams({
this.port = 8080,
this.directoryIndex = 'index.html',
this.documentRoot = './',
this.shared = false,
});
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.port}
final int port;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.directoryIndex}
final String directoryIndex;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.documentRoot}
final String documentRoot;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.shared}
final bool shared;
}
///This class allows you to create a simple server on `http://localhost:[port]/`
///in order to be able to load your assets file on a local server.
///The default `port` value is `8080`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
abstract class PlatformInAppLocalhostServer extends PlatformInterface {
/// Creates a new [PlatformInAppLocalhostServer]
factory PlatformInAppLocalhostServer(PlatformInAppLocalhostServerCreationParams params) {
assert(
InAppWebViewPlatform.instance != null,
'A platform implementation for `flutter_inappwebview` has not been set. Please '
'ensure that an implementation of `InAppWebViewPlatform` has been set to '
'`WebViewPlatform.instance` before use. For unit testing, '
'`WebViewPlatform.instance` can be set with your own test implementation.',
);
final PlatformInAppLocalhostServer inAppLocalhostServer =
InAppWebViewPlatform.instance!.createPlatformInAppLocalhostServer(params);
PlatformInterface.verify(inAppLocalhostServer, _token);
return inAppLocalhostServer;
}
/// Used by the platform implementation to create a new
/// [PlatformInAppLocalhostServer].
///
/// Should only be used by platform implementations because they can't extend
/// a class that only contains a factory constructor.
@protected
PlatformInAppLocalhostServer.implementation(this.params)
: super(token: _token);
static final Object _token = Object();
/// The parameters used to initialize the [PlatformInAppLocalhostServer].
final PlatformInAppLocalhostServerCreationParams params;
///{@template flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.port}
///Represents the port of the server. The default value is `8080`.
///{@endtemplate}
int get port => params.port;
///{@template flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.directoryIndex}
///represents the index file to use. The default value is `index.html`.
///{@endtemplate}
String get directoryIndex => params.directoryIndex;
///{@template flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.documentRoot}
///Represents the document root path to serve. The default value is `./`.
///{@endtemplate}
String get documentRoot => params.documentRoot;
///{@template flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.shared}
///Specifies whether additional `HttpServer`
/// objects can bind to the same combination of `address`, `port` and `v6Only`.
/// If `shared` is `true` and more `HttpServer`s from this isolate or other
/// isolates are bound to the port, then the incoming connections will be
/// distributed among all the bound `HttpServer`s. Connections can be
/// distributed over multiple isolates this way.
///{@endtemplate}
bool get shared => params.shared;
///Starts the server on `http://localhost:[port]/`.
///
///**NOTE for iOS**: For the iOS Platform, you need to add the `NSAllowsLocalNetworking` key with `true` in the `Info.plist` file
///(See [ATS Configuration Basics](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35)):
///```xml
///<key>NSAppTransportSecurity</key>
///<dict>
/// <key>NSAllowsLocalNetworking</key>
/// <true/>
///</dict>
///```
///The `NSAllowsLocalNetworking` key is available since **iOS 10**.
Future<void> start() {
throw UnimplementedError(
'start is not implemented on the current platform');
}
///Closes the server.
Future<void> close() {
throw UnimplementedError(
'close is not implemented on the current platform');
}
///Indicates if the server is running or not.
bool isRunning() {
throw UnimplementedError(
'isRunning is not implemented on the current platform');
}
}

View File

@ -104,7 +104,7 @@ abstract class PlatformWebViewAssetLoader extends PlatformInterface {
/// The parameters used to initialize the [PlatformWebViewAssetLoader]. /// The parameters used to initialize the [PlatformWebViewAssetLoader].
final PlatformWebViewAssetLoaderCreationParams params; final PlatformWebViewAssetLoaderCreationParams params;
PlatformWebViewAssetLoader? fromMap(Map<String, dynamic> map) { PlatformWebViewAssetLoader? fromMap(Map<String, dynamic>? map) {
throw UnimplementedError( throw UnimplementedError(
'fromMap is not implemented on the current platform'); 'fromMap is not implemented on the current platform');
} }

Some files were not shown because too many files have changed in this diff Show More