From 2a2f973120ce77a820b43678c3734ceb60b2e95e Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 15 Feb 2022 07:33:57 -0800 Subject: [PATCH] Update flutter_tools to look for new VM service message (#97683) * Update flutter_tools to look for new VM service message The Dart SDK will soon move away from the current Observatory message: "Observatory listening on ..." To a new message that no longer references Observatory: "Dart VM Service listening on ..." This change updates all tests with mocks to check for the new message and also adds support for the new message in ProtocolDiscovery. See https://github.com/dart-lang/sdk/issues/46756 * Fix some parsing locations * Fix analysis failures * Update message * Remove extra comment * Update message * Add globals prefix --- dev/devicelab/lib/framework/runner.dart | 2 +- .../lib/src/widgets/widget_inspector.dart | 2 +- packages/flutter_tools/lib/src/globals.dart | 4 ++ .../flutter_tools/lib/src/ios/ios_deploy.dart | 2 +- .../flutter_tools/lib/src/ios/simulators.dart | 4 +- .../lib/src/protocol_discovery.dart | 4 +- .../lib/src/resident_runner.dart | 2 +- .../lib/src/test/flutter_tester_device.dart | 7 +- .../commands.shard/hermetic/attach_test.dart | 8 +-- .../android/android_device_start_test.dart | 2 +- .../custom_devices/custom_device_test.dart | 6 +- .../general.shard/desktop_device_test.dart | 10 +-- .../flutter_tester_device_test.dart | 2 +- .../ios/ios_device_start_prebuilt_test.dart | 8 +-- .../general.shard/ios/simulators_test.dart | 8 +-- .../general.shard/preview_device_test.dart | 2 +- .../protocol_discovery_test.dart | 70 +++++++++---------- .../tester/flutter_tester_test.dart | 2 +- 18 files changed, 75 insertions(+), 70 deletions(-) diff --git a/dev/devicelab/lib/framework/runner.dart b/dev/devicelab/lib/framework/runner.dart index 56aa7814ad..9b80a45e41 100644 --- a/dev/devicelab/lib/framework/runner.dart +++ b/dev/devicelab/lib/framework/runner.dart @@ -190,7 +190,7 @@ Future runTask( .transform(const LineSplitter()) .listen((String line) { if (!uri.isCompleted) { - final Uri? serviceUri = parseServiceUri(line, prefix: 'Observatory listening on '); + final Uri? serviceUri = parseServiceUri(line, prefix: RegExp('(Observatory|Dart VM Service) listening on ')); if (serviceUri != null) uri.complete(serviceUri); } diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index 714707c634..dd5ff1cded 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -688,7 +688,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService; /// /// Calls to this object are typically made from GUI tools such as the [Flutter /// IntelliJ Plugin](https://github.com/flutter/flutter-intellij/blob/master/README.md) -/// using the [Dart VM Service protocol](https://github.com/dart-lang/sdk/blob/main/runtime/vm/service/service.md). +/// using the [Dart VM Service](https://github.com/dart-lang/sdk/blob/main/runtime/vm/service/service.md). /// This class uses its own object id and manages object lifecycles itself /// instead of depending on the [object ids](https://github.com/dart-lang/sdk/blob/main/runtime/vm/service/service.md#getobject) /// specified by the VM Service Protocol because the VM Service Protocol ids diff --git a/packages/flutter_tools/lib/src/globals.dart b/packages/flutter_tools/lib/src/globals.dart index 35fe0291b0..adb934f94a 100644 --- a/packages/flutter_tools/lib/src/globals.dart +++ b/packages/flutter_tools/lib/src/globals.dart @@ -281,3 +281,7 @@ PreRunValidator get preRunValidator => context.get() ?? const N // TODO(fujino): Migrate to 'main' https://github.com/flutter/flutter/issues/95041 const String kDefaultFrameworkChannel = 'master'; + +// Used to build RegExp instances which can detect the VM service message. +const String kServicePrefixRegExp = '(?:Observatory|The Dart VM service is)'; +final RegExp kVMServiceMessageRegExp = RegExp(kServicePrefixRegExp + r' listening on ((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)'); diff --git a/packages/flutter_tools/lib/src/ios/ios_deploy.dart b/packages/flutter_tools/lib/src/ios/ios_deploy.dart index 3df0b71a30..8b2c044f10 100644 --- a/packages/flutter_tools/lib/src/ios/ios_deploy.dart +++ b/packages/flutter_tools/lib/src/ios/ios_deploy.dart @@ -313,7 +313,7 @@ class IOSDeployDebugger { // (lldb) run // success - // 2020-09-15 13:42:25.185474-0700 Runner[477:181141] flutter: Observatory listening on http://127.0.0.1:57782/ + // 2020-09-15 13:42:25.185474-0700 Runner[477:181141] flutter: The Dart VM service is listening on http://127.0.0.1:57782/ if (_lldbRun.hasMatch(line)) { _logger.printTrace(line); _debuggerState = _IOSDeployDebuggerState.launching; diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart index de3d9bf097..fede1f6d47 100644 --- a/packages/flutter_tools/lib/src/ios/simulators.dart +++ b/packages/flutter_tools/lib/src/ios/simulators.dart @@ -757,8 +757,8 @@ class _IOSSimulatorLogReader extends DeviceLogReader { } // Match the log prefix (in order to shorten it): - // * Xcode 8: Sep 13 15:28:51 cbracken-macpro localhost Runner[37195]: (Flutter) Observatory listening on http://127.0.0.1:57701/ - // * Xcode 9: 2017-09-13 15:26:57.228948-0700 localhost Runner[37195]: (Flutter) Observatory listening on http://127.0.0.1:57701/ + // * Xcode 8: Sep 13 15:28:51 cbracken-macpro localhost Runner[37195]: (Flutter) The Dart VM service is listening on http://127.0.0.1:57701/ + // * Xcode 9: 2017-09-13 15:26:57.228948-0700 localhost Runner[37195]: (Flutter) The Dart VM service is listening on http://127.0.0.1:57701/ static final RegExp _mapRegex = RegExp(r'\S+ +\S+ +(?:\S+) (.+?(?=\[))\[\d+\]\)?: (\(.*?\))? *(.*)$'); // Jan 31 19:23:28 --- last message repeated 1 time --- diff --git a/packages/flutter_tools/lib/src/protocol_discovery.dart b/packages/flutter_tools/lib/src/protocol_discovery.dart index 53edbddd22..cba31766e1 100644 --- a/packages/flutter_tools/lib/src/protocol_discovery.dart +++ b/packages/flutter_tools/lib/src/protocol_discovery.dart @@ -8,6 +8,7 @@ import 'base/io.dart'; import 'base/logger.dart'; import 'device.dart'; import 'device_port_forwarder.dart'; +import 'globals.dart' as globals; /// Discovers a specific service protocol on a device, and forwards the service /// protocol device port to the host. @@ -104,8 +105,7 @@ class ProtocolDiscovery { } Match? _getPatternMatch(String line) { - final RegExp r = RegExp(RegExp.escape(serviceName) + r' listening on ((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)'); - return r.firstMatch(line); + return globals.kVMServiceMessageRegExp.firstMatch(line); } Uri? _getObservatoryUri(String line) { diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 664c6ce67a..d06cfea399 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -367,7 +367,7 @@ class FlutterDevice { return; } _loggingSubscription = logStream.listen((String line) { - if (!line.contains('Observatory listening on http')) { + if (!line.contains(globals.kVMServiceMessageRegExp)) { globals.printStatus(line, wrap: false); } }); diff --git a/packages/flutter_tools/lib/src/test/flutter_tester_device.dart b/packages/flutter_tools/lib/src/test/flutter_tester_device.dart index 5f6448610a..555ab87f0d 100644 --- a/packages/flutter_tools/lib/src/test/flutter_tester_device.dart +++ b/packages/flutter_tools/lib/src/test/flutter_tester_device.dart @@ -20,6 +20,7 @@ import '../base/os.dart'; import '../base/platform.dart'; import '../convert.dart'; import '../device.dart'; +import '../globals.dart' as globals; import '../project.dart'; import '../vmservice.dart'; @@ -294,7 +295,6 @@ class FlutterTesterTestDevice extends TestDevice { @required Process process, @required Future Function(Uri uri) reportObservatoryUri, }) { - const String observatoryString = 'Observatory listening on '; for (final Stream> stream in >>[ process.stderr, process.stdout, @@ -306,9 +306,10 @@ class FlutterTesterTestDevice extends TestDevice { (String line) async { logger.printTrace('test $id: Shell: $line'); - if (line.startsWith(observatoryString)) { + final Match match = globals.kVMServiceMessageRegExp.firstMatch(line); + if (match != null) { try { - final Uri uri = Uri.parse(line.substring(observatoryString.length)); + final Uri uri = Uri.parse(match[1]); if (reportObservatoryUri != null) { await reportObservatoryUri(uri); } diff --git a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart index 48f8742299..6277f3f216 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart @@ -104,7 +104,7 @@ void main() { testUsingContext('finds observatory port and forwards', () async { device.onGetLogReader = () { fakeLogReader.addLine('Foo'); - fakeLogReader.addLine('Observatory listening on http://127.0.0.1:$devicePort'); + fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort'); return fakeLogReader; }; testDeviceManager.addDevice(device); @@ -133,7 +133,7 @@ void main() { testUsingContext('Fails with tool exit on bad Observatory uri', () async { device.onGetLogReader = () { fakeLogReader.addLine('Foo'); - fakeLogReader.addLine('Observatory listening on http://127.0.0.1:$devicePort'); + fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort'); fakeLogReader.dispose(); return fakeLogReader; }; @@ -148,7 +148,7 @@ void main() { testUsingContext('accepts filesystem parameters', () async { device.onGetLogReader = () { fakeLogReader.addLine('Foo'); - fakeLogReader.addLine('Observatory listening on http://127.0.0.1:$devicePort'); + fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort'); return fakeLogReader; }; testDeviceManager.addDevice(device); @@ -223,7 +223,7 @@ void main() { testUsingContext('exits when observatory-port is specified and debug-port is not', () async { device.onGetLogReader = () { fakeLogReader.addLine('Foo'); - fakeLogReader.addLine('Observatory listening on http://127.0.0.1:$devicePort'); + fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort'); return fakeLogReader; }; testDeviceManager.addDevice(device); diff --git a/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart index 4402ee8369..030af3fbda 100644 --- a/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart @@ -200,7 +200,7 @@ void main() { '10', 'app.apk' ], - stdout: '\n\nObservatory listening on http://127.0.0.1:456\n\n', + stdout: '\n\nThe Dart VM service is listening on http://127.0.0.1:456\n\n', )); processManager.addCommand(kShaCommand); processManager.addCommand(const FakeCommand( diff --git a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart index 068190de52..53c32cba22 100644 --- a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart +++ b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart @@ -370,7 +370,7 @@ void main() { FakeCommand( command: testConfig.runDebugCommand, completer: runDebugCompleter, - stdout: 'Observatory listening on http://127.0.0.1:12345/abcd/\n', + stdout: 'The Dart VM service is listening on http://127.0.0.1:12345/abcd/\n', ), FakeCommand( command: testConfig.forwardPortCommand, @@ -411,7 +411,7 @@ void main() { FakeCommand( command: testConfigNonForwarding.runDebugCommand, completer: runDebugCompleter, - stdout: 'Observatory listening on http://192.168.178.123:12345/abcd/\n' + stdout: 'The Dart VM service is listening on http://192.168.178.123:12345/abcd/\n' ), ] ); @@ -456,7 +456,7 @@ void main() { FakeCommand( command: testConfig.runDebugCommand, completer: runDebugCompleter, - stdout: 'Observatory listening on http://127.0.0.1:12345/abcd/\n', + stdout: 'The Dart VM service is listening on http://127.0.0.1:12345/abcd/\n', ), FakeCommand( command: testConfig.forwardPortCommand, diff --git a/packages/flutter_tools/test/general.shard/desktop_device_test.dart b/packages/flutter_tools/test/general.shard/desktop_device_test.dart index c99b650592..764049493e 100644 --- a/packages/flutter_tools/test/general.shard/desktop_device_test.dart +++ b/packages/flutter_tools/test/general.shard/desktop_device_test.dart @@ -81,7 +81,7 @@ void main() { final FakeProcessManager processManager = FakeProcessManager.list([ FakeCommand( command: const ['debug'], - stdout: 'Observatory listening on http://127.0.0.1/0\n', + stdout: 'The Dart VM service is listening on http://127.0.0.1/0\n', completer: completer, ), ]); @@ -118,7 +118,7 @@ void main() { final FakeProcessManager processManager = FakeProcessManager.list([ FakeCommand( command: const ['debug'], - stdout: 'Observatory listening on http://127.0.0.1/0\n', + stdout: 'The Dart VM service is listening on http://127.0.0.1/0\n', completer: completer, ), ]); @@ -140,7 +140,7 @@ void main() { final FakeProcessManager processManager = FakeProcessManager.list([ FakeCommand( command: const ['debug'], - stdout: 'Observatory listening on http://127.0.0.1/0\n', + stdout: 'The Dart VM service is listening on http://127.0.0.1/0\n', completer: completer, environment: const { 'FLUTTER_ENGINE_SWITCH_1': 'enable-dart-profiling=true', @@ -202,7 +202,7 @@ void main() { final FakeProcessManager processManager = FakeProcessManager.list([ FakeCommand( command: const ['debug'], - stdout: 'Observatory listening on http://127.0.0.1/0\n', + stdout: 'The Dart VM service is listening on http://127.0.0.1/0\n', completer: completer, environment: const { 'FLUTTER_ENGINE_SWITCH_1': 'enable-dart-profiling=true', @@ -251,7 +251,7 @@ void main() { final FakeProcessManager processManager = FakeProcessManager.list([ FakeCommand( command: const ['debug', 'arg1', 'arg2'], - stdout: 'Observatory listening on http://127.0.0.1/0\n', + stdout: 'The Dart VM service is listening on http://127.0.0.1/0\n', completer: completer, ), ]); diff --git a/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart b/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart index 81e5045291..1d396e1696 100644 --- a/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart +++ b/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart @@ -247,7 +247,7 @@ void main() { '--packages=.dart_tool/package_config.json', 'example.dill' ], - stdout: 'Observatory listening on http://localhost:1234', + stdout: 'The Dart VM service is listening on http://localhost:1234', stderr: 'failure', ) ]); diff --git a/packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart b/packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart index 37907d08ed..8145cf8fb1 100644 --- a/packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart @@ -128,7 +128,7 @@ void main() { // Start writing messages to the log reader. Timer.run(() { deviceLogReader.addLine('Foo'); - deviceLogReader.addLine('Observatory listening on http://127.0.0.1:456'); + deviceLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:456'); }); final LaunchResult launchResult = await device.startApp(iosApp, @@ -166,7 +166,7 @@ void main() { // Start writing messages to the log reader. Timer.run(() { deviceLogReader.addLine('Foo'); - deviceLogReader.addLine('Observatory listening on http://127.0.0.1:456'); + deviceLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:456'); }); final LaunchResult launchResult = await device.startApp(iosApp, @@ -206,7 +206,7 @@ void main() { Timer.run(() async { await Future.delayed(const Duration(milliseconds: 1)); deviceLogReader.addLine('Foo'); - deviceLogReader.addLine('Observatory listening on http://127.0.0.1:456'); + deviceLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:456'); }); final LaunchResult launchResult = await device.startApp(iosApp, @@ -311,7 +311,7 @@ void main() { // Start writing messages to the log reader. Timer.run(() { - deviceLogReader.addLine('Observatory listening on http://127.0.0.1:1234'); + deviceLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:1234'); }); final LaunchResult launchResult = await device.startApp(iosApp, diff --git a/packages/flutter_tools/test/general.shard/ios/simulators_test.dart b/packages/flutter_tools/test/general.shard/ios/simulators_test.dart index 7610b31f28..4152ad8dab 100644 --- a/packages/flutter_tools/test/general.shard/ios/simulators_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/simulators_test.dart @@ -495,7 +495,7 @@ void main() { ..addCommand(const FakeCommand( command: ['tail', '-n', '0', '-F', 'system.log'], stdout: ''' -Dec 20 17:04:32 md32-11-vm1 My Super Awesome App[88374]: flutter: Observatory listening on http://127.0.0.1:64213/1Uoeu523990=/ +Dec 20 17:04:32 md32-11-vm1 My Super Awesome App[88374]: flutter: The Dart VM service is listening on http://127.0.0.1:64213/1Uoeu523990=/ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text''' )) ..addCommand(const FakeCommand( @@ -514,7 +514,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text''' final List lines = await logReader.logLines.toList(); expect(lines, [ - 'flutter: Observatory listening on http://127.0.0.1:64213/1Uoeu523990=/', + 'flutter: The Dart VM service is listening on http://127.0.0.1:64213/1Uoeu523990=/', ]); expect(fakeProcessManager.hasRemainingExpectations, isFalse); }, overrides: { @@ -529,7 +529,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text''' ..addCommand(const FakeCommand( command: ['tail', '-n', '0', '-F', 'system.log'], stdout: ''' -2017-09-13 15:26:57.228948-0700 localhost My Super Awesome App[37195]: (Flutter) Observatory listening on http://127.0.0.1:57701/ +2017-09-13 15:26:57.228948-0700 localhost My Super Awesome App[37195]: (Flutter) The Dart VM service is listening on http://127.0.0.1:57701/ 2017-09-13 15:26:57.228948-0700 localhost My Super Awesome App[37195]: (Flutter) )))))))))) 2017-09-13 15:26:57.228948-0700 localhost My Super Awesome App[37195]: (Flutter) #0 Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)''' )) @@ -549,7 +549,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text''' final List lines = await logReader.logLines.toList(); expect(lines, [ - 'Observatory listening on http://127.0.0.1:57701/', + 'The Dart VM service is listening on http://127.0.0.1:57701/', '))))))))))', '#0 Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)', ]); diff --git a/packages/flutter_tools/test/general.shard/preview_device_test.dart b/packages/flutter_tools/test/general.shard/preview_device_test.dart index 6b1af43c5e..ff6e9f3473 100644 --- a/packages/flutter_tools/test/general.shard/preview_device_test.dart +++ b/packages/flutter_tools/test/general.shard/preview_device_test.dart @@ -61,7 +61,7 @@ void main() { command: const [ '/.tmp_rand0/flutter_preview.rand0/splash' ], - stdout: 'Observatory listening on http://127.0.0.1:64494/fZ_B2N6JRwY=/\n', + stdout: 'The Dart VM service is listening on http://127.0.0.1:64494/fZ_B2N6JRwY=/\n', completer: completer, ) ]), diff --git a/packages/flutter_tools/test/general.shard/protocol_discovery_test.dart b/packages/flutter_tools/test/general.shard/protocol_discovery_test.dart index ffa23e5c1d..cea1746a80 100644 --- a/packages/flutter_tools/test/general.shard/protocol_discovery_test.dart +++ b/packages/flutter_tools/test/general.shard/protocol_discovery_test.dart @@ -37,7 +37,7 @@ void main() { testWithoutContext('discovers uri if logs already produced output', () async { logReader.addLine('HELLO WORLD'); - logReader.addLine('Observatory listening on http://127.0.0.1:9999'); + logReader.addLine('The Dart VM service is listening on http://127.0.0.1:9999'); final Uri uri = (await discoverer.uri)!; expect(uri.port, 9999); expect('$uri', 'http://127.0.0.1:9999'); @@ -45,9 +45,9 @@ void main() { testWithoutContext('does not discover uri with no host', () async { final Future pendingUri = discoverer.uri; - logReader.addLine('Observatory listening on http12asdasdsd9999'); + logReader.addLine('The Dart VM service is listening on http12asdasdsd9999'); await Future.delayed(const Duration(milliseconds: 10)); - logReader.addLine('Observatory listening on http://127.0.0.1:9999'); + logReader.addLine('The Dart VM service is listening on http://127.0.0.1:9999'); await Future.delayed(Duration.zero); @@ -59,7 +59,7 @@ void main() { testWithoutContext('discovers uri if logs already produced output and no listener is attached', () async { logReader.addLine('HELLO WORLD'); - logReader.addLine('Observatory listening on http://127.0.0.1:9999'); + logReader.addLine('The Dart VM service is listening on http://127.0.0.1:9999'); await Future.delayed(Duration.zero); @@ -70,7 +70,7 @@ void main() { }); testWithoutContext('uri throws if logs produce bad line and no listener is attached', () async { - logReader.addLine('Observatory listening on http://127.0.0.1:apple'); + logReader.addLine('The Dart VM service is listening on http://127.0.0.1:apple'); await Future.delayed(Duration.zero); @@ -79,21 +79,21 @@ void main() { testWithoutContext('discovers uri if logs not yet produced output', () async { final Future uriFuture = discoverer.uri; - logReader.addLine('Observatory listening on http://127.0.0.1:3333'); + logReader.addLine('The Dart VM service is listening on http://127.0.0.1:3333'); final Uri uri = (await uriFuture)!; expect(uri.port, 3333); expect('$uri', 'http://127.0.0.1:3333'); }); testWithoutContext('discovers uri with Ascii Esc code', () async { - logReader.addLine('Observatory listening on http://127.0.0.1:3333\x1b['); + logReader.addLine('The Dart VM service is listening on http://127.0.0.1:3333\x1b['); final Uri uri = (await discoverer.uri)!; expect(uri.port, 3333); expect('$uri', 'http://127.0.0.1:3333'); }); testWithoutContext('uri throws if logs produce bad line', () async { - logReader.addLine('Observatory listening on http://127.0.0.1:apple'); + logReader.addLine('The Dart VM service is listening on http://127.0.0.1:apple'); expect(discoverer.uri, throwsA(isFormatException)); }); @@ -116,7 +116,7 @@ void main() { }); testWithoutContext('discovers uri if log line contains Android prefix', () async { - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:52584'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:52584'); final Uri uri = (await discoverer.uri)!; expect(uri.port, 52584); expect('$uri', 'http://127.0.0.1:52584'); @@ -124,7 +124,7 @@ void main() { testWithoutContext('discovers uri if log line contains auth key', () async { final Future uriFuture = discoverer.uri; - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); final Uri uri = (await uriFuture)!; expect(uri.port, 54804); expect('$uri', 'http://127.0.0.1:54804/PTwjm8Ii8qg=/'); @@ -132,7 +132,7 @@ void main() { testWithoutContext('discovers uri if log line contains non-localhost', () async { final Future uriFuture = discoverer.uri; - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); final Uri uri = (await uriFuture)!; expect(uri.port, 54804); expect('$uri', 'http://127.0.0.1:54804/PTwjm8Ii8qg=/'); @@ -147,8 +147,8 @@ void main() { logger: BufferLogger.test(), ); final Future uriFuture = discoverer.uri; - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); final Uri uri = (await uriFuture)!; expect(uri.port, 12346); expect('$uri', 'http://127.0.0.1:12346/PTwjm8Ii8qg=/'); @@ -163,16 +163,16 @@ void main() { logger: BufferLogger.test(), ); final Future uriFuture = discoverer.uri; - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); final Uri uri = (await uriFuture)!; expect(uri.port, 12346); expect('$uri', 'http://127.0.0.1:12346/PTwjm8Ii8qg=/'); }); testWithoutContext('first uri in the stream is the last one from the log', () async { - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); final Uri uri = await discoverer.uris.first; expect(uri.port, 12345); expect('$uri', 'http://127.0.0.1:12345/PTwjm8Ii8qg=/'); @@ -186,9 +186,9 @@ void main() { throttleDuration: const Duration(milliseconds: 200), logger: BufferLogger.test(), ); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12344/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12344/PTwjm8Ii8qg=/'); final Uri uri = await discoverer.uris.first; expect(uri.port, 12345); expect('$uri', 'http://127.0.0.1:12345/PTwjm8Ii8qg=/'); @@ -203,8 +203,8 @@ void main() { logger: BufferLogger.test(), ); final Future> results = discoverer.uris.toList(); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); await logReader.dispose(); // Give time for throttle to finish. @@ -228,13 +228,13 @@ void main() { discoveredUris.add(uri); }); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); time.elapse(kThrottleDuration); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12344/PTwjm8Ii8qg=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12343/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12344/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12343/PTwjm8Ii8qg=/'); time.elapse(kThrottleDuration); @@ -263,13 +263,13 @@ void main() { discoveredUris.add(uri); }); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12346/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12345/PTwjm8Ii8qg=/'); time.elapse(kThrottleTimeInMilliseconds); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12345/PTwjm8Ii8qc=/'); - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:12344/PTwjm8Ii8qf=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12345/PTwjm8Ii8qc=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:12344/PTwjm8Ii8qf=/'); time.elapse(kThrottleTimeInMilliseconds); @@ -294,7 +294,7 @@ void main() { // Get next port future. final Future nextUri = discoverer.uri; - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); final Uri uri = (await nextUri)!; expect(uri.port, 99); expect('$uri', 'http://127.0.0.1:99/PTwjm8Ii8qg=/'); @@ -315,7 +315,7 @@ void main() { // Get next port future. final Future nextUri = discoverer.uri; - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); final Uri uri = (await nextUri)!; expect(uri.port, 1243); expect('$uri', 'http://127.0.0.1:1243/PTwjm8Ii8qg=/'); @@ -336,7 +336,7 @@ void main() { // Get next port future. final Future nextUri = discoverer.uri; - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); final Uri uri = (await nextUri)!; expect(uri.port, 99); expect('$uri', 'http://127.0.0.1:99/PTwjm8Ii8qg=/'); @@ -357,7 +357,7 @@ void main() { // Get next port future. final Future nextUri = discoverer.uri; - logReader.addLine('I/flutter : Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); + logReader.addLine('I/flutter : The Dart VM service is listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/'); final Uri uri = (await nextUri)!; expect(uri.port, 54777); expect('$uri', 'http://[::1]:54777/PTwjm8Ii8qg=/'); @@ -378,7 +378,7 @@ void main() { // Get next port future. final Future nextUri = discoverer.uri; - logReader.addLine('I/flutter : Observatory listening on http://[::1]:54777/PTwjm8Ii8qg=/\x1b['); + logReader.addLine('I/flutter : The Dart VM service is listening on http://[::1]:54777/PTwjm8Ii8qg=/\x1b['); final Uri uri = (await nextUri)!; expect(uri.port, 54777); expect('$uri', 'http://[::1]:54777/PTwjm8Ii8qg=/'); diff --git a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart index 04d0b9e67a..b8aa327eaf 100644 --- a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart +++ b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart @@ -154,7 +154,7 @@ void main() { completer: completer, stdout: ''' -Observatory listening on $observatoryUri +The Dart VM service is listening on $observatoryUri Hello! ''', ));