Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void main() {
ByteData message = const JSONMethodCodec().encodeMethodCall(
MethodCall('pushRouteInformation', testRouteInformation),
);
await ServicesBinding.instance.defaultBinaryMessenger
await tester.binding.defaultBinaryMessenger
.handlePlatformMessage('flutter/navigation', message, (_) {});

await tester.pumpAndSettle();
Expand All @@ -34,7 +34,7 @@ void main() {
message = const JSONMethodCodec().encodeMethodCall(
MethodCall('pushRouteInformation', testRouteInformation),
);
await ServicesBinding.instance.defaultBinaryMessenger
await tester.binding.defaultBinaryMessenger
.handlePlatformMessage('flutter/navigation', message, (_) {});

await tester.pumpAndSettle();
Expand Down
4 changes: 2 additions & 2 deletions packages/go_router/example/test/redirection_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void main() {
ByteData message = const JSONMethodCodec().encodeMethodCall(
MethodCall('pushRouteInformation', testRouteInformation),
);
await ServicesBinding.instance.defaultBinaryMessenger
await tester.binding.defaultBinaryMessenger
.handlePlatformMessage('flutter/navigation', message, (_) {});

await tester.pumpAndSettle();
Expand All @@ -36,7 +36,7 @@ void main() {
message = const JSONMethodCodec().encodeMethodCall(
MethodCall('pushRouteInformation', testRouteInformation),
);
await ServicesBinding.instance.defaultBinaryMessenger
await tester.binding.defaultBinaryMessenger
.handlePlatformMessage('flutter/navigation', message, (_) {});

await tester.pumpAndSettle();
Expand Down
12 changes: 6 additions & 6 deletions packages/go_router/test/go_router_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import 'test_helpers.dart';
const bool enableLogs = false;
final Logger log = Logger('GoRouter tests');

Future<void> sendPlatformUrl(String url) async {
Future<void> sendPlatformUrl(String url, WidgetTester tester) async {
final Map<String, dynamic> testRouteInformation = <String, dynamic>{
'location': url,
};
final ByteData message = const JSONMethodCodec().encodeMethodCall(
MethodCall('pushRouteInformation', testRouteInformation),
);
await ServicesBinding.instance.defaultBinaryMessenger
await tester.binding.defaultBinaryMessenger
.handlePlatformMessage('flutter/navigation', message, (_) {});
}

Expand Down Expand Up @@ -1495,7 +1495,7 @@ void main() {

redirected = false;
// Directly set the url through platform message.
await sendPlatformUrl('/dummy');
await sendPlatformUrl('/dummy', tester);

await tester.pumpAndSettle();
expect(router.location, '/login');
Expand Down Expand Up @@ -1528,7 +1528,7 @@ void main() {

expect(router.location, '/');
// Directly set the url through platform message.
await sendPlatformUrl('/dummy');
await sendPlatformUrl('/dummy', tester);
await tester.pumpAndSettle();
expect(router.location, '/dummy');
});
Expand Down Expand Up @@ -1631,7 +1631,7 @@ void main() {
});
redirected = false;
// Directly set the url through platform message.
await sendPlatformUrl('/dummy');
await sendPlatformUrl('/dummy', tester);

await tester.pumpAndSettle();
expect(router.location, '/login');
Expand Down Expand Up @@ -2024,7 +2024,7 @@ void main() {
final GoRouter router = await createRouter(routes, tester);

// Directly set the url through platform message.
await sendPlatformUrl('/dummy/dummy2');
await sendPlatformUrl('/dummy/dummy2', tester);

await tester.pumpAndSettle();
expect(router.location, '/other');
Expand Down