未验证 提交 21a484d9 编写于 作者: M Mouad Debbar 提交者: GitHub

[web] Add few awaits in history tests (#24934)

上级 850c7fe4
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:html' as html; import 'dart:html' as html;
import 'dart:typed_data';
import 'package:test/bootstrap/browser.dart'; import 'package:test/bootstrap/browser.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
...@@ -32,8 +31,6 @@ const Map<String, bool> flutterState = <String, bool>{'flutter': true}; ...@@ -32,8 +31,6 @@ const Map<String, bool> flutterState = <String, bool>{'flutter': true};
const MethodCodec codec = JSONMethodCodec(); const MethodCodec codec = JSONMethodCodec();
void emptyCallback(ByteData date) {}
void main() { void main() {
internalBootstrapBrowserTest(() => testMain); internalBootstrapBrowserTest(() => testMain);
} }
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:html' as html; import 'dart:html' as html;
import 'dart:js_util' as js_util; import 'dart:js_util' as js_util;
import 'dart:typed_data';
import 'package:test/bootstrap/browser.dart'; import 'package:test/bootstrap/browser.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
...@@ -18,8 +17,6 @@ import 'matchers.dart'; ...@@ -18,8 +17,6 @@ import 'matchers.dart';
const MethodCodec codec = JSONMethodCodec(); const MethodCodec codec = JSONMethodCodec();
void emptyCallback(ByteData data) {}
void main() { void main() {
internalBootstrapBrowserTest(() => testMain); internalBootstrapBrowserTest(() => testMain);
} }
...@@ -57,13 +54,15 @@ void testMain() { ...@@ -57,13 +54,15 @@ void testMain() {
// Reading it multiple times should return the same value. // Reading it multiple times should return the same value.
expect(window.defaultRouteName, '/initial'); expect(window.defaultRouteName, '/initial');
expect(window.defaultRouteName, '/initial'); expect(window.defaultRouteName, '/initial');
Completer<void> callback = Completer<void>();
window.sendPlatformMessage( window.sendPlatformMessage(
'flutter/navigation', 'flutter/navigation',
JSONMethodCodec().encodeMethodCall(MethodCall( JSONMethodCodec().encodeMethodCall(MethodCall(
'routeUpdated', 'routeUpdated',
<String, dynamic>{'routeName': '/bar'}, <String, dynamic>{'routeName': '/bar'},
)), )),
emptyCallback, (_) { callback.complete(); },
); );
// After a navigation platform message, [window.defaultRouteName] should // After a navigation platform message, [window.defaultRouteName] should
// reset to "/". // reset to "/".
...@@ -192,7 +191,7 @@ void testMain() { ...@@ -192,7 +191,7 @@ void testMain() {
expect(window.browserHistory.currentPath, '/'); expect(window.browserHistory.currentPath, '/');
// Perform some navigation operations. // Perform some navigation operations.
routeInformationUpdated('/foo/bar', null); await routeInformationUpdated('/foo/bar', null);
// Path should not be updated because URL strategy is disabled. // Path should not be updated because URL strategy is disabled.
expect(window.browserHistory.currentPath, '/'); expect(window.browserHistory.currentPath, '/');
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册