@@ -78,7 +78,7 @@ void testMain() {
7878 myWindow.sendPlatformMessage (
7979 'flutter/navigation' ,
8080 const JSONMethodCodec ().encodeMethodCall (
81- const MethodCall ('routeUpdated ' , < String , dynamic > {'routeName ' : '/bar' }),
81+ const MethodCall ('routeInformationUpdated ' , < String , dynamic > {'location ' : '/bar' }),
8282 ),
8383 (_) {
8484 callback.complete ();
@@ -125,30 +125,21 @@ void testMain() {
125125 'selectMultiEntryHistory' ,
126126 < String , dynamic > {},
127127 ); // -> multi
128- await check <SingleEntryBrowserHistory >('routeUpdated' , < String , dynamic > {
129- 'routeName' : '/bar' ,
130- }); // -> single
131- await check <SingleEntryBrowserHistory >('routeInformationUpdated' , < String , dynamic > {
128+ await check <MultiEntriesBrowserHistory >('routeInformationUpdated' , < String , dynamic > {
132129 'location' : '/bar' ,
133130 }); // does not change mode
134- await check <MultiEntriesBrowserHistory >(
135- 'selectMultiEntryHistory ' ,
131+ await check <SingleEntryBrowserHistory >(
132+ 'selectSingleEntryHistory ' ,
136133 < String , dynamic > {},
137- ); // -> multi
138- await check <MultiEntriesBrowserHistory >('routeInformationUpdated' , < String , dynamic > {
134+ ); // -> single
135+ await check <SingleEntryBrowserHistory >('routeInformationUpdated' , < String , dynamic > {
139136 'location' : '/bar' ,
140137 }); // does not change mode
141138 });
142139
143140 test (
144141 'handleNavigationMessage throws for route update methods called with null arguments' ,
145142 () async {
146- expect (() async {
147- await myWindow.handleNavigationMessage (
148- const JSONMethodCodec ().encodeMethodCall (const MethodCall ('routeUpdated' )),
149- );
150- }, throwsAssertionError);
151-
152143 expect (() async {
153144 await myWindow.handleNavigationMessage (
154145 const JSONMethodCodec ().encodeMethodCall (const MethodCall ('routeInformationUpdated' )),
@@ -214,12 +205,21 @@ void testMain() {
214205 );
215206 expect (myWindow.browserHistory, isA <MultiEntriesBrowserHistory >());
216207
217- // routeUpdated resets the history type
208+ // change the history type
218209 Completer <void > callback = Completer <void >();
210+ myWindow.sendPlatformMessage (
211+ 'flutter/navigation' ,
212+ const JSONMethodCodec ().encodeMethodCall (const MethodCall ('selectSingleEntryHistory' )),
213+ (_) {
214+ callback.complete ();
215+ },
216+ );
217+ await callback.future;
218+ callback = Completer <void >();
219219 myWindow.sendPlatformMessage (
220220 'flutter/navigation' ,
221221 const JSONMethodCodec ().encodeMethodCall (
222- const MethodCall ('routeUpdated ' , < String , dynamic > {'routeName ' : '/bar' }),
222+ const MethodCall ('routeInformationUpdated ' , < String , dynamic > {'location ' : '/bar' }),
223223 ),
224224 (_) {
225225 callback.complete ();
@@ -250,7 +250,7 @@ void testMain() {
250250 // they can be interleaved safely
251251 await myWindow.handleNavigationMessage (
252252 const JSONMethodCodec ().encodeMethodCall (
253- const MethodCall ('routeUpdated ' , < String , dynamic > {'routeName ' : '/foo' }),
253+ const MethodCall ('routeInformationUpdated ' , < String , dynamic > {'location ' : '/foo' }),
254254 ),
255255 );
256256 expect (myWindow.browserHistory, isA <SingleEntryBrowserHistory >());
@@ -390,32 +390,6 @@ void testMain() {
390390 expect (myWindow.browserHistory.urlStrategy! .getState (), _tagStateWithSerialCount ('/state1' , 1 ));
391391 });
392392
393- test ('initialize browser history with default url strategy (single)' , () async {
394- // On purpose, we don't initialize history on the window. We want to let the
395- // window to self-initialize when it receives a navigation message.
396-
397- // Without initializing history, the default route name should be
398- // initialized to "/" in tests.
399- expect (myWindow.defaultRouteName, '/' );
400-
401- final Completer <void > callback = Completer <void >();
402- myWindow.sendPlatformMessage (
403- 'flutter/navigation' ,
404- const JSONMethodCodec ().encodeMethodCall (
405- const MethodCall ('routeUpdated' , < String , dynamic > {'routeName' : '/bar' }),
406- ),
407- (_) {
408- callback.complete ();
409- },
410- );
411- await callback.future;
412- expect (myWindow.browserHistory, isA <SingleEntryBrowserHistory >());
413- // The url strategy should've been set to the default, and the path
414- // should've been correctly set to "/bar".
415- expect (myWindow.browserHistory.urlStrategy, isNot (isNull));
416- expect (myWindow.browserHistory.urlStrategy! .getPath (), '/bar' );
417- }, skip: isSafari); // https://github.com/flutter/flutter/issues/50836
418-
419393 test ('initialize browser history with default url strategy (multiple)' , () async {
420394 // On purpose, we don't initialize history on the window. We want to let the
421395 // window to self-initialize when it receives a navigation message.
@@ -443,7 +417,7 @@ void testMain() {
443417 // should've been correctly set to "/baz".
444418 expect (myWindow.browserHistory.urlStrategy, isNot (isNull));
445419 expect (myWindow.browserHistory.urlStrategy! .getPath (), '/baz' );
446- }, skip : isSafari); // https://github.com/flutter/flutter/issues/50836
420+ });
447421
448422 test ('can disable location strategy' , () async {
449423 // Disable URL strategy.
0 commit comments