From 44d20e832be0da39431504b295b5ec49e2a1b75f Mon Sep 17 00:00:00 2001 From: Mouad Debbar Date: Wed, 10 Mar 2021 14:14:32 -0800 Subject: [PATCH 1/2] [web] Add few awaits in history tests --- lib/web_ui/test/engine/history_test.dart | 3 --- lib/web_ui/test/window_test.dart | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/web_ui/test/engine/history_test.dart b/lib/web_ui/test/engine/history_test.dart index 85dd035656821..e1a0140b6347a 100644 --- a/lib/web_ui/test/engine/history_test.dart +++ b/lib/web_ui/test/engine/history_test.dart @@ -8,7 +8,6 @@ import 'dart:async'; import 'dart:html' as html; -import 'dart:typed_data'; import 'package:test/bootstrap/browser.dart'; import 'package:test/test.dart'; @@ -32,8 +31,6 @@ const Map flutterState = {'flutter': true}; const MethodCodec codec = JSONMethodCodec(); -void emptyCallback(ByteData date) {} - void main() { internalBootstrapBrowserTest(() => testMain); } diff --git a/lib/web_ui/test/window_test.dart b/lib/web_ui/test/window_test.dart index a7c4f3c1e7868..12bce6580275b 100644 --- a/lib/web_ui/test/window_test.dart +++ b/lib/web_ui/test/window_test.dart @@ -18,8 +18,6 @@ import 'matchers.dart'; const MethodCodec codec = JSONMethodCodec(); -void emptyCallback(ByteData data) {} - void main() { internalBootstrapBrowserTest(() => testMain); } @@ -57,13 +55,15 @@ void testMain() { // Reading it multiple times should return the same value. expect(window.defaultRouteName, '/initial'); expect(window.defaultRouteName, '/initial'); + + Completer callback = Completer(); window.sendPlatformMessage( 'flutter/navigation', JSONMethodCodec().encodeMethodCall(MethodCall( 'routeUpdated', {'routeName': '/bar'}, )), - emptyCallback, + (_) { callback.complete(); }, ); // After a navigation platform message, [window.defaultRouteName] should // reset to "/". @@ -192,7 +192,7 @@ void testMain() { expect(window.browserHistory.currentPath, '/'); // Perform some navigation operations. - routeInformationUpdated('/foo/bar', null); + await routeInformationUpdated('/foo/bar', null); // Path should not be updated because URL strategy is disabled. expect(window.browserHistory.currentPath, '/'); }); From b0b686eec13deabb28d8e8d3dd4bef97bb77c305 Mon Sep 17 00:00:00 2001 From: Mouad Debbar Date: Wed, 10 Mar 2021 14:48:35 -0800 Subject: [PATCH 2/2] remove unused import --- lib/web_ui/test/window_test.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/web_ui/test/window_test.dart b/lib/web_ui/test/window_test.dart index 12bce6580275b..4cb6e96b8f24c 100644 --- a/lib/web_ui/test/window_test.dart +++ b/lib/web_ui/test/window_test.dart @@ -6,7 +6,6 @@ import 'dart:async'; import 'dart:html' as html; import 'dart:js_util' as js_util; -import 'dart:typed_data'; import 'package:test/bootstrap/browser.dart'; import 'package:test/test.dart';