Adds new route annoucement method. (flutter/engine#16523)

This commit is contained in:
chunhtai
2020-02-10 13:59:02 -08:00
committed by GitHub
parent d66d21edab
commit 1582b28ad3
2 changed files with 11 additions and 0 deletions

View File

@@ -200,6 +200,7 @@ class EngineWindow extends ui.Window {
final MethodCall decoded = codec.decodeMethodCall(data);
final Map<String, dynamic> message = decoded.arguments;
switch (decoded.method) {
case 'routeUpdated':
case 'routePushed':
case 'routeReplaced':
_browserHistory.setRouteName(message['routeName']);

View File

@@ -75,5 +75,15 @@ void main() {
emptyCallback,
);
expect(_strategy.path, '/bar/baz2');
engine.window.sendPlatformMessage(
'flutter/navigation',
codec.encodeMethodCall(const engine.MethodCall(
'routeUpdated',
<String, dynamic>{'previousRouteName': '/bar/baz2', 'routeName': '/foo/foo/2'},
)),
emptyCallback,
);
expect(_strategy.path, '/foo/foo/2');
});
}