66import 'dart:async' ;
77import 'dart:html' as html;
88import 'dart:js_util' as js_util;
9- import 'dart:typed_data' ;
109
1110import 'package:test/bootstrap/browser.dart' ;
1211import 'package:test/test.dart' ;
@@ -18,8 +17,6 @@ import 'matchers.dart';
1817
1918const MethodCodec codec = JSONMethodCodec ();
2019
21- void emptyCallback (ByteData data) {}
22-
2320void main () {
2421 internalBootstrapBrowserTest (() => testMain);
2522}
@@ -57,13 +54,15 @@ void testMain() {
5754 // Reading it multiple times should return the same value.
5855 expect (window.defaultRouteName, '/initial' );
5956 expect (window.defaultRouteName, '/initial' );
57+
58+ Completer <void > callback = Completer <void >();
6059 window.sendPlatformMessage (
6160 'flutter/navigation' ,
6261 JSONMethodCodec ().encodeMethodCall (MethodCall (
6362 'routeUpdated' ,
6463 < String , dynamic > {'routeName' : '/bar' },
6564 )),
66- emptyCallback ,
65+ (_) { callback. complete (); } ,
6766 );
6867 // After a navigation platform message, [window.defaultRouteName] should
6968 // reset to "/".
@@ -192,7 +191,7 @@ void testMain() {
192191 expect (window.browserHistory.currentPath, '/' );
193192
194193 // Perform some navigation operations.
195- routeInformationUpdated ('/foo/bar' , null );
194+ await routeInformationUpdated ('/foo/bar' , null );
196195 // Path should not be updated because URL strategy is disabled.
197196 expect (window.browserHistory.currentPath, '/' );
198197 });
0 commit comments