iosWebViewFix/example/integration_test/in_app_webview/on_progress_changed.dart

34 lines
1023 B
Dart
Raw Normal View History

part of 'main.dart';
2022-04-28 17:29:01 +00:00
void onProgressChanged() {
2022-04-29 11:39:28 +00:00
final shouldSkip = kIsWeb
? true
: ![
TargetPlatform.android,
TargetPlatform.iOS,
TargetPlatform.macOS,
].contains(defaultTargetPlatform);
2022-04-28 17:29:01 +00:00
skippableTestWidgets('onProgressChanged', (WidgetTester tester) async {
2022-04-28 17:29:01 +00:00
final Completer<void> onProgressChangedCompleter = Completer<void>();
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: InAppWebView(
key: GlobalKey(),
2022-04-29 11:39:28 +00:00
initialUrlRequest: URLRequest(url: TEST_URL_1),
2022-04-28 17:29:01 +00:00
initialSettings: InAppWebViewSettings(
clearCache: true,
),
onProgressChanged: (controller, progress) {
2022-10-06 13:13:31 +00:00
if (progress == 100 && !onProgressChangedCompleter.isCompleted) {
2022-04-28 17:29:01 +00:00
onProgressChangedCompleter.complete();
}
},
),
),
);
await expectLater(onProgressChangedCompleter.future, completes);
}, skip: shouldSkip);
}