Reland "Remove references to Observatory (#118577)" (#121606)

This reverts commit 275ab9c69b.
This commit is contained in:
Ben Konyi 2023-02-28 11:57:04 -05:00 committed by GitHub
parent 8fc499aaf0
commit ecd7518df5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
90 changed files with 519 additions and 491 deletions

View file

@ -41,7 +41,7 @@ assignees: ''
can have an intuitive understanding of what happened. Dont use can have an intuitive understanding of what happened. Dont use
"adb screenrecord", as that affects the performance of the profile run. "adb screenrecord", as that affects the performance of the profile run.
5. Open Observatory and save a timeline trace of the performance issue 5. Open Flutter DevTools and save a timeline trace of the performance issue
so we know which functions might be causing it. See "How to Collect so we know which functions might be causing it. See "How to Collect
and Read Timeline Traces" on this blog post: and Read Timeline Traces" on this blog post:
https://medium.com/flutter/profiling-flutter-applications-using-the-timeline-a1a434964af3#a499 https://medium.com/flutter/profiling-flutter-applications-using-the-timeline-a1a434964af3#a499

View file

@ -202,7 +202,7 @@ Future<TaskResult> runTask(
.transform<String>(const LineSplitter()) .transform<String>(const LineSplitter())
.listen((String line) { .listen((String line) {
if (!uri.isCompleted) { if (!uri.isCompleted) {
final Uri? serviceUri = parseServiceUri(line, prefix: RegExp('(Observatory|The Dart VM service is) listening on ')); final Uri? serviceUri = parseServiceUri(line, prefix: RegExp('The Dart VM service is listening on '));
if (serviceUri != null) { if (serviceUri != null) {
uri.complete(serviceUri); uri.complete(serviceUri);
} }

View file

@ -664,14 +664,14 @@ Future<void> runAndCaptureAsyncStacks(Future<void> Function() callback) {
bool canRun(String path) => _processManager.canRun(path); bool canRun(String path) => _processManager.canRun(path);
final RegExp _obsRegExp = final RegExp _obsRegExp =
RegExp('An Observatory debugger .* is available at: '); RegExp('A Dart VM Service .* is available at: ');
final RegExp _obsPortRegExp = RegExp(r'(\S+:(\d+)/\S*)$'); final RegExp _obsPortRegExp = RegExp(r'(\S+:(\d+)/\S*)$');
final RegExp _obsUriRegExp = RegExp(r'((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)'); final RegExp _obsUriRegExp = RegExp(r'((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)');
/// Tries to extract a port from the string. /// Tries to extract a port from the string.
/// ///
/// The `prefix`, if specified, is a regular expression pattern and must not contain groups. /// The `prefix`, if specified, is a regular expression pattern and must not contain groups.
/// `prefix` defaults to the RegExp: `An Observatory debugger .* is available at: `. /// `prefix` defaults to the RegExp: `A Dart VM Service .* is available at: `.
int? parseServicePort(String line, { int? parseServicePort(String line, {
Pattern? prefix, Pattern? prefix,
}) { }) {
@ -689,7 +689,7 @@ int? parseServicePort(String line, {
/// Tries to extract a URL from the string. /// Tries to extract a URL from the string.
/// ///
/// The `prefix`, if specified, is a regular expression pattern and must not contain groups. /// The `prefix`, if specified, is a regular expression pattern and must not contain groups.
/// `prefix` defaults to the RegExp: `An Observatory debugger .* is available at: `. /// `prefix` defaults to the RegExp: `A Dart VM Service .* is available at: `.
Uri? parseServiceUri(String line, { Uri? parseServiceUri(String line, {
Pattern? prefix, Pattern? prefix,
}) { }) {

View file

@ -1184,11 +1184,11 @@ class PerfTestWithSkSL extends PerfTest {
await _generateSkSL(); await _generateSkSL();
// Build the app with SkSL artifacts and run that app // Build the app with SkSL artifacts and run that app
final String observatoryUri = await _runApp(skslPath: _skslJsonFileName); final String vmServiceUri = await _runApp(skslPath: _skslJsonFileName);
// Attach to the running app and run the final driver test to get metrics. // Attach to the running app and run the final driver test to get metrics.
final TaskResult result = await internalRun( final TaskResult result = await internalRun(
existingApp: observatoryUri, existingApp: vmServiceUri,
); );
_runProcess.kill(); _runProcess.kill();
@ -1207,8 +1207,8 @@ class PerfTestWithSkSL extends PerfTest {
// `--write-sksl-on-exit` option doesn't seem to be compatible with // `--write-sksl-on-exit` option doesn't seem to be compatible with
// `flutter drive --existing-app` as it will complain web socket connection // `flutter drive --existing-app` as it will complain web socket connection
// issues. // issues.
final String observatoryUri = await _runApp(cacheSkSL: true); final String vmServiceUri = await _runApp(cacheSkSL: true);
await super.internalRun(cacheSkSL: true, existingApp: observatoryUri); await super.internalRun(cacheSkSL: true, existingApp: vmServiceUri);
_runProcess.kill(); _runProcess.kill();
await _runProcess.exitCode; await _runProcess.exitCode;

View file

@ -19,7 +19,7 @@ void main() {
group('parse service', () { group('parse service', () {
const String badOutput = 'No uri here'; const String badOutput = 'No uri here';
const String sampleOutput = 'An Observatory debugger and profiler on ' const String sampleOutput = 'A Dart VM Service on '
'Pixel 3 XL is available at: http://127.0.0.1:9090/LpjUpsdEjqI=/'; 'Pixel 3 XL is available at: http://127.0.0.1:9090/LpjUpsdEjqI=/';
test('uri', () { test('uri', () {

View file

@ -138,7 +138,7 @@ abstract class BindingBase {
/// First calls [initInstances] to have bindings initialize their /// First calls [initInstances] to have bindings initialize their
/// instance pointers and other state, then calls /// instance pointers and other state, then calls
/// [initServiceExtensions] to have bindings initialize their /// [initServiceExtensions] to have bindings initialize their
/// observatory service extensions, if any. /// VM service extensions, if any.
BindingBase() { BindingBase() {
developer.Timeline.startSync('Framework initialization'); developer.Timeline.startSync('Framework initialization');
assert(() { assert(() {

View file

@ -69,10 +69,10 @@ abstract class ShaderWarmUp {
/// ///
/// To decide which draw operations to be added to your custom warm up /// To decide which draw operations to be added to your custom warm up
/// process, consider capturing an skp using `flutter screenshot /// process, consider capturing an skp using `flutter screenshot
/// --observatory-uri=<uri> --type=skia` and analyzing it with /// --vm-service-uri=<uri> --type=skia` and analyzing it with
/// <https://debugger.skia.org/>. Alternatively, one may run the app with /// <https://debugger.skia.org/>. Alternatively, one may run the app with
/// `flutter run --trace-skia` and then examine the raster thread in the /// `flutter run --trace-skia` and then examine the raster thread in the
/// observatory timeline to see which Skia draw operations are commonly used, /// Flutter DevTools timeline to see which Skia draw operations are commonly used,
/// and which shader compilations are causing jank. /// and which shader compilations are causing jank.
@protected @protected
Future<void> warmUpOnCanvas(ui.Canvas canvas); Future<void> warmUpOnCanvas(ui.Canvas canvas);

View file

@ -1172,7 +1172,7 @@ class WidgetsApp extends StatefulWidget {
/// If true, forces the performance overlay to be visible in all instances. /// If true, forces the performance overlay to be visible in all instances.
/// ///
/// Used by the `showPerformanceOverlay` observatory extension. /// Used by the `showPerformanceOverlay` VM service extension.
static bool showPerformanceOverlayOverride = false; static bool showPerformanceOverlayOverride = false;
/// If true, forces the widget inspector to be visible. /// If true, forces the widget inspector to be visible.
@ -1182,12 +1182,12 @@ class WidgetsApp extends StatefulWidget {
/// The inspector allows you to select a location on your device or emulator /// The inspector allows you to select a location on your device or emulator
/// and view what widgets and render objects associated with it. An outline of /// and view what widgets and render objects associated with it. An outline of
/// the selected widget and some summary information is shown on device and /// the selected widget and some summary information is shown on device and
/// more detailed information is shown in the IDE or Observatory. /// more detailed information is shown in the IDE or DevTools.
static bool debugShowWidgetInspectorOverride = false; static bool debugShowWidgetInspectorOverride = false;
/// If false, prevents the debug banner from being visible. /// If false, prevents the debug banner from being visible.
/// ///
/// Used by the `debugAllowBanner` observatory extension. /// Used by the `debugAllowBanner` VM service extension.
/// ///
/// This is how `flutter run` turns off the banner when you take a screen shot /// This is how `flutter run` turns off the banner when you take a screen shot
/// with "s". /// with "s".

View file

@ -33,8 +33,8 @@ import 'table.dart';
/// Combined with [debugPrintScheduleBuildForStacks], this lets you watch a /// Combined with [debugPrintScheduleBuildForStacks], this lets you watch a
/// widget's dirty/clean lifecycle. /// widget's dirty/clean lifecycle.
/// ///
/// To get similar information but showing it on the timeline available from the /// To get similar information but showing it on the timeline available from
/// Observatory rather than getting it in the console (where it can be /// Flutter DevTools rather than getting it in the console (where it can be
/// overwhelming), consider [debugProfileBuildsEnabled]. /// overwhelming), consider [debugProfileBuildsEnabled].
/// ///
/// See also: /// See also:

View file

@ -703,7 +703,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService;
/// operation making it easier to avoid memory leaks. /// operation making it easier to avoid memory leaks.
/// ///
/// All methods in this class are appropriate to invoke from debugging tools /// All methods in this class are appropriate to invoke from debugging tools
/// using the Observatory service protocol to evaluate Dart expressions of the /// using the VM service protocol to evaluate Dart expressions of the
/// form `WidgetInspectorService.instance.methodName(arg1, arg2, ...)`. If you /// form `WidgetInspectorService.instance.methodName(arg1, arg2, ...)`. If you
/// make changes to any instance method of this class you need to verify that /// make changes to any instance method of this class you need to verify that
/// the [Flutter IntelliJ Plugin](https://github.com/flutter/flutter-intellij/blob/master/README.md) /// the [Flutter IntelliJ Plugin](https://github.com/flutter/flutter-intellij/blob/master/README.md)
@ -712,7 +712,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService;
/// All methods returning String values return JSON. /// All methods returning String values return JSON.
mixin WidgetInspectorService { mixin WidgetInspectorService {
/// Ring of cached JSON values to prevent JSON from being garbage /// Ring of cached JSON values to prevent JSON from being garbage
/// collected before it can be requested over the Observatory protocol. /// collected before it can be requested over the VM service protocol.
final List<String?> _serializeRing = List<String?>.filled(20, null); final List<String?> _serializeRing = List<String?>.filled(20, null);
int _serializeRingIndex = 0; int _serializeRingIndex = 0;
@ -739,7 +739,7 @@ mixin WidgetInspectorService {
/// when the inspection target changes on device. /// when the inspection target changes on device.
InspectorSelectionChangedCallback? selectionChangedCallback; InspectorSelectionChangedCallback? selectionChangedCallback;
/// The Observatory protocol does not keep alive object references so this /// The VM service protocol does not keep alive object references so this
/// class needs to manually manage groups of objects that should be kept /// class needs to manually manage groups of objects that should be kept
/// alive. /// alive.
final Map<String, Set<_InspectorReferenceData>> _groups = <String, Set<_InspectorReferenceData>>{}; final Map<String, Set<_InspectorReferenceData>> _groups = <String, Set<_InspectorReferenceData>>{};
@ -1690,7 +1690,7 @@ mixin WidgetInspectorService {
/// Wrapper around `json.encode` that uses a ring of cached values to prevent /// Wrapper around `json.encode` that uses a ring of cached values to prevent
/// the Dart garbage collector from collecting objects between when /// the Dart garbage collector from collecting objects between when
/// the value is returned over the Observatory protocol and when the /// the value is returned over the VM service protocol and when the
/// separate observatory protocol command has to be used to retrieve its full /// separate observatory protocol command has to be used to retrieve its full
/// contents. /// contents.
// //

View file

@ -148,7 +148,7 @@ Future<void> run(List<String> args) async {
), ),
), ),
watcher: collector, watcher: collector,
enableObservatory: collector != null, enableVmService: collector != null,
precompiledDillFiles: tests, precompiledDillFiles: tests,
concurrency: math.max(1, globals.platform.numberOfProcessors - 2), concurrency: math.max(1, globals.platform.numberOfProcessors - 2),
icudtlPath: globals.fs.path.absolute(argResults[_kOptionIcudtl] as String), icudtlPath: globals.fs.path.absolute(argResults[_kOptionIcudtl] as String),

View file

@ -60,9 +60,9 @@ class Context {
// Thinning is handled during the bundle asset assemble build target, so just embed. // Thinning is handled during the bundle asset assemble build target, so just embed.
embedFlutterFrameworks(); embedFlutterFrameworks();
break; break;
case 'test_observatory_bonjour_service': case 'test_vm_service_bonjour_service':
// Exposed for integration testing only. // Exposed for integration testing only.
addObservatoryBonjourService(); addVmServiceBonjourService();
} }
} }
@ -220,11 +220,11 @@ class Context {
], ],
); );
addObservatoryBonjourService(); addVmServiceBonjourService();
} }
// Add the observatory publisher Bonjour service to the produced app bundle Info.plist. // Add the vmService publisher Bonjour service to the produced app bundle Info.plist.
void addObservatoryBonjourService() { void addVmServiceBonjourService() {
final String buildMode = parseFlutterBuildMode(); final String buildMode = parseFlutterBuildMode();
// Debug and profile only. // Debug and profile only.
@ -239,13 +239,13 @@ class Context {
// The file will be present on re-run. // The file will be present on re-run.
echo( echo(
'${environment['INFOPLIST_PATH'] ?? ''} does not exist. Skipping ' '${environment['INFOPLIST_PATH'] ?? ''} does not exist. Skipping '
'_dartobservatory._tcp NSBonjourServices insertion. Try re-building to ' '_dartVmService._tcp NSBonjourServices insertion. Try re-building to '
'enable "flutter attach".'); 'enable "flutter attach".');
return; return;
} }
// If there are already NSBonjourServices specified by the app (uncommon), // If there are already NSBonjourServices specified by the app (uncommon),
// insert the observatory service name to the existing list. // insert the vmService service name to the existing list.
ProcessResult result = runSync( ProcessResult result = runSync(
'plutil', 'plutil',
<String>[ <String>[
@ -265,19 +265,19 @@ class Context {
'-insert', '-insert',
'NSBonjourServices.0', 'NSBonjourServices.0',
'-string', '-string',
'_dartobservatory._tcp', '_dartVmService._tcp',
builtProductsPlist, builtProductsPlist,
], ],
); );
} else { } else {
// Otherwise, add the NSBonjourServices key and observatory service name. // Otherwise, add the NSBonjourServices key and vmService service name.
runSync( runSync(
'plutil', 'plutil',
<String>[ <String>[
'-insert', '-insert',
'NSBonjourServices', 'NSBonjourServices',
'-json', '-json',
'["_dartobservatory._tcp"]', '["_dartVmService._tcp"]',
builtProductsPlist, builtProductsPlist,
], ],
); );

View file

@ -17,7 +17,7 @@ immediately discover the port
will search for an already running Flutter app or module if available. will search for an already running Flutter app or module if available.
Otherwise, the tool will wait for the next Flutter app or module to launch Otherwise, the tool will wait for the next Flutter app or module to launch
before attaching. before attaching.
1. If the app or module is already running and the specific observatory port is 1. If the app or module is already running and the specific VM Service port is
known, it can be explicitly provided to attach via the command-line, e.g. known, it can be explicitly provided to attach via the command-line, e.g.
`$ flutter attach --debug-port 12345` `$ flutter attach --debug-port 12345`

View file

@ -140,7 +140,7 @@ This is sent when an app is starting. The `params` field will be a map with the
#### app.debugPort #### app.debugPort
This is sent when an observatory port is available for a started app. The `params` field will be a map with the fields `appId`, `port`, and `wsUri`. Clients should prefer using the `wsUri` field in preference to synthesizing a URI using the `port` field. An optional field, `baseUri`, is populated if a path prefix is required for setting breakpoints on the target device. This is sent when a VM service port is available for a started app. The `params` field will be a map with the fields `appId`, `port`, and `wsUri`. Clients should prefer using the `wsUri` field in preference to synthesizing a URI using the `port` field. An optional field, `baseUri`, is populated if a path prefix is required for setting breakpoints on the target device.
#### app.started #### app.started

View file

@ -599,12 +599,12 @@ class AndroidDevice extends Device {
} }
final bool traceStartup = platformArgs['trace-startup'] as bool? ?? false; final bool traceStartup = platformArgs['trace-startup'] as bool? ?? false;
ProtocolDiscovery? observatoryDiscovery; ProtocolDiscovery? vmServiceDiscovery;
if (debuggingOptions.debuggingEnabled) { if (debuggingOptions.debuggingEnabled) {
observatoryDiscovery = ProtocolDiscovery.observatory( vmServiceDiscovery = ProtocolDiscovery.vmService(
// Avoid using getLogReader, which returns a singleton instance, because the // Avoid using getLogReader, which returns a singleton instance, because the
// observatory discovery will dispose at the end. creating a new logger here allows // VM Service discovery will dipose at the end. creating a new logger here allows
// logs to be surfaced normally during `flutter drive`. // logs to be surfaced normally during `flutter drive`.
await AdbLogReader.createLogReader( await AdbLogReader.createLogReader(
this, this,
@ -687,13 +687,13 @@ class AndroidDevice extends Device {
} }
// Wait for the service protocol port here. This will complete once the // Wait for the service protocol port here. This will complete once the
// device has printed "Observatory is listening on...". // device has printed "VM Service is listening on...".
_logger.printTrace('Waiting for observatory port to be available...'); _logger.printTrace('Waiting for VM Service port to be available...');
try { try {
Uri? observatoryUri; Uri? vmServiceUri;
if (debuggingOptions.buildInfo.isDebug || debuggingOptions.buildInfo.isProfile) { if (debuggingOptions.buildInfo.isDebug || debuggingOptions.buildInfo.isProfile) {
observatoryUri = await observatoryDiscovery?.uri; vmServiceUri = await vmServiceDiscovery?.uri;
if (observatoryUri == null) { if (vmServiceUri == null) {
_logger.printError( _logger.printError(
'Error waiting for a debug connection: ' 'Error waiting for a debug connection: '
'The log reader stopped unexpectedly', 'The log reader stopped unexpectedly',
@ -701,12 +701,12 @@ class AndroidDevice extends Device {
return LaunchResult.failed(); return LaunchResult.failed();
} }
} }
return LaunchResult.succeeded(observatoryUri: observatoryUri); return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
} on Exception catch (error) { } on Exception catch (error) {
_logger.printError('Error waiting for a debug connection: $error'); _logger.printError('Error waiting for a debug connection: $error');
return LaunchResult.failed(); return LaunchResult.failed();
} finally { } finally {
await observatoryDiscovery?.cancel(); await vmServiceDiscovery?.cancel();
} }
} }

View file

@ -35,7 +35,7 @@ class DartDevelopmentService {
final Completer<void> _completer = Completer<void>(); final Completer<void> _completer = Completer<void>();
Future<void> startDartDevelopmentService( Future<void> startDartDevelopmentService(
Uri observatoryUri, { Uri vmServiceUri, {
required Logger logger, required Logger logger,
int? hostPort, int? hostPort,
bool? ipv6, bool? ipv6,
@ -49,11 +49,11 @@ class DartDevelopmentService {
); );
logger.printTrace( logger.printTrace(
'Launching a Dart Developer Service (DDS) instance at $ddsUri, ' 'Launching a Dart Developer Service (DDS) instance at $ddsUri, '
'connecting to VM service at $observatoryUri.', 'connecting to VM service at $vmServiceUri.',
); );
try { try {
_ddsInstance = await ddsLauncherCallback( _ddsInstance = await ddsLauncherCallback(
observatoryUri, vmServiceUri,
serviceUri: ddsUri, serviceUri: ddsUri,
enableAuthCodes: disableServiceAuthCodes != true, enableAuthCodes: disableServiceAuthCodes != true,
ipv6: ipv6 ?? false, ipv6: ipv6 ?? false,

View file

@ -394,16 +394,16 @@ class BuildMode {
throw ArgumentError('$value is not a supported build mode'); throw ArgumentError('$value is not a supported build mode');
} }
/// Built in JIT mode with no optimizations, enabled asserts, and an observatory. /// Built in JIT mode with no optimizations, enabled asserts, and a VM service.
static const BuildMode debug = BuildMode._('debug'); static const BuildMode debug = BuildMode._('debug');
/// Built in AOT mode with some optimizations and an observatory. /// Built in AOT mode with some optimizations and a VM service.
static const BuildMode profile = BuildMode._('profile'); static const BuildMode profile = BuildMode._('profile');
/// Built in AOT mode with all optimizations and no observatory. /// Built in AOT mode with all optimizations and no VM service.
static const BuildMode release = BuildMode._('release'); static const BuildMode release = BuildMode._('release');
/// Built in JIT mode with all optimizations and no observatory. /// Built in JIT mode with all optimizations and no VM service.
static const BuildMode jitRelease = BuildMode._('jit_release'); static const BuildMode jitRelease = BuildMode._('jit_release');
static const List<BuildMode> values = <BuildMode>[ static const List<BuildMode> values = <BuildMode>[

View file

@ -56,7 +56,7 @@ import '../vmservice.dart';
/// ``` /// ```
/// $ flutter attach /// $ flutter attach
/// ``` /// ```
/// As soon as a new observatory is detected the command attaches to it and /// As soon as a new VM Service is detected the command attaches to it and
/// enables hot reloading. /// enables hot reloading.
/// ///
/// To attach to a flutter mod running on a fuchsia device, `--module` must /// To attach to a flutter mod running on a fuchsia device, `--module` must
@ -97,18 +97,18 @@ class AttachCommand extends FlutterCommand {
..addOption( ..addOption(
'debug-port', 'debug-port',
hide: !verboseHelp, hide: !verboseHelp,
help: '(deprecated) Device port where the observatory is listening. Requires ' help: '(deprecated) Device port where the Dart VM Service is listening. Requires '
'"--disable-service-auth-codes" to also be provided to the Flutter ' '"--disable-service-auth-codes" to also be provided to the Flutter '
'application at launch, otherwise this command will fail to connect to ' 'application at launch, otherwise this command will fail to connect to '
'the application. In general, "--debug-url" should be used instead.', 'the application. In general, "--debug-url" should be used instead.',
)..addOption( )..addOption(
'debug-url', 'debug-url',
aliases: <String>[ 'debug-uri' ], // supported for historical reasons aliases: <String>[ 'debug-uri' ], // supported for historical reasons
help: 'The URL at which the observatory is listening.', help: 'The URL at which the Dart VM Service is listening.',
)..addOption( )..addOption(
'app-id', 'app-id',
help: 'The package name (Android) or bundle identifier (iOS) for the app. ' help: 'The package name (Android) or bundle identifier (iOS) for the app. '
'This can be specified to avoid being prompted if multiple observatory ports ' 'This can be specified to avoid being prompted if multiple Dart VM Service ports '
'are advertised.\n' 'are advertised.\n'
'If you have multiple devices or emulators running, you should include the ' 'If you have multiple devices or emulators running, you should include the '
'device hostname as well, e.g. "com.example.myApp@my-iphone".\n' 'device hostname as well, e.g. "com.example.myApp@my-iphone".\n'
@ -169,7 +169,7 @@ For Fuchsia, the module name must be provided, e.g. `$flutter attach
--module=mod_name`. This can be called either before or after the application --module=mod_name`. This can be called either before or after the application
is started. is started.
If the app or module is already running and the specific observatory port is If the app or module is already running and the specific vmService port is
known, it can be explicitly provided to attach via the command-line, e.g. known, it can be explicitly provided to attach via the command-line, e.g.
`$ flutter attach --debug-port 12345`'''; `$ flutter attach --debug-port 12345`''';
@ -225,10 +225,10 @@ known, it can be explicitly provided to attach via the command-line, e.g.
'the value of --ipv6 on its own.', 'the value of --ipv6 on its own.',
); );
} }
if (debugPort == null && debugUri == null && argResults!.wasParsed(FlutterCommand.observatoryPortOption)) { if (debugPort == null && debugUri == null && argResults!.wasParsed(FlutterCommand.vmServicePortOption)) {
throwToolExit( throwToolExit(
'When the --debug-port or --debug-url is unknown, this command does not use ' 'When the --debug-port or --debug-url is unknown, this command does not use '
'the value of --observatory-port.', 'the value of --vm-service-port.',
); );
} }
if (debugPort != null && debugUri != null) { if (debugPort != null && debugUri != null) {
@ -281,7 +281,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
) )
: null; : null;
Stream<Uri>? observatoryUri; Stream<Uri>? vmServiceUri;
bool usesIpv6 = ipv6!; bool usesIpv6 = ipv6!;
final String ipv6Loopback = InternetAddress.loopbackIPv6.address; final String ipv6Loopback = InternetAddress.loopbackIPv6.address;
final String ipv4Loopback = InternetAddress.loopbackIPv4.address; final String ipv4Loopback = InternetAddress.loopbackIPv4.address;
@ -298,7 +298,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
FuchsiaIsolateDiscoveryProtocol? isolateDiscoveryProtocol; FuchsiaIsolateDiscoveryProtocol? isolateDiscoveryProtocol;
try { try {
isolateDiscoveryProtocol = device.getIsolateDiscoveryProtocol(module); isolateDiscoveryProtocol = device.getIsolateDiscoveryProtocol(module);
observatoryUri = Stream<Uri>.value(await isolateDiscoveryProtocol.uri).asBroadcastStream(); vmServiceUri = Stream<Uri>.value(await isolateDiscoveryProtocol.uri).asBroadcastStream();
} on Exception { } on Exception {
isolateDiscoveryProtocol?.dispose(); isolateDiscoveryProtocol?.dispose();
final List<ForwardedPort> ports = device.portForwarder.forwardedPorts.toList(); final List<ForwardedPort> ports = device.portForwarder.forwardedPorts.toList();
@ -351,7 +351,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
Future<Uri?>? protocolDiscoveryFuture; Future<Uri?>? protocolDiscoveryFuture;
if (compatibleWithProtocolDiscovery) { if (compatibleWithProtocolDiscovery) {
final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.observatory( final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.vmService(
device.getLogReader(), device.getLogReader(),
portForwarder: device.portForwarder, portForwarder: device.portForwarder,
ipv6: ipv6!, ipv6: ipv6!,
@ -372,14 +372,14 @@ known, it can be explicitly provided to attach via the command-line, e.g.
} }
discoveryStatus.stop(); discoveryStatus.stop();
observatoryUri = foundUrl == null vmServiceUri = foundUrl == null
? null ? null
: Stream<Uri>.value(foundUrl).asBroadcastStream(); : Stream<Uri>.value(foundUrl).asBroadcastStream();
} }
// If MDNS discovery fails or we're not on iOS, fallback to ProtocolDiscovery. // If MDNS discovery fails or we're not on iOS, fallback to ProtocolDiscovery.
if (observatoryUri == null) { if (vmServiceUri == null) {
final ProtocolDiscovery observatoryDiscovery = final ProtocolDiscovery vmServiceDiscovery =
ProtocolDiscovery.observatory( ProtocolDiscovery.vmService(
// If it's an Android device, attaching relies on past log searching // If it's an Android device, attaching relies on past log searching
// to find the service protocol. // to find the service protocol.
await device.getLogReader(includePastLogs: device is AndroidDevice), await device.getLogReader(includePastLogs: device is AndroidDevice),
@ -390,12 +390,12 @@ known, it can be explicitly provided to attach via the command-line, e.g.
logger: _logger, logger: _logger,
); );
_logger.printStatus('Waiting for a connection from Flutter on ${device.name}...'); _logger.printStatus('Waiting for a connection from Flutter on ${device.name}...');
observatoryUri = observatoryDiscovery.uris; vmServiceUri = vmServiceDiscovery.uris;
// Determine ipv6 status from the scanned logs. // Determine ipv6 status from the scanned logs.
usesIpv6 = observatoryDiscovery.ipv6; usesIpv6 = vmServiceDiscovery.ipv6;
} }
} else { } else {
observatoryUri = Stream<Uri> vmServiceUri = Stream<Uri>
.fromFuture( .fromFuture(
buildVMServiceUri( buildVMServiceUri(
device, device,
@ -413,7 +413,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
int? result; int? result;
if (daemon != null) { if (daemon != null) {
final ResidentRunner runner = await createResidentRunner( final ResidentRunner runner = await createResidentRunner(
observatoryUris: observatoryUri, vmServiceUris: vmServiceUri,
device: device, device: device,
flutterProject: flutterProject, flutterProject: flutterProject,
usesIpv6: usesIpv6, usesIpv6: usesIpv6,
@ -446,7 +446,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
} }
while (true) { while (true) {
final ResidentRunner runner = await createResidentRunner( final ResidentRunner runner = await createResidentRunner(
observatoryUris: observatoryUri, vmServiceUris: vmServiceUri,
device: device, device: device,
flutterProject: flutterProject, flutterProject: flutterProject,
usesIpv6: usesIpv6, usesIpv6: usesIpv6,
@ -476,7 +476,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
} }
terminalHandler?.stop(); terminalHandler?.stop();
assert(result != null); assert(result != null);
if (runner.exited || !runner.isWaitingForObservatory) { if (runner.exited || !runner.isWaitingForVmService) {
break; break;
} }
_logger.printStatus('Waiting for a new connection from Flutter on ${device.name}...'); _logger.printStatus('Waiting for a new connection from Flutter on ${device.name}...');
@ -495,7 +495,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
} }
Future<ResidentRunner> createResidentRunner({ Future<ResidentRunner> createResidentRunner({
required Stream<Uri> observatoryUris, required Stream<Uri> vmServiceUris,
required Device device, required Device device,
required FlutterProject flutterProject, required FlutterProject flutterProject,
required bool usesIpv6, required bool usesIpv6,
@ -510,7 +510,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
userIdentifier: userIdentifier, userIdentifier: userIdentifier,
platform: _platform, platform: _platform,
); );
flutterDevice.observatoryUris = observatoryUris; flutterDevice.vmServiceUris = vmServiceUris;
final List<FlutterDevice> flutterDevices = <FlutterDevice>[flutterDevice]; final List<FlutterDevice> flutterDevices = <FlutterDevice>[flutterDevice];
final DebuggingOptions debuggingOptions = DebuggingOptions.enabled( final DebuggingOptions debuggingOptions = DebuggingOptions.enabled(
buildInfo, buildInfo,

View file

@ -650,7 +650,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
description: 'Should the device use port forwarding? ' description: 'Should the device use port forwarding? '
'Using port forwarding is the default because it works in all cases, however if your ' 'Using port forwarding is the default because it works in all cases, however if your '
'remote device has a static IP address and you have a way of ' 'remote device has a static IP address and you have a way of '
'specifying the "--observatory-host=<ip>" engine option, you might prefer ' 'specifying the "--vm-service-host=<ip>" engine option, you might prefer '
'not using port forwarding.', 'not using port forwarding.',
); );

View file

@ -1016,7 +1016,9 @@ class DeviceDomain extends Domain {
); );
return <String, Object?>{ return <String, Object?>{
'started': result.started, 'started': result.started,
'observatoryUri': result.observatoryUri?.toString(), 'vmServiceUri': result.vmServiceUri?.toString(),
// TODO(bkonyi): remove once clients have migrated to relying on vmServiceUri.
'observatoryUri': result.vmServiceUri?.toString(),
}; };
} }

View file

@ -81,7 +81,7 @@ class DriveCommand extends RunCommandBase {
'running, and "--no-keep-app-running" overrides it.', 'running, and "--no-keep-app-running" overrides it.',
) )
..addOption('use-existing-app', ..addOption('use-existing-app',
help: 'Connect to an already running instance via the given observatory URL. ' help: 'Connect to an already running instance via the given Dart VM Service URL. '
'If this option is given, the application will not be automatically started, ' 'If this option is given, the application will not be automatically started, '
'and it will only be stopped if "--no-keep-app-running" is explicitly set.', 'and it will only be stopped if "--no-keep-app-running" is explicitly set.',
valueHelp: 'url', valueHelp: 'url',

View file

@ -15,7 +15,7 @@ import '../vmservice.dart';
const String _kOut = 'out'; const String _kOut = 'out';
const String _kType = 'type'; const String _kType = 'type';
const String _kObservatoryUrl = 'observatory-url'; const String _kVmServiceUrl = 'vm-service-url';
const String _kDeviceType = 'device'; const String _kDeviceType = 'device';
const String _kSkiaType = 'skia'; const String _kSkiaType = 'skia';
const String _kRasterizerType = 'rasterizer'; const String _kRasterizerType = 'rasterizer';
@ -29,13 +29,13 @@ class ScreenshotCommand extends FlutterCommand {
help: 'Location to write the screenshot.', help: 'Location to write the screenshot.',
); );
argParser.addOption( argParser.addOption(
_kObservatoryUrl, _kVmServiceUrl,
aliases: <String>[ 'observatory-url' ], // for historical reasons aliases: <String>[ 'observatory-url' ], // for historical reasons
valueHelp: 'URI', valueHelp: 'URI',
help: 'The Observatory URL to which to connect.\n' help: 'The VM Service URL to which to connect.\n'
'This is required when "--$_kType" is "$_kSkiaType" or "$_kRasterizerType".\n' 'This is required when "--$_kType" is "$_kSkiaType" or "$_kRasterizerType".\n'
'To find the Observatory URL, use "flutter run" and look for ' 'To find the VM service URL, use "flutter run" and look for '
'"An Observatory ... is available at" in the output.', '"A Dart VM Service ... is available at" in the output.',
); );
argParser.addOption( argParser.addOption(
_kType, _kType,
@ -46,8 +46,8 @@ class ScreenshotCommand extends FlutterCommand {
_kDeviceType: "Delegate to the device's native screenshot capabilities. This " _kDeviceType: "Delegate to the device's native screenshot capabilities. This "
'screenshots the entire screen currently being displayed (including content ' 'screenshots the entire screen currently being displayed (including content '
'not rendered by Flutter, like the device status bar).', 'not rendered by Flutter, like the device status bar).',
_kSkiaType: 'Render the Flutter app as a Skia picture. Requires "--$_kObservatoryUrl".', _kSkiaType: 'Render the Flutter app as a Skia picture. Requires "--$_kVmServiceUrl".',
_kRasterizerType: 'Render the Flutter app using the rasterizer. Requires "--$_kObservatoryUrl."', _kRasterizerType: 'Render the Flutter app using the rasterizer. Requires "--$_kVmServiceUrl."',
}, },
defaultsTo: _kDeviceType, defaultsTo: _kDeviceType,
); );
@ -70,11 +70,11 @@ class ScreenshotCommand extends FlutterCommand {
Device? device; Device? device;
Future<void> _validateOptions(String? screenshotType, String? observatoryUrl) async { Future<void> _validateOptions(String? screenshotType, String? vmServiceUrl) async {
switch (screenshotType) { switch (screenshotType) {
case _kDeviceType: case _kDeviceType:
if (observatoryUrl != null) { if (vmServiceUrl != null) {
throwToolExit('Observatory URI cannot be provided for screenshot type $screenshotType'); throwToolExit('VM Service URI cannot be provided for screenshot type $screenshotType');
} }
device = await findTargetDevice(); device = await findTargetDevice();
if (device == null) { if (device == null) {
@ -85,18 +85,18 @@ class ScreenshotCommand extends FlutterCommand {
} }
break; break;
default: default:
if (observatoryUrl == null) { if (vmServiceUrl == null) {
throwToolExit('Observatory URI must be specified for screenshot type $screenshotType'); throwToolExit('VM Service URI must be specified for screenshot type $screenshotType');
} }
if (observatoryUrl.isEmpty || Uri.tryParse(observatoryUrl) == null) { if (vmServiceUrl.isEmpty || Uri.tryParse(vmServiceUrl) == null) {
throwToolExit('Observatory URI "$observatoryUrl" is invalid'); throwToolExit('VM Service URI "$vmServiceUrl" is invalid');
} }
} }
} }
@override @override
Future<FlutterCommandResult> verifyThenRunCommand(String? commandPath) async { Future<FlutterCommandResult> verifyThenRunCommand(String? commandPath) async {
await _validateOptions(stringArgDeprecated(_kType), stringArgDeprecated(_kObservatoryUrl)); await _validateOptions(stringArgDeprecated(_kType), stringArgDeprecated(_kVmServiceUrl));
return super.verifyThenRunCommand(commandPath); return super.verifyThenRunCommand(commandPath);
} }
@ -150,8 +150,8 @@ class ScreenshotCommand extends FlutterCommand {
} }
Future<bool> runSkia(File? outputFile) async { Future<bool> runSkia(File? outputFile) async {
final Uri observatoryUrl = Uri.parse(stringArgDeprecated(_kObservatoryUrl)!); final Uri vmServiceUrl = Uri.parse(stringArgDeprecated(_kVmServiceUrl)!);
final FlutterVmService vmService = await connectToVmService(observatoryUrl, logger: globals.logger); final FlutterVmService vmService = await connectToVmService(vmServiceUrl, logger: globals.logger);
final vm_service.Response? skp = await vmService.screenshotSkp(); final vm_service.Response? skp = await vmService.screenshotSkp();
if (skp == null) { if (skp == null) {
globals.printError( globals.printError(
@ -174,8 +174,8 @@ class ScreenshotCommand extends FlutterCommand {
} }
Future<bool> runRasterizer(File? outputFile) async { Future<bool> runRasterizer(File? outputFile) async {
final Uri observatoryUrl = Uri.parse(stringArgDeprecated(_kObservatoryUrl)!); final Uri vmServiceUrl = Uri.parse(stringArgDeprecated(_kVmServiceUrl)!);
final FlutterVmService vmService = await connectToVmService(observatoryUrl, logger: globals.logger); final FlutterVmService vmService = await connectToVmService(vmServiceUrl, logger: globals.logger);
final vm_service.Response? response = await vmService.screenshot(); final vm_service.Response? response = await vmService.screenshot();
if (response == null) { if (response == null) {
globals.printError( globals.printError(

View file

@ -464,7 +464,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
tags: tags, tags: tags,
excludeTags: excludeTags, excludeTags: excludeTags,
watcher: watcher, watcher: watcher,
enableObservatory: collector != null || startPaused || boolArgDeprecated('enable-vmservice'), enableVmService: collector != null || startPaused || boolArgDeprecated('enable-vmservice'),
ipv6: boolArgDeprecated('ipv6'), ipv6: boolArgDeprecated('ipv6'),
machine: machine, machine: machine,
updateGoldens: boolArgDeprecated('update-goldens'), updateGoldens: boolArgDeprecated('update-goldens'),

View file

@ -309,7 +309,7 @@ class CustomDeviceAppSession {
'purge-persistent-cache=true', 'purge-persistent-cache=true',
if (debuggingOptions.debuggingEnabled) ...<String>[ if (debuggingOptions.debuggingEnabled) ...<String>[
if (debuggingOptions.deviceVmServicePort != null) if (debuggingOptions.deviceVmServicePort != null)
'observatory-port=${debuggingOptions.deviceVmServicePort}', 'vm-service-port=${debuggingOptions.deviceVmServicePort}',
if (debuggingOptions.buildInfo.isDebug) ...<String>[ if (debuggingOptions.buildInfo.isDebug) ...<String>[
'enable-checked-mode=true', 'enable-checked-mode=true',
'verify-entry-points=true', 'verify-entry-points=true',
@ -374,7 +374,7 @@ class CustomDeviceAppSession {
assert(_process == null); assert(_process == null);
_process = process; _process = process;
final ProtocolDiscovery discovery = ProtocolDiscovery.observatory( final ProtocolDiscovery discovery = ProtocolDiscovery.vmService(
logReader, logReader,
portForwarder: _device._config.usesPortForwarding ? _device.portForwarder : null, portForwarder: _device._config.usesPortForwarding ? _device.portForwarder : null,
logger: _logger, logger: _logger,
@ -388,14 +388,14 @@ class CustomDeviceAppSession {
// in the same microtask AFAICT but this way we're on the safe side. // in the same microtask AFAICT but this way we're on the safe side.
logReader.listenToProcessOutput(process); logReader.listenToProcessOutput(process);
final Uri? observatoryUri = await discovery.uri; final Uri? vmServiceUri = await discovery.uri;
await discovery.cancel(); await discovery.cancel();
if (_device._config.usesPortForwarding) { if (_device._config.usesPortForwarding) {
_forwardedHostPort = observatoryUri?.port; _forwardedHostPort = vmServiceUri?.port;
} }
return LaunchResult.succeeded(observatoryUri: observatoryUri); return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
} }
void _maybeUnforwardPort() { void _maybeUnforwardPort() {

View file

@ -153,7 +153,7 @@ class FlutterTestDebugAdapter extends FlutterBaseDebugAdapter with TestAdapter {
/// Handles the test.processStarted event from Flutter that provides the VM Service URL. /// Handles the test.processStarted event from Flutter that provides the VM Service URL.
void _handleTestStartedProcess(Map<String, Object?> params) { void _handleTestStartedProcess(Map<String, Object?> params) {
final String? vmServiceUriString = params['observatoryUri'] as String?; final String? vmServiceUriString = params['vmServiceUri'] as String?;
// For no-debug mode, this event may be still sent so ignore it if we know // For no-debug mode, this event may be still sent so ignore it if we know
// we're not debugging, or its URI is null. // we're not debugging, or its URI is null.
if (!enableDebugger || vmServiceUriString == null) { if (!enableDebugger || vmServiceUriString == null) {

View file

@ -152,17 +152,17 @@ abstract class DesktopDevice extends Device {
if (debuggingOptions.buildInfo.isRelease == true) { if (debuggingOptions.buildInfo.isRelease == true) {
return LaunchResult.succeeded(); return LaunchResult.succeeded();
} }
final ProtocolDiscovery observatoryDiscovery = ProtocolDiscovery.observatory(_deviceLogReader, final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.vmService(_deviceLogReader,
devicePort: debuggingOptions.deviceVmServicePort, devicePort: debuggingOptions.deviceVmServicePort,
hostPort: debuggingOptions.hostVmServicePort, hostPort: debuggingOptions.hostVmServicePort,
ipv6: ipv6, ipv6: ipv6,
logger: _logger, logger: _logger,
); );
try { try {
final Uri? observatoryUri = await observatoryDiscovery.uri; final Uri? vmServiceUri = await vmServiceDiscovery.uri;
if (observatoryUri != null) { if (vmServiceUri != null) {
onAttached(package, buildInfo, process); onAttached(package, buildInfo, process);
return LaunchResult.succeeded(observatoryUri: observatoryUri); return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
} }
_logger.printError( _logger.printError(
'Error waiting for a debug connection: ' 'Error waiting for a debug connection: '
@ -171,7 +171,7 @@ abstract class DesktopDevice extends Device {
} on Exception catch (error) { } on Exception catch (error) {
_logger.printError('Error waiting for a debug connection: $error'); _logger.printError('Error waiting for a debug connection: $error');
} finally { } finally {
await observatoryDiscovery.cancel(); await vmServiceDiscovery.cancel();
} }
return LaunchResult.failed(); return LaunchResult.failed();
} }
@ -270,7 +270,7 @@ abstract class DesktopDevice extends Device {
// tool and the device, usually in debug or profile mode. // tool and the device, usually in debug or profile mode.
if (debuggingOptions.debuggingEnabled) { if (debuggingOptions.debuggingEnabled) {
if (debuggingOptions.deviceVmServicePort != null) { if (debuggingOptions.deviceVmServicePort != null) {
addFlag('observatory-port=${debuggingOptions.deviceVmServicePort}'); addFlag('vm-service-port=${debuggingOptions.deviceVmServicePort}');
} }
if (debuggingOptions.buildInfo.isDebug) { if (debuggingOptions.buildInfo.isDebug) {
addFlag('enable-checked-mode=true'); addFlag('enable-checked-mode=true');

View file

@ -933,7 +933,7 @@ class DebuggingOptions {
return <String>[ return <String>[
if (enableDartProfiling) '--enable-dart-profiling', if (enableDartProfiling) '--enable-dart-profiling',
if (disableServiceAuthCodes) '--disable-service-auth-codes', if (disableServiceAuthCodes) '--disable-service-auth-codes',
if (disablePortPublication) '--disable-observatory-publication', if (disablePortPublication) '--disable-vm-service-publication',
if (startPaused) '--start-paused', if (startPaused) '--start-paused',
// Wrap dart flags in quotes for physical devices // Wrap dart flags in quotes for physical devices
if (environmentType == EnvironmentType.physical && dartVmFlags.isNotEmpty) if (environmentType == EnvironmentType.physical && dartVmFlags.isNotEmpty)
@ -960,14 +960,14 @@ class DebuggingOptions {
if (platformArgs['trace-startup'] as bool? ?? false) '--trace-startup', if (platformArgs['trace-startup'] as bool? ?? false) '--trace-startup',
if (enableImpeller) '--enable-impeller', if (enableImpeller) '--enable-impeller',
if (environmentType == EnvironmentType.physical && deviceVmServicePort != null) if (environmentType == EnvironmentType.physical && deviceVmServicePort != null)
'--observatory-port=$deviceVmServicePort', '--vm-service-port=$deviceVmServicePort',
// The simulator "device" is actually on the host machine so no ports will be forwarded. // The simulator "device" is actually on the host machine so no ports will be forwarded.
// Use the suggested host port. // Use the suggested host port.
if (environmentType == EnvironmentType.simulator && hostVmServicePort != null) if (environmentType == EnvironmentType.simulator && hostVmServicePort != null)
'--observatory-port=$hostVmServicePort', '--vm-service-port=$hostVmServicePort',
// Tell the observatory to listen on all interfaces, don't restrict to the loopback. // Tell the VM service to listen on all interfaces, don't restrict to the loopback.
if (interfaceType == IOSDeviceConnectionInterface.network) if (interfaceType == IOSDeviceConnectionInterface.network)
'--observatory-host=${ipv6 ? '::0' : '0.0.0.0'}', '--vm-service-host=${ipv6 ? '::0' : '0.0.0.0'}',
]; ];
} }
@ -1066,21 +1066,24 @@ class DebuggingOptions {
} }
class LaunchResult { class LaunchResult {
LaunchResult.succeeded({ this.observatoryUri }) : started = true; LaunchResult.succeeded({ Uri? vmServiceUri, Uri? observatoryUri }) :
started = true,
vmServiceUri = vmServiceUri ?? observatoryUri;
LaunchResult.failed() LaunchResult.failed()
: started = false, : started = false,
observatoryUri = null; vmServiceUri = null;
bool get hasObservatory => observatoryUri != null; bool get hasVmService => vmServiceUri != null;
final bool started; final bool started;
final Uri? observatoryUri; final Uri? vmServiceUri;
@override @override
String toString() { String toString() {
final StringBuffer buf = StringBuffer('started=$started'); final StringBuffer buf = StringBuffer('started=$started');
if (observatoryUri != null) { if (vmServiceUri != null) {
buf.write(', observatory=$observatoryUri'); buf.write(', vmService=$vmServiceUri');
} }
return buf.toString(); return buf.toString();
} }
@ -1109,9 +1112,9 @@ abstract class DeviceLogReader {
/// Describes an app running on the device. /// Describes an app running on the device.
class DiscoveredApp { class DiscoveredApp {
DiscoveredApp(this.id, this.observatoryPort); DiscoveredApp(this.id, this.vmServicePort);
final String id; final String id;
final int observatoryPort; final int vmServicePort;
} }
// An empty device log reader // An empty device log reader

View file

@ -196,7 +196,7 @@ class FlutterDriverService extends DriverService {
throwToolExit('Application failed to start. Will not run test. Quitting.', exitCode: 1); throwToolExit('Application failed to start. Will not run test. Quitting.', exitCode: 1);
} }
return reuseApplication( return reuseApplication(
result.observatoryUri!, result.vmServiceUri!,
device, device,
debuggingOptions, debuggingOptions,
ipv6, ipv6,

View file

@ -52,11 +52,11 @@ Future<FlutterVmService> _kDefaultFuchsiaIsolateDiscoveryConnector(Uri uri) {
Future<void> _kDefaultDartDevelopmentServiceStarter( Future<void> _kDefaultDartDevelopmentServiceStarter(
Device device, Device device,
Uri observatoryUri, Uri vmServiceUri,
bool disableServiceAuthCodes, bool disableServiceAuthCodes,
) async { ) async {
await device.dds.startDartDevelopmentService( await device.dds.startDartDevelopmentService(
observatoryUri, vmServiceUri,
hostPort: 0, hostPort: 0,
ipv6: true, ipv6: true,
disableServiceAuthCodes: disableServiceAuthCodes, disableServiceAuthCodes: disableServiceAuthCodes,
@ -458,12 +458,12 @@ class FuchsiaDevice extends Device {
globals.printTrace( globals.printTrace(
'App started in a non-release mode. Setting up vmservice connection.'); 'App started in a non-release mode. Setting up vmservice connection.');
// In a debug or profile build, try to find the observatory uri. // In a debug or profile build, try to find the vmService uri.
final FuchsiaIsolateDiscoveryProtocol discovery = final FuchsiaIsolateDiscoveryProtocol discovery =
getIsolateDiscoveryProtocol(appName); getIsolateDiscoveryProtocol(appName);
try { try {
final Uri observatoryUri = await discovery.uri; final Uri vmServiceUri = await discovery.uri;
return LaunchResult.succeeded(observatoryUri: observatoryUri); return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
} finally { } finally {
discovery.dispose(); discovery.dispose();
} }
@ -620,7 +620,7 @@ class FuchsiaDevice extends Device {
return addr; return addr;
}(); }();
/// List the ports currently running a dart observatory. /// List the ports currently running a dart vmService.
Future<List<int>> servicePorts() async { Future<List<int>> servicePorts() async {
const String findCommand = 'find /hub -name vmservice-port'; const String findCommand = 'find /hub -name vmservice-port';
final RunResult findResult = await shell(findCommand); final RunResult findResult = await shell(findCommand);

View file

@ -284,5 +284,4 @@ PreRunValidator get preRunValidator => context.get<PreRunValidator>() ?? const N
const String kDefaultFrameworkChannel = 'master'; const String kDefaultFrameworkChannel = 'master';
// Used to build RegExp instances which can detect the VM service message. // 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(r'The Dart VM service is listening on ((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)');
final RegExp kVMServiceMessageRegExp = RegExp(kServicePrefixRegExp + r' listening on ((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)');

View file

@ -357,10 +357,10 @@ class IOSDevice extends Device {
'Installing and launching...', 'Installing and launching...',
); );
try { try {
ProtocolDiscovery? observatoryDiscovery; ProtocolDiscovery? vmServiceDiscovery;
int installationResult = 1; int installationResult = 1;
if (debuggingOptions.debuggingEnabled) { if (debuggingOptions.debuggingEnabled) {
_logger.printTrace('Debugging is enabled, connecting to observatory'); _logger.printTrace('Debugging is enabled, connecting to vmService');
final DeviceLogReader deviceLogReader = getLogReader(app: package); final DeviceLogReader deviceLogReader = getLogReader(app: package);
// If the device supports syslog reading, prefer launching the app without // If the device supports syslog reading, prefer launching the app without
@ -378,8 +378,8 @@ class IOSDevice extends Device {
deviceLogReader.debuggerStream = iosDeployDebugger; deviceLogReader.debuggerStream = iosDeployDebugger;
} }
} }
// Don't port forward if debugging with a network device. // Don't port foward if debugging with a network device.
observatoryDiscovery = ProtocolDiscovery.observatory( vmServiceDiscovery = ProtocolDiscovery.vmService(
deviceLogReader, deviceLogReader,
portForwarder: interfaceType == IOSDeviceConnectionInterface.network ? null : portForwarder, portForwarder: interfaceType == IOSDeviceConnectionInterface.network ? null : portForwarder,
hostPort: debuggingOptions.hostVmServicePort, hostPort: debuggingOptions.hostVmServicePort,
@ -435,7 +435,7 @@ class IOSDevice extends Device {
Uri? localUri; Uri? localUri;
if (interfaceType == IOSDeviceConnectionInterface.network) { if (interfaceType == IOSDeviceConnectionInterface.network) {
// Wait for Dart VM Service to start up. // Wait for Dart VM Service to start up.
final Uri? serviceURL = await observatoryDiscovery?.uri; final Uri? serviceURL = await vmServiceDiscovery?.uri;
if (serviceURL == null) { if (serviceURL == null) {
await iosDeployDebugger?.stopAndDumpBacktrace(); await iosDeployDebugger?.stopAndDumpBacktrace();
return LaunchResult.failed(); return LaunchResult.failed();
@ -463,14 +463,14 @@ class IOSDevice extends Device {
mDNSLookupTimer.cancel(); mDNSLookupTimer.cancel();
} else { } else {
localUri = await observatoryDiscovery?.uri; localUri = await vmServiceDiscovery?.uri;
} }
timer.cancel(); timer.cancel();
if (localUri == null) { if (localUri == null) {
await iosDeployDebugger?.stopAndDumpBacktrace(); await iosDeployDebugger?.stopAndDumpBacktrace();
return LaunchResult.failed(); return LaunchResult.failed();
} }
return LaunchResult.succeeded(observatoryUri: localUri); return LaunchResult.succeeded(vmServiceUri: localUri);
} on ProcessException catch (e) { } on ProcessException catch (e) {
await iosDeployDebugger?.stopAndDumpBacktrace(); await iosDeployDebugger?.stopAndDumpBacktrace();
_logger.printError(e.message); _logger.printError(e.message);

View file

@ -450,9 +450,9 @@ class IOSSimulator extends Device {
platformArgs, platformArgs,
); );
ProtocolDiscovery? observatoryDiscovery; ProtocolDiscovery? vmServiceDiscovery;
if (debuggingOptions.debuggingEnabled) { if (debuggingOptions.debuggingEnabled) {
observatoryDiscovery = ProtocolDiscovery.observatory( vmServiceDiscovery = ProtocolDiscovery.vmService(
getLogReader(app: package), getLogReader(app: package),
ipv6: ipv6, ipv6: ipv6,
hostPort: debuggingOptions.hostVmServicePort, hostPort: debuggingOptions.hostVmServicePort,
@ -485,13 +485,13 @@ class IOSSimulator extends Device {
} }
// Wait for the service protocol port here. This will complete once the // Wait for the service protocol port here. This will complete once the
// device has printed "Observatory is listening on..." // device has printed "Dart VM Service is listening on..."
globals.printTrace('Waiting for observatory port to be available...'); globals.printTrace('Waiting for VM Service port to be available...');
try { try {
final Uri? deviceUri = await observatoryDiscovery?.uri; final Uri? deviceUri = await vmServiceDiscovery?.uri;
if (deviceUri != null) { if (deviceUri != null) {
return LaunchResult.succeeded(observatoryUri: deviceUri); return LaunchResult.succeeded(vmServiceUri: deviceUri);
} }
globals.printError( globals.printError(
'Error waiting for a debug connection: ' 'Error waiting for a debug connection: '
@ -500,7 +500,7 @@ class IOSSimulator extends Device {
} on Exception catch (error) { } on Exception catch (error) {
globals.printError('Error waiting for a debug connection: $error'); globals.printError('Error waiting for a debug connection: $error');
} finally { } finally {
await observatoryDiscovery?.cancel(); await vmServiceDiscovery?.cancel();
} }
return LaunchResult.failed(); return LaunchResult.failed();
} }

View file

@ -29,7 +29,7 @@ abstract class MacOSApp extends ApplicationPackage {
/// `applicationBinary` is the path to the framework directory created by an /// `applicationBinary` is the path to the framework directory created by an
/// Xcode build. By default, this is located under /// Xcode build. By default, this is located under
/// "~/Library/Developer/Xcode/DerivedData/" and contains an executable /// "~/Library/Developer/Xcode/DerivedData/" and contains an executable
/// which is expected to start the application and send the observatory /// which is expected to start the application and send the vmService
/// port over stdout. /// port over stdout.
static MacOSApp? fromPrebuiltApp(FileSystemEntity applicationBinary) { static MacOSApp? fromPrebuiltApp(FileSystemEntity applicationBinary) {
final _BundleInfo? bundleInfo = _executableFromBundle(applicationBinary); final _BundleInfo? bundleInfo = _executableFromBundle(applicationBinary);

View file

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:multicast_dns/multicast_dns.dart'; import 'package:multicast_dns/multicast_dns.dart';
@ -39,7 +41,7 @@ class MDnsVmServiceDiscovery {
final Usage _flutterUsage; final Usage _flutterUsage;
@visibleForTesting @visibleForTesting
static const String dartVmServiceName = '_dartobservatory._tcp.local'; static const String dartVmServiceName = '_dartVmService._tcp.local';
static MDnsVmServiceDiscovery? get instance => context.get<MDnsVmServiceDiscovery>(); static MDnsVmServiceDiscovery? get instance => context.get<MDnsVmServiceDiscovery>();

View file

@ -139,16 +139,16 @@ class PreviewDevice extends Device {
_process = process; _process = process;
_logReader.initializeProcess(process); _logReader.initializeProcess(process);
final ProtocolDiscovery observatoryDiscovery = ProtocolDiscovery.observatory(_logReader, final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.vmService(_logReader,
devicePort: debuggingOptions.deviceVmServicePort, devicePort: debuggingOptions.deviceVmServicePort,
hostPort: debuggingOptions.hostVmServicePort, hostPort: debuggingOptions.hostVmServicePort,
ipv6: ipv6, ipv6: ipv6,
logger: _logger, logger: _logger,
); );
try { try {
final Uri? observatoryUri = await observatoryDiscovery.uri; final Uri? vmServiceUri = await vmServiceDiscovery.uri;
if (observatoryUri != null) { if (vmServiceUri != null) {
return LaunchResult.succeeded(observatoryUri: observatoryUri); return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
} }
_logger.printError( _logger.printError(
'Error waiting for a debug connection: ' 'Error waiting for a debug connection: '
@ -157,7 +157,7 @@ class PreviewDevice extends Device {
} on Exception catch (error) { } on Exception catch (error) {
_logger.printError('Error waiting for a debug connection: $error'); _logger.printError('Error waiting for a debug connection: $error');
} finally { } finally {
await observatoryDiscovery.cancel(); await vmServiceDiscovery.cancel();
} }
return LaunchResult.failed(); return LaunchResult.failed();
} }

View file

@ -29,7 +29,7 @@ class ProtocolDiscovery {
); );
} }
factory ProtocolDiscovery.observatory( factory ProtocolDiscovery.vmService(
DeviceLogReader logReader, { DeviceLogReader logReader, {
DevicePortForwarder? portForwarder, DevicePortForwarder? portForwarder,
Duration? throttleDuration, Duration? throttleDuration,
@ -38,10 +38,10 @@ class ProtocolDiscovery {
required bool ipv6, required bool ipv6,
required Logger logger, required Logger logger,
}) { }) {
const String kObservatoryService = 'Observatory'; const String kVmServiceService = 'VM Service';
return ProtocolDiscovery._( return ProtocolDiscovery._(
logReader, logReader,
kObservatoryService, kVmServiceService,
portForwarder: portForwarder, portForwarder: portForwarder,
throttleDuration: throttleDuration ?? const Duration(milliseconds: 200), throttleDuration: throttleDuration ?? const Duration(milliseconds: 200),
hostPort: hostPort, hostPort: hostPort,
@ -59,7 +59,7 @@ class ProtocolDiscovery {
final bool ipv6; final bool ipv6;
final Logger _logger; final Logger _logger;
/// The time to wait before forwarding a new observatory URIs from [logReader]. /// The time to wait before forwarding a new VM Service URIs from [logReader].
final Duration throttleDuration; final Duration throttleDuration;
StreamSubscription<String>? _deviceLogSubscription; StreamSubscription<String>? _deviceLogSubscription;
@ -81,12 +81,12 @@ class ProtocolDiscovery {
/// The discovered service URLs. /// The discovered service URLs.
/// ///
/// When a new observatory URL: is available in [logReader], /// When a new VM Service URL: is available in [logReader],
/// the URLs are forwarded at most once every [throttleDuration]. /// the URLs are forwarded at most once every [throttleDuration].
/// Returns when no event has been observed for [throttleTimeout]. /// Returns when no event has been observed for [throttleTimeout].
/// ///
/// Port forwarding is only attempted when this is invoked, /// Port forwarding is only attempted when this is invoked,
/// for each observatory URL in the stream. /// for each VM Service URL in the stream.
Stream<Uri> get uris { Stream<Uri> get uris {
final Stream<Uri> uriStream = _uriStreamController.stream final Stream<Uri> uriStream = _uriStreamController.stream
.transform(_throttle<Uri>( .transform(_throttle<Uri>(
@ -107,7 +107,7 @@ class ProtocolDiscovery {
return globals.kVMServiceMessageRegExp.firstMatch(line); return globals.kVMServiceMessageRegExp.firstMatch(line);
} }
Uri? _getObservatoryUri(String line) { Uri? _getVmServiceUri(String line) {
final Match? match = _getPatternMatch(line); final Match? match = _getPatternMatch(line);
if (match != null) { if (match != null) {
return Uri.parse(match[1]!); return Uri.parse(match[1]!);
@ -118,7 +118,7 @@ class ProtocolDiscovery {
void _handleLine(String line) { void _handleLine(String line) {
Uri? uri; Uri? uri;
try { try {
uri = _getObservatoryUri(line); uri = _getVmServiceUri(line);
} on FormatException catch (error, stackTrace) { } on FormatException catch (error, stackTrace) {
_uriStreamController.addError(error, stackTrace); _uriStreamController.addError(error, stackTrace);
} }
@ -126,7 +126,7 @@ class ProtocolDiscovery {
return; return;
} }
if (devicePort != null && uri.port != devicePort) { if (devicePort != null && uri.port != devicePort) {
_logger.printTrace('skipping potential observatory $uri due to device port mismatch'); _logger.printTrace('skipping potential VM Service $uri due to device port mismatch');
return; return;
} }
_uriStreamController.add(uri); _uriStreamController.add(uri);

View file

@ -245,12 +245,12 @@ class ProxiedDevice extends Device {
'userIdentifier': userIdentifier, 'userIdentifier': userIdentifier,
})); }));
final bool started = _cast<bool>(result['started']); final bool started = _cast<bool>(result['started']);
final String? observatoryUriStr = _cast<String?>(result['observatoryUri']); final String? vmServiceUriStr = _cast<String?>(result['vmServiceUri']);
final Uri? observatoryUri = observatoryUriStr == null ? null : Uri.parse(observatoryUriStr); final Uri? vmServiceUri = vmServiceUriStr == null ? null : Uri.parse(vmServiceUriStr);
if (started) { if (started) {
if (observatoryUri != null) { if (vmServiceUri != null) {
final int hostPort = await proxiedPortForwarder.forward(observatoryUri.port); final int hostPort = await proxiedPortForwarder.forward(vmServiceUri.port);
return LaunchResult.succeeded(observatoryUri: observatoryUri.replace(port: hostPort)); return LaunchResult.succeeded(vmServiceUri: vmServiceUri.replace(port: hostPort));
} else { } else {
return LaunchResult.succeeded(); return LaunchResult.succeeded();
} }

View file

@ -114,7 +114,7 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
if (_residentRunner.reportedDebuggers) { if (_residentRunner.reportedDebuggers) {
// Since the DevTools only just became available, we haven't had a chance to // Since the DevTools only just became available, we haven't had a chance to
// report their URLs yet. Do so now. // report their URLs yet. Do so now.
_residentRunner.printDebuggerList(includeObservatory: false); _residentRunner.printDebuggerList(includeVmService: false);
} }
} }

View file

@ -224,21 +224,21 @@ class FlutterDevice {
final DevelopmentSceneImporter? developmentSceneImporter; final DevelopmentSceneImporter? developmentSceneImporter;
DevFSWriter? devFSWriter; DevFSWriter? devFSWriter;
Stream<Uri?>? observatoryUris; Stream<Uri?>? vmServiceUris;
FlutterVmService? vmService; FlutterVmService? vmService;
DevFS? devFS; DevFS? devFS;
ApplicationPackage? package; ApplicationPackage? package;
// ignore: cancel_subscriptions // ignore: cancel_subscriptions
StreamSubscription<String>? _loggingSubscription; StreamSubscription<String>? _loggingSubscription;
bool? _isListeningForObservatoryUri; bool? _isListeningForVmServiceUri;
/// Whether the stream [observatoryUris] is still open. /// Whether the stream [vmServiceUris] is still open.
bool get isWaitingForObservatory => _isListeningForObservatoryUri ?? false; bool get isWaitingForVmService => _isListeningForVmServiceUri ?? false;
/// If the [reloadSources] parameter is not null the 'reloadSources' service /// If the [reloadSources] parameter is not null the 'reloadSources' service
/// will be registered. /// will be registered.
/// The 'reloadSources' service can be used by other Service Protocol clients /// The 'reloadSources' service can be used by other Service Protocol clients
/// connected to the VM (e.g. Observatory) to request a reload of the source /// connected to the VM (e.g. VmService) to request a reload of the source
/// code of the running application (a.k.a. HotReload). /// code of the running application (a.k.a. HotReload).
/// The 'compileExpression' service can be used to compile user-provided /// The 'compileExpression' service can be used to compile user-provided
/// expressions requested during debugging of the application. /// expressions requested during debugging of the application.
@ -262,29 +262,29 @@ class FlutterDevice {
late StreamSubscription<void> subscription; late StreamSubscription<void> subscription;
bool isWaitingForVm = false; bool isWaitingForVm = false;
subscription = observatoryUris!.listen((Uri? observatoryUri) async { subscription = vmServiceUris!.listen((Uri? vmServiceUri) async {
// FYI, this message is used as a sentinel in tests. // FYI, this message is used as a sentinel in tests.
globals.printTrace('Connecting to service protocol: $observatoryUri'); globals.printTrace('Connecting to service protocol: $vmServiceUri');
isWaitingForVm = true; isWaitingForVm = true;
bool existingDds = false; bool existingDds = false;
FlutterVmService? service; FlutterVmService? service;
if (enableDds) { if (enableDds) {
void handleError(Exception e, StackTrace st) { void handleError(Exception e, StackTrace st) {
globals.printTrace('Fail to connect to service protocol: $observatoryUri: $e'); globals.printTrace('Fail to connect to service protocol: $vmServiceUri: $e');
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.completeError('failed to connect to $observatoryUri', st); completer.completeError('failed to connect to $vmServiceUri', st);
} }
} }
// First check if the VM service is actually listening on observatoryUri as // First check if the VM service is actually listening on vmServiceUri as
// this may not be the case when scraping logcat for URIs. If this URI is // this may not be the case when scraping logcat for URIs. If this URI is
// from an old application instance, we shouldn't try and start DDS. // from an old application instance, we shouldn't try and start DDS.
try { try {
service = await connectToVmService(observatoryUri!, logger: globals.logger); service = await connectToVmService(vmServiceUri!, logger: globals.logger);
await service.dispose(); await service.dispose();
} on Exception catch (exception) { } on Exception catch (exception) {
globals.printTrace('Fail to connect to service protocol: $observatoryUri: $exception'); globals.printTrace('Fail to connect to service protocol: $vmServiceUri: $exception');
if (!completer.isCompleted && !_isListeningForObservatoryUri!) { if (!completer.isCompleted && !_isListeningForVmServiceUri!) {
completer.completeError('failed to connect to $observatoryUri'); completer.completeError('failed to connect to $vmServiceUri');
} }
return; return;
} }
@ -294,7 +294,7 @@ class FlutterDevice {
// attaching to a VM service with existing clients, etc.). // attaching to a VM service with existing clients, etc.).
try { try {
await device!.dds.startDartDevelopmentService( await device!.dds.startDartDevelopmentService(
observatoryUri, vmServiceUri,
hostPort: ddsPort, hostPort: ddsPort,
ipv6: ipv6, ipv6: ipv6,
disableServiceAuthCodes: disableServiceAuthCodes, disableServiceAuthCodes: disableServiceAuthCodes,
@ -324,7 +324,7 @@ class FlutterDevice {
service = await Future.any<dynamic>( service = await Future.any<dynamic>(
<Future<dynamic>>[ <Future<dynamic>>[
connectToVmService( connectToVmService(
enableDds ? (device!.dds.uri ?? observatoryUri!): observatoryUri!, enableDds ? (device!.dds.uri ?? vmServiceUri!): vmServiceUri!,
reloadSources: reloadSources, reloadSources: reloadSources,
restart: restart, restart: restart,
compileExpression: compileExpression, compileExpression: compileExpression,
@ -338,30 +338,30 @@ class FlutterDevice {
] ]
) as FlutterVmService?; ) as FlutterVmService?;
} on Exception catch (exception) { } on Exception catch (exception) {
globals.printTrace('Fail to connect to service protocol: $observatoryUri: $exception'); globals.printTrace('Fail to connect to service protocol: $vmServiceUri: $exception');
if (!completer.isCompleted && !_isListeningForObservatoryUri!) { if (!completer.isCompleted && !_isListeningForVmServiceUri!) {
completer.completeError('failed to connect to $observatoryUri'); completer.completeError('failed to connect to $vmServiceUri');
} }
return; return;
} }
if (completer.isCompleted) { if (completer.isCompleted) {
return; return;
} }
globals.printTrace('Successfully connected to service protocol: $observatoryUri'); globals.printTrace('Successfully connected to service protocol: $vmServiceUri');
vmService = service; vmService = service;
(await device!.getLogReader(app: package)).connectedVMService = vmService; (await device!.getLogReader(app: package)).connectedVMService = vmService;
completer.complete(); completer.complete();
await subscription.cancel(); await subscription.cancel();
}, onError: (dynamic error) { }, onError: (dynamic error) {
globals.printTrace('Fail to handle observatory URI: $error'); globals.printTrace('Fail to handle VM Service URI: $error');
}, onDone: () { }, onDone: () {
_isListeningForObservatoryUri = false; _isListeningForVmServiceUri = false;
if (!completer.isCompleted && !isWaitingForVm) { if (!completer.isCompleted && !isWaitingForVm) {
completer.completeError(Exception('connection to device ended too early')); completer.completeError(Exception('connection to device ended too early'));
} }
}); });
_isListeningForObservatoryUri = true; _isListeningForVmServiceUri = true;
return completer.future; return completer.future;
} }
@ -471,12 +471,12 @@ class FlutterDevice {
await stopEchoingDeviceLog(); await stopEchoingDeviceLog();
return 2; return 2;
} }
if (result.hasObservatory) { if (result.hasVmService) {
observatoryUris = Stream<Uri?> vmServiceUris = Stream<Uri?>
.value(result.observatoryUri) .value(result.vmServiceUri)
.asBroadcastStream(); .asBroadcastStream();
} else { } else {
observatoryUris = const Stream<Uri> vmServiceUris = const Stream<Uri>
.empty() .empty()
.asBroadcastStream(); .asBroadcastStream();
} }
@ -536,12 +536,12 @@ class FlutterDevice {
await stopEchoingDeviceLog(); await stopEchoingDeviceLog();
return 2; return 2;
} }
if (result.hasObservatory) { if (result.hasVmService) {
observatoryUris = Stream<Uri?> vmServiceUris = Stream<Uri?>
.value(result.observatoryUri) .value(result.vmServiceUri)
.asBroadcastStream(); .asBroadcastStream();
} else { } else {
observatoryUris = const Stream<Uri> vmServiceUris = const Stream<Uri>
.empty() .empty()
.asBroadcastStream(); .asBroadcastStream();
} }
@ -1131,10 +1131,10 @@ abstract class ResidentRunner extends ResidentHandlers {
@override @override
bool hotMode; bool hotMode;
/// Returns true if every device is streaming observatory URIs. /// Returns true if every device is streaming vmService URIs.
bool get isWaitingForObservatory { bool get isWaitingForVmService {
return flutterDevices.every((FlutterDevice? device) { return flutterDevices.every((FlutterDevice? device) {
return device!.isWaitingForObservatory; return device!.isWaitingForVmService;
}); });
} }
@ -1478,7 +1478,7 @@ abstract class ResidentRunner extends ResidentHandlers {
bool get reportedDebuggers => _reportedDebuggers; bool get reportedDebuggers => _reportedDebuggers;
bool _reportedDebuggers = false; bool _reportedDebuggers = false;
void printDebuggerList({ bool includeObservatory = true, bool includeDevtools = true }) { void printDebuggerList({ bool includeVmService = true, bool includeDevtools = true }) {
final DevToolsServerAddress? devToolsServerAddress = residentDevtoolsHandler!.activeDevToolsServer; final DevToolsServerAddress? devToolsServerAddress = residentDevtoolsHandler!.activeDevToolsServer;
if (!residentDevtoolsHandler!.readyToAnnounce) { if (!residentDevtoolsHandler!.readyToAnnounce) {
includeDevtools = false; includeDevtools = false;
@ -1488,10 +1488,10 @@ abstract class ResidentRunner extends ResidentHandlers {
if (device!.vmService == null) { if (device!.vmService == null) {
continue; continue;
} }
if (includeObservatory) { if (includeVmService) {
// Caution: This log line is parsed by device lab tests. // Caution: This log line is parsed by device lab tests.
globals.printStatus( globals.printStatus(
'An Observatory debugger and profiler on ${device.device!.name} is available at: ' 'A Dart VM Service on ${device.device!.name} is available at: '
'${device.vmService!.httpAddress}', '${device.vmService!.httpAddress}',
); );
} }

View file

@ -69,7 +69,7 @@ class ColdRunner extends ResidentRunner {
return 1; return 1;
} }
// Connect to observatory. // Connect to the VM Service.
if (debuggingEnabled) { if (debuggingEnabled) {
try { try {
await connectToServiceProtocol(allowExistingDdsInstance: false); await connectToServiceProtocol(allowExistingDdsInstance: false);
@ -93,7 +93,7 @@ class ColdRunner extends ResidentRunner {
} }
} }
if (flutterDevices.first.observatoryUris != null) { if (flutterDevices.first.vmServiceUris != null) {
// For now, only support one debugger connection. // For now, only support one debugger connection.
connectionInfoCompleter?.complete(DebugConnectionInfo( connectionInfoCompleter?.complete(DebugConnectionInfo(
httpUri: flutterDevices.first.vmService!.httpAddress, httpUri: flutterDevices.first.vmService!.httpAddress,

View file

@ -139,7 +139,10 @@ abstract class FlutterCommand extends Command<void> {
/// Will be `null` until the top-most command has begun execution. /// Will be `null` until the top-most command has begun execution.
static FlutterCommand? get current => context.get<FlutterCommand>(); static FlutterCommand? get current => context.get<FlutterCommand>();
/// The option name for a custom observatory port. /// The option name for a custom VM Service port.
static const String vmServicePortOption = 'vm-service-port';
/// The option name for a custom VM Service port.
static const String observatoryPortOption = 'observatory-port'; static const String observatoryPortOption = 'observatory-port';
/// The option name for a custom DevTools server address. /// The option name for a custom DevTools server address.
@ -379,14 +382,22 @@ abstract class FlutterCommand extends Command<void> {
); );
} }
/// Adds options for connecting to the Dart VM observatory port. /// Adds options for connecting to the Dart VM Service port.
void usesPortOptions({ required bool verboseHelp }) { void usesPortOptions({ required bool verboseHelp }) {
argParser.addOption(observatoryPortOption, argParser.addOption(vmServicePortOption,
help: '(deprecated; use host-vmservice-port instead) ' help: '(deprecated; use host-vmservice-port instead) '
'Listen to the given port for an observatory debugger connection.\n' 'Listen to the given port for a Dart VM Service connection.\n'
'Specifying port 0 (the default) will find a random free port.\n ' 'Specifying port 0 (the default) will find a random free port.\n '
'if the Dart Development Service (DDS) is enabled, this will not be the port ' 'if the Dart Development Service (DDS) is enabled, this will not be the port '
'of the Observatory instance advertised on the command line.', 'of the VmService instance advertised on the command line.',
hide: !verboseHelp,
);
argParser.addOption(observatoryPortOption,
help: '(deprecated; use host-vmservice-port instead) '
'Listen to the given port for a Dart VM Service connection.\n'
'Specifying port 0 (the default) will find a random free port.\n '
'if the Dart Development Service (DDS) is enabled, this will not be the port '
'of the VmService instance advertised on the command line.',
hide: !verboseHelp, hide: !verboseHelp,
); );
argParser.addOption('device-vmservice-port', argParser.addOption('device-vmservice-port',
@ -490,19 +501,21 @@ abstract class FlutterCommand extends Command<void> {
return ddsEnabled; return ddsEnabled;
}(); }();
bool get _hostVmServicePortProvided => (argResults?.wasParsed('observatory-port') ?? false) bool get _hostVmServicePortProvided => (argResults?.wasParsed(vmServicePortOption) ?? false)
|| (argResults?.wasParsed(observatoryPortOption) ?? false)
|| (argResults?.wasParsed('host-vmservice-port') ?? false); || (argResults?.wasParsed('host-vmservice-port') ?? false);
int _tryParseHostVmservicePort() { int _tryParseHostVmservicePort() {
final String? observatoryPort = stringArgDeprecated('observatory-port'); final String? vmServicePort = stringArgDeprecated(vmServicePortOption) ??
stringArgDeprecated(observatoryPortOption);
final String? hostPort = stringArgDeprecated('host-vmservice-port'); final String? hostPort = stringArgDeprecated('host-vmservice-port');
if (observatoryPort == null && hostPort == null) { if (vmServicePort == null && hostPort == null) {
throwToolExit('Invalid port for `--observatory-port/--host-vmservice-port`'); throwToolExit('Invalid port for `--vm-service-port/--host-vmservice-port`');
} }
try { try {
return int.parse((observatoryPort ?? hostPort)!); return int.parse((vmServicePort ?? hostPort)!);
} on FormatException catch (error) { } on FormatException catch (error) {
throwToolExit('Invalid port for `--observatory-port/--host-vmservice-port`: $error'); throwToolExit('Invalid port for `--vm-service-port/--host-vmservice-port`: $error');
} }
} }
@ -528,10 +541,10 @@ abstract class FlutterCommand extends Command<void> {
return null; return null;
} }
/// Gets the vmservice port provided to in the 'observatory-port' or /// Gets the vmservice port provided to in the 'vm-service-port' or
/// 'host-vmservice-port option. /// 'host-vmservice-port option.
/// ///
/// Only one of "host-vmservice-port" and "observatory-port" may be /// Only one of "host-vmservice-port" and "vm-service-port" may be
/// specified. /// specified.
/// ///
/// If no port is set, returns null. /// If no port is set, returns null.
@ -539,9 +552,10 @@ abstract class FlutterCommand extends Command<void> {
if (!_usesPortOption || !_hostVmServicePortProvided) { if (!_usesPortOption || !_hostVmServicePortProvided) {
return null; return null;
} }
if ((argResults?.wasParsed('observatory-port') ?? false) if ((argResults?.wasParsed(vmServicePortOption) ?? false)
&& (argResults?.wasParsed(observatoryPortOption) ?? false)
&& (argResults?.wasParsed('host-vmservice-port') ?? false)) { && (argResults?.wasParsed('host-vmservice-port') ?? false)) {
throwToolExit('Only one of "--observatory-port" and ' throwToolExit('Only one of "--vm-service-port" and '
'"--host-vmservice-port" may be specified.'); '"--host-vmservice-port" may be specified.');
} }
// If DDS is enabled and no explicit DDS port is provided, use the // If DDS is enabled and no explicit DDS port is provided, use the

View file

@ -100,18 +100,18 @@ class CoverageCollector extends TestWatcher {
/// has been run to completion so that all coverage data has been recorded. /// has been run to completion so that all coverage data has been recorded.
/// ///
/// The returned [Future] completes when the coverage is collected. /// The returned [Future] completes when the coverage is collected.
Future<void> collectCoverageIsolate(Uri observatoryUri) async { Future<void> collectCoverageIsolate(Uri vmServiceUri) async {
_logMessage('collecting coverage data from $observatoryUri...'); _logMessage('collecting coverage data from $vmServiceUri...');
final Map<String, dynamic> data = await collect( final Map<String, dynamic> data = await collect(
observatoryUri, libraryNames, branchCoverage: branchCoverage); vmServiceUri, libraryNames, branchCoverage: branchCoverage);
_logMessage('($observatoryUri): collected coverage data; merging...'); _logMessage('($vmServiceUri): collected coverage data; merging...');
_addHitmap(await coverage.HitMap.parseJson( _addHitmap(await coverage.HitMap.parseJson(
data['coverage'] as List<Map<String, dynamic>>, data['coverage'] as List<Map<String, dynamic>>,
packagePath: packageDirectory, packagePath: packageDirectory,
checkIgnoredLines: true, checkIgnoredLines: true,
)); ));
_logMessage('($observatoryUri): done merging coverage data into global coverage map.'); _logMessage('($vmServiceUri): done merging coverage data into global coverage map.');
} }
/// Collects coverage for the given [Process] using the given `port`. /// Collects coverage for the given [Process] using the given `port`.
@ -141,11 +141,11 @@ class CoverageCollector extends TestWatcher {
} }
); );
final Future<void> collectionComplete = testDevice.observatoryUri final Future<void> collectionComplete = testDevice.vmServiceUri
.then((Uri? observatoryUri) { .then((Uri? vmServiceUri) {
_logMessage('collecting coverage data from $testDevice at $observatoryUri...'); _logMessage('collecting coverage data from $testDevice at $vmServiceUri...');
return collect( return collect(
observatoryUri!, libraryNames, serviceOverride: serviceOverride, vmServiceUri!, libraryNames, serviceOverride: serviceOverride,
branchCoverage: branchCoverage) branchCoverage: branchCoverage)
.then<void>((Map<String, dynamic> result) { .then<void>((Map<String, dynamic> result) {
_logMessage('Collected coverage data.'); _logMessage('Collected coverage data.');

View file

@ -17,10 +17,15 @@ class EventPrinter extends TestWatcher {
final TestWatcher? _parent; final TestWatcher? _parent;
@override @override
void handleStartedDevice(Uri? observatoryUri) { void handleStartedDevice(Uri? vmServiceUri) {
_sendEvent('test.startedProcess', _sendEvent('test.startedProcess',
<String, dynamic>{'observatoryUri': observatoryUri?.toString()}); <String, dynamic>{
_parent?.handleStartedDevice(observatoryUri); 'vmServiceUri': vmServiceUri?.toString(),
// TODO(bkonyi): remove references to Observatory
// See https://github.com/flutter/flutter/issues/121271
'observatoryUri': vmServiceUri?.toString()
});
_parent?.handleStartedDevice(vmServiceUri);
} }
@override @override

View file

@ -34,7 +34,7 @@ import 'test_time_recorder.dart';
import 'watcher.dart'; import 'watcher.dart';
/// The address at which our WebSocket server resides and at which the sky_shell /// The address at which our WebSocket server resides and at which the sky_shell
/// processes will host the Observatory server. /// processes will host the VmService server.
final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType, InternetAddress>{ final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType, InternetAddress>{
InternetAddressType.IPv4: InternetAddress.loopbackIPv4, InternetAddressType.IPv4: InternetAddress.loopbackIPv4,
InternetAddressType.IPv6: InternetAddress.loopbackIPv6, InternetAddressType.IPv6: InternetAddress.loopbackIPv6,
@ -46,13 +46,15 @@ typedef PlatformPluginRegistration = void Function(FlutterPlatform platform);
/// ///
/// On systems where each [FlutterPlatform] is only used to run one test suite /// On systems where each [FlutterPlatform] is only used to run one test suite
/// (that is, one Dart file with a `*_test.dart` file name and a single `void /// (that is, one Dart file with a `*_test.dart` file name and a single `void
/// main()`), you can set an observatory port explicitly. /// main()`), you can set a VM Service port explicitly.
FlutterPlatform installHook({ FlutterPlatform installHook({
TestWrapper testWrapper = const TestWrapper(), TestWrapper testWrapper = const TestWrapper(),
required String shellPath, required String shellPath,
required DebuggingOptions debuggingOptions, required DebuggingOptions debuggingOptions,
TestWatcher? watcher, TestWatcher? watcher,
// TODO(bkonyi): remove after roll into google3.
bool enableObservatory = false, bool enableObservatory = false,
bool enableVmService = false,
bool machine = false, bool machine = false,
String? precompiledDillPath, String? precompiledDillPath,
Map<String, String>? precompiledDillFiles, Map<String, String>? precompiledDillFiles,
@ -68,7 +70,7 @@ FlutterPlatform installHook({
TestTimeRecorder? testTimeRecorder, TestTimeRecorder? testTimeRecorder,
UriConverter? uriConverter, UriConverter? uriConverter,
}) { }) {
assert(enableObservatory || (!debuggingOptions.startPaused && debuggingOptions.hostVmServicePort == null)); assert(enableVmService || enableObservatory || (!debuggingOptions.startPaused && debuggingOptions.hostVmServicePort == null));
// registerPlatformPlugin can be injected for testing since it's not very mock-friendly. // registerPlatformPlugin can be injected for testing since it's not very mock-friendly.
platformPluginRegistration ??= (FlutterPlatform platform) { platformPluginRegistration ??= (FlutterPlatform platform) {
@ -84,7 +86,7 @@ FlutterPlatform installHook({
debuggingOptions: debuggingOptions, debuggingOptions: debuggingOptions,
watcher: watcher, watcher: watcher,
machine: machine, machine: machine,
enableObservatory: enableObservatory, enableVmService: enableVmService || enableObservatory,
host: _kHosts[serverType], host: _kHosts[serverType],
precompiledDillPath: precompiledDillPath, precompiledDillPath: precompiledDillPath,
precompiledDillFiles: precompiledDillFiles, precompiledDillFiles: precompiledDillFiles,
@ -276,7 +278,7 @@ class FlutterPlatform extends PlatformPlugin {
required this.shellPath, required this.shellPath,
required this.debuggingOptions, required this.debuggingOptions,
this.watcher, this.watcher,
this.enableObservatory, this.enableVmService,
this.machine, this.machine,
this.host, this.host,
this.precompiledDillPath, this.precompiledDillPath,
@ -295,7 +297,7 @@ class FlutterPlatform extends PlatformPlugin {
final String shellPath; final String shellPath;
final DebuggingOptions debuggingOptions; final DebuggingOptions debuggingOptions;
final TestWatcher? watcher; final TestWatcher? watcher;
final bool? enableObservatory; final bool? enableVmService;
final bool? machine; final bool? machine;
final InternetAddress? host; final InternetAddress? host;
final String? precompiledDillPath; final String? precompiledDillPath;
@ -357,7 +359,7 @@ class FlutterPlatform extends PlatformPlugin {
if (_testCount > 0) { if (_testCount > 0) {
// Fail if there will be a port conflict. // Fail if there will be a port conflict.
if (debuggingOptions.hostVmServicePort != null) { if (debuggingOptions.hostVmServicePort != null) {
throwToolExit('installHook() was called with an observatory port or debugger mode enabled, but then more than one test suite was run.'); throwToolExit('installHook() was called with a VM Service port or debugger mode enabled, but then more than one test suite was run.');
} }
// Fail if we're passing in a precompiled entry-point. // Fail if we're passing in a precompiled entry-point.
if (precompiledDillPath != null) { if (precompiledDillPath != null) {
@ -424,7 +426,7 @@ class FlutterPlatform extends PlatformPlugin {
processManager: globals.processManager, processManager: globals.processManager,
logger: globals.logger, logger: globals.logger,
shellPath: shellPath, shellPath: shellPath,
enableObservatory: enableObservatory!, enableVmService: enableVmService!,
machine: machine, machine: machine,
debuggingOptions: debuggingOptions, debuggingOptions: debuggingOptions,
host: host, host: host,
@ -512,13 +514,13 @@ class FlutterPlatform extends PlatformPlugin {
await Future.any<void>(<Future<void>>[ await Future.any<void>(<Future<void>>[
testDevice.finished, testDevice.finished,
() async { () async {
final Uri? processObservatoryUri = await testDevice.observatoryUri; final Uri? processVmServiceUri = await testDevice.vmServiceUri;
if (processObservatoryUri != null) { if (processVmServiceUri != null) {
globals.printTrace('test $ourTestCount: Observatory uri is available at $processObservatoryUri'); globals.printTrace('test $ourTestCount: VM Service uri is available at $processVmServiceUri');
} else { } else {
globals.printTrace('test $ourTestCount: Observatory uri is not available'); globals.printTrace('test $ourTestCount: VM Service uri is not available');
} }
watcher?.handleStartedDevice(processObservatoryUri); watcher?.handleStartedDevice(processVmServiceUri);
final StreamChannel<String> remoteChannel = await remoteChannelFuture; final StreamChannel<String> remoteChannel = await remoteChannelFuture;
globals.printTrace('test $ourTestCount: connected to test device, now awaiting test result'); globals.printTrace('test $ourTestCount: connected to test device, now awaiting test result');

View file

@ -36,7 +36,7 @@ class FlutterTesterTestDevice extends TestDevice {
required this.logger, required this.logger,
required this.shellPath, required this.shellPath,
required this.debuggingOptions, required this.debuggingOptions,
required this.enableObservatory, required this.enableVmService,
required this.machine, required this.machine,
required this.host, required this.host,
required this.testAssetDirectory, required this.testAssetDirectory,
@ -45,8 +45,8 @@ class FlutterTesterTestDevice extends TestDevice {
required this.compileExpression, required this.compileExpression,
required this.fontConfigManager, required this.fontConfigManager,
required this.uriConverter, required this.uriConverter,
}) : assert(!debuggingOptions.startPaused || enableObservatory), }) : assert(!debuggingOptions.startPaused || enableVmService),
_gotProcessObservatoryUri = enableObservatory _gotProcessVmServiceUri = enableVmService
? Completer<Uri?>() : (Completer<Uri?>()..complete()); ? Completer<Uri?>() : (Completer<Uri?>()..complete());
/// Used for logging to identify the test that is currently being executed. /// Used for logging to identify the test that is currently being executed.
@ -57,7 +57,7 @@ class FlutterTesterTestDevice extends TestDevice {
final Logger logger; final Logger logger;
final String shellPath; final String shellPath;
final DebuggingOptions debuggingOptions; final DebuggingOptions debuggingOptions;
final bool enableObservatory; final bool enableVmService;
final bool? machine; final bool? machine;
final InternetAddress? host; final InternetAddress? host;
final String? testAssetDirectory; final String? testAssetDirectory;
@ -67,7 +67,7 @@ class FlutterTesterTestDevice extends TestDevice {
final FontConfigManager fontConfigManager; final FontConfigManager fontConfigManager;
final UriConverter? uriConverter; final UriConverter? uriConverter;
final Completer<Uri?> _gotProcessObservatoryUri; final Completer<Uri?> _gotProcessVmServiceUri;
final Completer<int> _exitCode = Completer<int>(); final Completer<int> _exitCode = Completer<int>();
Process? _process; Process? _process;
@ -89,7 +89,7 @@ class FlutterTesterTestDevice extends TestDevice {
logger.printTrace('test $id: test harness socket server is running at port:${_server!.port}'); logger.printTrace('test $id: test harness socket server is running at port:${_server!.port}');
final List<String> command = <String>[ final List<String> command = <String>[
shellPath, shellPath,
if (enableObservatory) ...<String>[ if (enableVmService) ...<String>[
// Some systems drive the _FlutterPlatform class in an unusual way, where // Some systems drive the _FlutterPlatform class in an unusual way, where
// only one test file is processed at a time, and the operating // only one test file is processed at a time, and the operating
// environment hands out specific ports ahead of time in a cooperative // environment hands out specific ports ahead of time in a cooperative
@ -99,12 +99,12 @@ class FlutterTesterTestDevice extends TestDevice {
// //
// I mention this only so that you won't be tempted, as I was, to apply // I mention this only so that you won't be tempted, as I was, to apply
// the obvious simplification to this code and remove this entire feature. // the obvious simplification to this code and remove this entire feature.
'--observatory-port=${debuggingOptions.enableDds ? 0 : debuggingOptions.hostVmServicePort }', '--vm-service-port=${debuggingOptions.enableDds ? 0 : debuggingOptions.hostVmServicePort }',
if (debuggingOptions.startPaused) '--start-paused', if (debuggingOptions.startPaused) '--start-paused',
if (debuggingOptions.disableServiceAuthCodes) '--disable-service-auth-codes', if (debuggingOptions.disableServiceAuthCodes) '--disable-service-auth-codes',
] ]
else else
'--disable-observatory', '--disable-vm-service',
if (host!.type == InternetAddressType.IPv6) '--ipv6', if (host!.type == InternetAddressType.IPv6) '--ipv6',
if (icudtlPath != null) '--icu-data-file-path=$icudtlPath', if (icudtlPath != null) '--icu-data-file-path=$icudtlPath',
'--enable-checked-mode', '--enable-checked-mode',
@ -154,11 +154,11 @@ class FlutterTesterTestDevice extends TestDevice {
logger.printTrace('test $id: Started flutter_tester process at pid ${_process!.pid}'); logger.printTrace('test $id: Started flutter_tester process at pid ${_process!.pid}');
// Pipe stdout and stderr from the subprocess to our printStatus console. // Pipe stdout and stderr from the subprocess to our printStatus console.
// We also keep track of what observatory port the engine used, if any. // We also keep track of what VM Service port the engine used, if any.
_pipeStandardStreamsToConsole( _pipeStandardStreamsToConsole(
process: _process!, process: _process!,
reportObservatoryUri: (Uri detectedUri) async { reportVmServiceUri: (Uri detectedUri) async {
assert(!_gotProcessObservatoryUri.isCompleted); assert(!_gotProcessVmServiceUri.isCompleted);
assert(debuggingOptions.hostVmServicePort == null || assert(debuggingOptions.hostVmServicePort == null ||
debuggingOptions.hostVmServicePort == detectedUri.port); debuggingOptions.hostVmServicePort == detectedUri.port);
@ -194,12 +194,11 @@ class FlutterTesterTestDevice extends TestDevice {
if (debuggingOptions.startPaused && !machine!) { if (debuggingOptions.startPaused && !machine!) {
logger.printStatus('The test process has been started.'); logger.printStatus('The test process has been started.');
logger.printStatus('You can now connect to it using observatory. To connect, load the following Web site in your browser:'); logger.printStatus('You can now connect to it using vmService. To connect, load the following Web site in your browser:');
logger.printStatus(' $forwardingUri'); logger.printStatus(' $forwardingUri');
logger.printStatus('You should first set appropriate breakpoints, then resume the test in the debugger.'); logger.printStatus('You should first set appropriate breakpoints, then resume the test in the debugger.');
} }
_gotProcessVmServiceUri.complete(forwardingUri);
_gotProcessObservatoryUri.complete(forwardingUri);
}, },
); );
@ -207,8 +206,8 @@ class FlutterTesterTestDevice extends TestDevice {
} }
@override @override
Future<Uri?> get observatoryUri { Future<Uri?> get vmServiceUri {
return _gotProcessObservatoryUri.future; return _gotProcessVmServiceUri.future;
} }
@override @override
@ -293,7 +292,7 @@ class FlutterTesterTestDevice extends TestDevice {
void _pipeStandardStreamsToConsole({ void _pipeStandardStreamsToConsole({
required Process process, required Process process,
required Future<void> Function(Uri uri) reportObservatoryUri, required Future<void> Function(Uri uri) reportVmServiceUri,
}) { }) {
for (final Stream<List<int>> stream in <Stream<List<int>>>[ for (final Stream<List<int>> stream in <Stream<List<int>>>[
process.stderr, process.stderr,
@ -310,9 +309,9 @@ class FlutterTesterTestDevice extends TestDevice {
if (match != null) { if (match != null) {
try { try {
final Uri uri = Uri.parse(match[1]!); final Uri uri = Uri.parse(match[1]!);
await reportObservatoryUri(uri); await reportVmServiceUri(uri);
} on Exception catch (error) { } on Exception catch (error) {
logger.printError('Could not parse shell observatory port message: $error'); logger.printError('Could not parse shell VM Service port message: $error');
} }
} else { } else {
logger.printStatus('Shell: $line'); logger.printStatus('Shell: $line');

View file

@ -84,7 +84,7 @@ class TestGoldenComparator {
} }
final List<String> command = <String>[ final List<String> command = <String>[
shellPath!, shellPath!,
'--disable-observatory', '--disable-vm-service',
'--non-interactive', '--non-interactive',
'--packages=${_fileSystem.path.join('.dart_tool', 'package_config.json')}', '--packages=${_fileSystem.path.join('.dart_tool', 'package_config.json')}',
output, output,

View file

@ -35,7 +35,7 @@ class IntegrationTestTestDevice implements TestDevice {
ApplicationPackage? _applicationPackage; ApplicationPackage? _applicationPackage;
final Completer<void> _finished = Completer<void>(); final Completer<void> _finished = Completer<void>();
final Completer<Uri> _gotProcessObservatoryUri = Completer<Uri>(); final Completer<Uri> _gotProcessVmServiceUri = Completer<Uri>();
/// Starts the device. /// Starts the device.
/// ///
@ -62,19 +62,19 @@ class IntegrationTestTestDevice implements TestDevice {
if (!launchResult.started) { if (!launchResult.started) {
throw TestDeviceException('Unable to start the app on the device.', StackTrace.current); throw TestDeviceException('Unable to start the app on the device.', StackTrace.current);
} }
final Uri? observatoryUri = launchResult.observatoryUri; final Uri? vmServiceUri = launchResult.vmServiceUri;
if (observatoryUri == null) { if (vmServiceUri == null) {
throw TestDeviceException('Observatory is not available on the test device.', StackTrace.current); throw TestDeviceException('The VM Service is not available on the test device.', StackTrace.current);
} }
// No need to set up the log reader because the logs are captured and // No need to set up the log reader because the logs are captured and
// streamed to the package:test_core runner. // streamed to the package:test_core runner.
_gotProcessObservatoryUri.complete(observatoryUri); _gotProcessVmServiceUri.complete(vmServiceUri);
globals.printTrace('test $id: Connecting to vm service'); globals.printTrace('test $id: Connecting to vm service');
final FlutterVmService vmService = await connectToVmService( final FlutterVmService vmService = await connectToVmService(
observatoryUri, vmServiceUri,
logger: globals.logger, logger: globals.logger,
compileExpression: compileExpression, compileExpression: compileExpression,
).timeout( ).timeout(
@ -116,7 +116,7 @@ class IntegrationTestTestDevice implements TestDevice {
} }
@override @override
Future<Uri> get observatoryUri => _gotProcessObservatoryUri.future; Future<Uri> get vmServiceUri => _gotProcessVmServiceUri.future;
@override @override
Future<void> kill() async { Future<void> kill() async {

View file

@ -30,7 +30,7 @@ abstract class FlutterTestRunner {
List<String> plainNames = const <String>[], List<String> plainNames = const <String>[],
String? tags, String? tags,
String? excludeTags, String? excludeTags,
bool enableObservatory = false, bool enableVmService = false,
bool ipv6 = false, bool ipv6 = false,
bool machine = false, bool machine = false,
String? precompiledDillPath, String? precompiledDillPath,
@ -68,7 +68,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
List<String> plainNames = const <String>[], List<String> plainNames = const <String>[],
String? tags, String? tags,
String? excludeTags, String? excludeTags,
bool enableObservatory = false, bool enableVmService = false,
bool ipv6 = false, bool ipv6 = false,
bool machine = false, bool machine = false,
String? precompiledDillPath, String? precompiledDillPath,
@ -197,7 +197,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
shellPath: shellPath, shellPath: shellPath,
debuggingOptions: debuggingOptions, debuggingOptions: debuggingOptions,
watcher: watcher, watcher: watcher,
enableObservatory: enableObservatory, enableVmService: enableVmService,
machine: machine, machine: machine,
serverType: serverType, serverType: serverType,
precompiledDillPath: precompiledDillPath, precompiledDillPath: precompiledDillPath,

View file

@ -21,8 +21,8 @@ abstract class TestDevice {
/// or raw source file. /// or raw source file.
Future<StreamChannel<String>> start(String entrypointPath); Future<StreamChannel<String>> start(String entrypointPath);
/// Should complete with null if the observatory is not enabled. /// Should complete with null if the VM Service is not enabled.
Future<Uri?> get observatoryUri; Future<Uri?> get vmServiceUri;
/// Terminates the test device. /// Terminates the test device.
Future<void> kill(); Future<void> kill();

View file

@ -8,9 +8,9 @@ import 'test_device.dart';
abstract class TestWatcher { abstract class TestWatcher {
/// Called after the test device starts. /// Called after the test device starts.
/// ///
/// If startPaused was true, the caller needs to resume in Observatory to /// If startPaused was true, the caller needs to resume in DevTools to
/// start running the tests. /// start running the tests.
void handleStartedDevice(Uri? observatoryUri) { } void handleStartedDevice(Uri? vmServiceUri) { }
/// Called after the tests finish but before the test device exits. /// Called after the tests finish but before the test device exits.
/// ///

View file

@ -174,11 +174,11 @@ class FlutterTesterDevice extends Device {
if (debuggingOptions.disableServiceAuthCodes) if (debuggingOptions.disableServiceAuthCodes)
'--disable-service-auth-codes', '--disable-service-auth-codes',
if (debuggingOptions.hostVmServicePort != null) if (debuggingOptions.hostVmServicePort != null)
'--observatory-port=${debuggingOptions.hostVmServicePort}', '--vm-service-port=${debuggingOptions.hostVmServicePort}',
applicationKernelFilePath, applicationKernelFilePath,
]; ];
ProtocolDiscovery? observatoryDiscovery; ProtocolDiscovery? vmServiceDiscovery;
try { try {
_logger.printTrace(command.join(' ')); _logger.printTrace(command.join(' '));
_process = await _processManager.start(command, _process = await _processManager.start(command,
@ -190,7 +190,7 @@ class FlutterTesterDevice extends Device {
return LaunchResult.succeeded(); return LaunchResult.succeeded();
} }
observatoryDiscovery = ProtocolDiscovery.observatory( vmServiceDiscovery = ProtocolDiscovery.vmService(
getLogReader(), getLogReader(),
hostPort: debuggingOptions.hostVmServicePort, hostPort: debuggingOptions.hostVmServicePort,
devicePort: debuggingOptions.deviceVmServicePort, devicePort: debuggingOptions.deviceVmServicePort,
@ -199,9 +199,9 @@ class FlutterTesterDevice extends Device {
); );
_logReader.initializeProcess(_process!); _logReader.initializeProcess(_process!);
final Uri? observatoryUri = await observatoryDiscovery.uri; final Uri? vmServiceUri = await vmServiceDiscovery.uri;
if (observatoryUri != null) { if (vmServiceUri != null) {
return LaunchResult.succeeded(observatoryUri: observatoryUri); return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
} }
_logger.printError( _logger.printError(
'Failed to launch $package: ' 'Failed to launch $package: '
@ -210,7 +210,7 @@ class FlutterTesterDevice extends Device {
} on Exception catch (error) { } on Exception catch (error) {
_logger.printError('Failed to launch $package: $error'); _logger.printError('Failed to launch $package: $error');
} finally { } finally {
await observatoryDiscovery?.cancel(); await vmServiceDiscovery?.cancel();
} }
return LaunchResult.failed(); return LaunchResult.failed();
} }

View file

@ -120,7 +120,7 @@ class Tracing {
} }
} }
/// Download the startup trace information from the given observatory client and /// Download the startup trace information from the given VM Service client and
/// store it to `$output/start_up_info.json`. /// store it to `$output/start_up_info.json`.
Future<void> downloadStartupTrace(FlutterVmService vmService, { Future<void> downloadStartupTrace(FlutterVmService vmService, {
bool awaitFirstFrame = true, bool awaitFirstFrame = true,

View file

@ -73,7 +73,7 @@ abstract class RPCErrorCodes {
/// The VM Service Protocol allows clients to register custom services that /// The VM Service Protocol allows clients to register custom services that
/// can be invoked by other clients through the service protocol itself. /// can be invoked by other clients through the service protocol itself.
/// ///
/// Clients like Observatory use external 'reloadSources' services, /// Clients like VmService use external 'reloadSources' services,
/// when available, instead of the VM internal one. This allows these clients to /// when available, instead of the VM internal one. This allows these clients to
/// invoke Flutter HotReload when connected to a Flutter Application started in /// invoke Flutter HotReload when connected to a Flutter Application started in
/// hot mode. /// hot mode.

View file

@ -153,7 +153,7 @@ abstract class ChromiumDevice extends Device {
); );
} }
_logger.sendEvent('app.webLaunchUrl', <String, Object>{'url': url, 'launched': launchChrome}); _logger.sendEvent('app.webLaunchUrl', <String, Object>{'url': url, 'launched': launchChrome});
return LaunchResult.succeeded(observatoryUri: Uri.parse(url)); return LaunchResult.succeeded(vmServiceUri: Uri.parse(url));
} }
@override @override
@ -474,7 +474,7 @@ class WebServerDevice extends Device {
'Consider using the Chrome or Edge devices for an improved development workflow.' 'Consider using the Chrome or Edge devices for an improved development workflow.'
); );
_logger.sendEvent('app.webLaunchUrl', <String, Object?>{'url': url, 'launched': false}); _logger.sendEvent('app.webLaunchUrl', <String, Object?>{'url': url, 'launched': false});
return LaunchResult.succeeded(observatoryUri: url != null ? Uri.parse(url): null); return LaunchResult.succeeded(vmServiceUri: url != null ? Uri.parse(url): null);
} }
@override @override

View file

@ -91,14 +91,14 @@
] ]
}, },
"runDebug": { "runDebug": {
"description": "The command to be invoked to run the app in debug mode. The name of the app to be started is available via the ${appName} string interpolation. Make sure the flutter cmdline output is available via this commands stdout/stderr since the SDK needs the \"Observatory is now listening on ...\" message to function. If the forwardPort command is not specified, the observatory URL will be connected to as-is, without any port forwarding. In that case you need to make sure it is reachable from your host device, possibly via the \"--observatory-host=<ip>\" engine flag.", "description": "The command to be invoked to run the app in debug mode. The name of the app to be started is available via the ${appName} string interpolation. Make sure the flutter cmdline output is available via this commands stdout/stderr since the SDK needs the \"VM Service is now listening on ...\" message to function. If the forwardPort command is not specified, the VM Service URL will be connected to as-is, without any port forwarding. In that case you need to make sure it is reachable from your host device, possibly via the \"--vm-service-host=<ip>\" engine flag.",
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
}, },
"minItems": 1, "minItems": 1,
"default": [ "default": [
"ssh", "pi@raspberrypi", "flutter-pi /tmp/${appName} --observatory-host=192.168.178.123" "ssh", "pi@raspberrypi", "flutter-pi /tmp/${appName} --vm-service-host=192.168.178.123"
] ]
}, },
"forwardPort": { "forwardPort": {

View file

@ -118,8 +118,8 @@ void main() {
testDeviceManager.devices = <Device>[device]; testDeviceManager.devices = <Device>[device];
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
final StreamSubscription<String> loggerSubscription = logger.stream.listen((String message) { final StreamSubscription<String> loggerSubscription = logger.stream.listen((String message) {
if (message == '[verbose] Observatory URL on device: http://127.0.0.1:$devicePort') { if (message == '[verbose] VM Service URL on device: http://127.0.0.1:$devicePort') {
// The "Observatory URL on device" message is output by the ProtocolDiscovery when it found the observatory. // The "VM Service URL on device" message is output by the ProtocolDiscovery when it found the VM Service.
completer.complete(); completer.complete();
} }
}); });
@ -131,7 +131,7 @@ void main() {
bool enableDevTools, bool enableDevTools,
) async => 0; ) async => 0;
hotRunner.exited = false; hotRunner.exited = false;
hotRunner.isWaitingForObservatory = false; hotRunner.isWaitingForVmService = false;
final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory() final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory()
..hotRunner = hotRunner; ..hotRunner = hotRunner;
@ -186,7 +186,7 @@ void main() {
bool enableDevTools, bool enableDevTools,
) async => 0; ) async => 0;
hotRunner.exited = false; hotRunner.exited = false;
hotRunner.isWaitingForObservatory = false; hotRunner.isWaitingForVmService = false;
final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory() final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory()
..hotRunner = hotRunner; ..hotRunner = hotRunner;
@ -207,8 +207,8 @@ void main() {
expect(portForwarder.hostPort, hostPort); expect(portForwarder.hostPort, hostPort);
expect(hotRunnerFactory.devices, hasLength(1)); expect(hotRunnerFactory.devices, hasLength(1));
final FlutterDevice flutterDevice = hotRunnerFactory.devices.first; final FlutterDevice flutterDevice = hotRunnerFactory.devices.first;
final Uri? observatoryUri = await flutterDevice.observatoryUris?.first; final Uri? vmServiceUri = await flutterDevice.vmServiceUris?.first;
expect(observatoryUri.toString(), 'http://127.0.0.1:$hostPort/xyz/'); expect(vmServiceUri.toString(), 'http://127.0.0.1:$hostPort/xyz/');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
@ -252,7 +252,7 @@ void main() {
bool enableDevTools, bool enableDevTools,
) async => 0; ) async => 0;
hotRunner.exited = false; hotRunner.exited = false;
hotRunner.isWaitingForObservatory = false; hotRunner.isWaitingForVmService = false;
final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory() final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory()
..hotRunner = hotRunner; ..hotRunner = hotRunner;
@ -274,8 +274,8 @@ void main() {
expect(hotRunnerFactory.devices, hasLength(1)); expect(hotRunnerFactory.devices, hasLength(1));
final FlutterDevice flutterDevice = hotRunnerFactory.devices.first; final FlutterDevice flutterDevice = hotRunnerFactory.devices.first;
final Uri? observatoryUri = await flutterDevice.observatoryUris?.first; final Uri? vmServiceUri = await flutterDevice.vmServiceUris?.first;
expect(observatoryUri.toString(), 'http://111.111.111.111:123/xyz/'); expect(vmServiceUri.toString(), 'http://111.111.111.111:123/xyz/');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
@ -324,7 +324,7 @@ void main() {
bool enableDevTools, bool enableDevTools,
) async => 0; ) async => 0;
hotRunner.exited = false; hotRunner.exited = false;
hotRunner.isWaitingForObservatory = false; hotRunner.isWaitingForVmService = false;
final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory() final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory()
..hotRunner = hotRunner; ..hotRunner = hotRunner;
@ -346,8 +346,8 @@ void main() {
expect(hotRunnerFactory.devices, hasLength(1)); expect(hotRunnerFactory.devices, hasLength(1));
final FlutterDevice flutterDevice = hotRunnerFactory.devices.first; final FlutterDevice flutterDevice = hotRunnerFactory.devices.first;
final Uri? observatoryUri = await flutterDevice.observatoryUris?.first; final Uri? vmServiceUri = await flutterDevice.vmServiceUris?.first;
expect(observatoryUri.toString(), 'http://111.111.111.111:123/xyz/'); expect(vmServiceUri.toString(), 'http://111.111.111.111:123/xyz/');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
@ -400,7 +400,7 @@ void main() {
bool enableDevTools, bool enableDevTools,
) async => 0; ) async => 0;
hotRunner.exited = false; hotRunner.exited = false;
hotRunner.isWaitingForObservatory = false; hotRunner.isWaitingForVmService = false;
final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory() final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory()
..hotRunner = hotRunner; ..hotRunner = hotRunner;
@ -422,8 +422,8 @@ void main() {
expect(hotRunnerFactory.devices, hasLength(1)); expect(hotRunnerFactory.devices, hasLength(1));
final FlutterDevice flutterDevice = hotRunnerFactory.devices.first; final FlutterDevice flutterDevice = hotRunnerFactory.devices.first;
final Uri? observatoryUri = await flutterDevice.observatoryUris?.first; final Uri? vmServiceUri = await flutterDevice.vmServiceUris?.first;
expect(observatoryUri.toString(), 'http://111.111.111.111:123/xyz/'); expect(vmServiceUri.toString(), 'http://111.111.111.111:123/xyz/');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => testFileSystem, FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
@ -460,7 +460,7 @@ void main() {
), ),
}); });
testUsingContext('finds observatory port and forwards', () async { testUsingContext('finds VM Service port and forwards', () async {
device.onGetLogReader = () { device.onGetLogReader = () {
fakeLogReader.addLine('Foo'); fakeLogReader.addLine('Foo');
fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort'); fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort');
@ -469,8 +469,8 @@ void main() {
testDeviceManager.devices = <Device>[device]; testDeviceManager.devices = <Device>[device];
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
final StreamSubscription<String> loggerSubscription = logger.stream.listen((String message) { final StreamSubscription<String> loggerSubscription = logger.stream.listen((String message) {
if (message == '[verbose] Observatory URL on device: http://127.0.0.1:$devicePort') { if (message == '[verbose] VM Service URL on device: http://127.0.0.1:$devicePort') {
// The "Observatory URL on device" message is output by the ProtocolDiscovery when it found the observatory. // The "VM Service URL on device" message is output by the ProtocolDiscovery when it found the VM Service.
completer.complete(); completer.complete();
} }
}); });
@ -499,7 +499,7 @@ void main() {
DeviceManager: () => testDeviceManager, DeviceManager: () => testDeviceManager,
}); });
testUsingContext('Fails with tool exit on bad Observatory uri', () async { testUsingContext('Fails with tool exit on bad VmService uri', () async {
device.onGetLogReader = () { device.onGetLogReader = () {
fakeLogReader.addLine('Foo'); fakeLogReader.addLine('Foo');
fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort'); fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort');
@ -545,7 +545,7 @@ void main() {
bool enableDevTools, bool enableDevTools,
) async => 0; ) async => 0;
hotRunner.exited = false; hotRunner.exited = false;
hotRunner.isWaitingForObservatory = false; hotRunner.isWaitingForVmService = false;
final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory() final FakeHotRunnerFactory hotRunnerFactory = FakeHotRunnerFactory()
..hotRunner = hotRunner; ..hotRunner = hotRunner;
@ -618,7 +618,7 @@ void main() {
DeviceManager: () => testDeviceManager, DeviceManager: () => testDeviceManager,
},); },);
testUsingContext('exits when observatory-port is specified and debug-port is not', () async { testUsingContext('exits when vm-service-port is specified and debug-port is not', () async {
device.onGetLogReader = () { device.onGetLogReader = () {
fakeLogReader.addLine('Foo'); fakeLogReader.addLine('Foo');
fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort'); fakeLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:$devicePort');
@ -637,10 +637,10 @@ void main() {
fileSystem: testFileSystem, fileSystem: testFileSystem,
); );
await expectLater( await expectLater(
createTestCommandRunner(command).run(<String>['attach', '--observatory-port', '100']), createTestCommandRunner(command).run(<String>['attach', '--vm-service-port', '100']),
throwsToolExit( throwsToolExit(
message: 'When the --debug-port or --debug-url is unknown, this command does not use ' message: 'When the --debug-port or --debug-url is unknown, this command does not use '
'the value of --observatory-port.', 'the value of --vm-service-port.',
), ),
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
@ -735,7 +735,7 @@ void main() {
DeviceManager: () => testDeviceManager, DeviceManager: () => testDeviceManager,
}); });
testUsingContext('skips in ipv4 mode with a provided observatory port', () async { testUsingContext('skips in ipv4 mode with a provided VM Service port', () async {
testDeviceManager.devices = <Device>[device]; testDeviceManager.devices = <Device>[device];
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
@ -760,7 +760,7 @@ void main() {
'attach', 'attach',
'--debug-port', '--debug-port',
'$devicePort', '$devicePort',
'--observatory-port', '--vm-service-port',
'$hostPort', '$hostPort',
// Ensure DDS doesn't use hostPort by binding to a random port. // Ensure DDS doesn't use hostPort by binding to a random port.
'--dds-port', '--dds-port',
@ -780,7 +780,7 @@ void main() {
DeviceManager: () => testDeviceManager, DeviceManager: () => testDeviceManager,
}); });
testUsingContext('skips in ipv6 mode with a provided observatory port', () async { testUsingContext('skips in ipv6 mode with a provided VM Service port', () async {
testDeviceManager.devices = <Device>[device]; testDeviceManager.devices = <Device>[device];
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
@ -805,7 +805,7 @@ void main() {
'attach', 'attach',
'--debug-port', '--debug-port',
'$devicePort', '$devicePort',
'--observatory-port', '--vm-service-port',
'$hostPort', '$hostPort',
'--ipv6', '--ipv6',
// Ensure DDS doesn't use hostPort by binding to a random port. // Ensure DDS doesn't use hostPort by binding to a random port.
@ -992,7 +992,7 @@ class FakeHotRunner extends Fake implements HotRunner {
bool exited = false; bool exited = false;
@override @override
bool isWaitingForObservatory = true; bool isWaitingForVmService = true;
@override @override
Future<int> attach({ Future<int> attach({
@ -1198,7 +1198,7 @@ class FakeDartDevelopmentService extends Fake implements DartDevelopmentService
@override @override
Future<void> startDartDevelopmentService( Future<void> startDartDevelopmentService(
Uri observatoryUri, { Uri vmServiceUri, {
required Logger logger, required Logger logger,
int? hostPort, int? hostPort,
bool? ipv6, bool? ipv6,

View file

@ -430,8 +430,8 @@ void main() {
final String? applicationPackageId = applicationPackageIdResponse.data['result'] as String?; final String? applicationPackageId = applicationPackageIdResponse.data['result'] as String?;
// Try starting the app. // Try starting the app.
final Uri observatoryUri = Uri.parse('http://127.0.0.1:12345/observatory'); final Uri vmServiceUri = Uri.parse('http://127.0.0.1:12345/vmService');
device.launchResult = LaunchResult.succeeded(observatoryUri: observatoryUri); device.launchResult = LaunchResult.succeeded(vmServiceUri: vmServiceUri);
daemonStreams.inputs.add(DaemonMessage(<String, Object?>{ daemonStreams.inputs.add(DaemonMessage(<String, Object?>{
'id': 1, 'id': 1,
'method': 'device.startApp', 'method': 'device.startApp',
@ -446,7 +446,7 @@ void main() {
expect(device.startAppPackage, applicationPackage); expect(device.startAppPackage, applicationPackage);
final Map<String, Object?> startAppResult = startAppResponse.data['result']! as Map<String, Object?>; final Map<String, Object?> startAppResult = startAppResponse.data['result']! as Map<String, Object?>;
expect(startAppResult['started'], true); expect(startAppResult['started'], true);
expect(startAppResult['observatoryUri'], observatoryUri.toString()); expect(startAppResult['vmServiceUri'], vmServiceUri.toString());
// Try stopping the app. // Try stopping the app.
daemonStreams.inputs.add(DaemonMessage(<String, Object?>{ daemonStreams.inputs.add(DaemonMessage(<String, Object?>{

View file

@ -161,8 +161,8 @@ void main() {
final FakeApplicationPackage applicationPackage = FakeApplicationPackage(); final FakeApplicationPackage applicationPackage = FakeApplicationPackage();
applicationPackageFactory.applicationPackage = applicationPackage; applicationPackageFactory.applicationPackage = applicationPackage;
final Uri observatoryUri = Uri.parse('http://127.0.0.1:12345/observatory'); final Uri vmServiceUri = Uri.parse('http://127.0.0.1:12345/vmService');
fakeDevice.launchResult = LaunchResult.succeeded(observatoryUri: observatoryUri); fakeDevice.launchResult = LaunchResult.succeeded(vmServiceUri: vmServiceUri);
final LaunchResult launchResult = await device.startApp( final LaunchResult launchResult = await device.startApp(
prebuiltApplicationPackage, prebuiltApplicationPackage,
@ -170,8 +170,8 @@ void main() {
); );
expect(launchResult.started, true); expect(launchResult.started, true);
// The returned observatoryUri was a forwarded port, so we cannot compare them directly. // The returned vmServiceUri was a forwarded port, so we cannot compare them directly.
expect(launchResult.observatoryUri!.path, observatoryUri.path); expect(launchResult.vmServiceUri!.path, vmServiceUri.path);
expect(applicationPackageFactory.applicationBinaryRequested!.readAsStringSync(), 'dummy content'); expect(applicationPackageFactory.applicationBinaryRequested!.readAsStringSync(), 'dummy content');
expect(applicationPackageFactory.platformRequested, TargetPlatform.android_arm); expect(applicationPackageFactory.platformRequested, TargetPlatform.android_arm);

View file

@ -28,26 +28,26 @@ void main() {
}; };
await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test())) await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test()))
.run(<String>['screenshot', '--type=skia', '--observatory-url=http://localhost:8181']), .run(<String>['screenshot', '--type=skia', '--vm-service-url=http://localhost:8181']),
throwsA(isException.having((Exception exception) => exception.toString(), 'message', contains('dummy'))), throwsA(isException.having((Exception exception) => exception.toString(), 'message', contains('dummy'))),
); );
await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test())) await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test()))
.run(<String>['screenshot', '--type=rasterizer', '--observatory-url=http://localhost:8181']), .run(<String>['screenshot', '--type=rasterizer', '--vm-service-url=http://localhost:8181']),
throwsA(isException.having((Exception exception) => exception.toString(), 'message', contains('dummy'))), throwsA(isException.having((Exception exception) => exception.toString(), 'message', contains('dummy'))),
); );
}); });
testUsingContext('rasterizer and skia screenshots require observatory uri', () async { testUsingContext('rasterizer and skia screenshots require VM Service uri', () async {
await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test())) await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test()))
.run(<String>['screenshot', '--type=skia']), .run(<String>['screenshot', '--type=skia']),
throwsToolExit(message: 'Observatory URI must be specified for screenshot type skia') throwsToolExit(message: 'VM Service URI must be specified for screenshot type skia')
); );
await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test())) await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test()))
.run(<String>['screenshot', '--type=rasterizer',]), .run(<String>['screenshot', '--type=rasterizer',]),
throwsToolExit(message: 'Observatory URI must be specified for screenshot type rasterizer'), throwsToolExit(message: 'VM Service URI must be specified for screenshot type rasterizer'),
); );
}); });
@ -58,10 +58,10 @@ void main() {
); );
}); });
testUsingContext('device screenshots cannot provided Observatory', () async { testUsingContext('device screenshots cannot provided VM Service', () async {
await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test())) await expectLater(() => createTestCommandRunner(ScreenshotCommand(fs: MemoryFileSystem.test()))
.run(<String>['screenshot', '--observatory-url=http://localhost:8181']), .run(<String>['screenshot', '--vm-service-url=http://localhost:8181']),
throwsToolExit(message: 'Observatory URI cannot be provided for screenshot type device'), throwsToolExit(message: 'VM Service URI cannot be provided for screenshot type device'),
); );
}); });
}); });

View file

@ -298,7 +298,7 @@ dev_dependencies:
Cache: () => Cache.test(processManager: FakeProcessManager.any()), Cache: () => Cache.test(processManager: FakeProcessManager.any()),
}); });
testUsingContext('Pipes enable-observatory', () async { testUsingContext('Pipes enable-vmService', () async {
final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner(0); final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner(0);
final TestCommand testCommand = TestCommand(testRunner: testRunner); final TestCommand testCommand = TestCommand(testRunner: testRunner);
@ -313,7 +313,7 @@ dev_dependencies:
'test/fake_test.dart', 'test/fake_test.dart',
]); ]);
expect( expect(
testRunner.lastEnableObservatoryValue, testRunner.lastEnableVmServiceValue,
true, true,
); );
@ -326,7 +326,7 @@ dev_dependencies:
'test/fake_test.dart', 'test/fake_test.dart',
]); ]);
expect( expect(
testRunner.lastEnableObservatoryValue, testRunner.lastEnableVmServiceValue,
true, true,
); );
@ -337,7 +337,7 @@ dev_dependencies:
'test/fake_test.dart', 'test/fake_test.dart',
]); ]);
expect( expect(
testRunner.lastEnableObservatoryValue, testRunner.lastEnableVmServiceValue,
false, false,
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
@ -848,7 +848,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
int exitCode; int exitCode;
Duration? leastRunTime; Duration? leastRunTime;
bool? lastEnableObservatoryValue; bool? lastEnableVmServiceValue;
late DebuggingOptions lastDebuggingOptionsValue; late DebuggingOptions lastDebuggingOptionsValue;
String? lastFileReporterValue; String? lastFileReporterValue;
String? lastReporterOption; String? lastReporterOption;
@ -862,7 +862,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
List<String> plainNames = const <String>[], List<String> plainNames = const <String>[],
String? tags, String? tags,
String? excludeTags, String? excludeTags,
bool enableObservatory = false, bool enableVmService = false,
bool ipv6 = false, bool ipv6 = false,
bool machine = false, bool machine = false,
String? precompiledDillPath, String? precompiledDillPath,
@ -886,7 +886,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
String? integrationTestUserIdentifier, String? integrationTestUserIdentifier,
TestTimeRecorder? testTimeRecorder, TestTimeRecorder? testTimeRecorder,
}) async { }) async {
lastEnableObservatoryValue = enableObservatory; lastEnableVmServiceValue = enableVmService;
lastDebuggingOptionsValue = debuggingOptions; lastDebuggingOptionsValue = debuggingOptions;
lastFileReporterValue = fileReporter; lastFileReporterValue = fileReporter;
lastReporterOption = reporter; lastReporterOption = reporter;

View file

@ -285,7 +285,7 @@ void main() {
userIdentifier: '10', userIdentifier: '10',
); );
// This fails to start due to observatory discovery issues. // This fails to start due to VM Service discovery issues.
expect(launchResult.started, false); expect(launchResult.started, false);
expect(processManager, hasNoRemainingExpectations); expect(processManager, hasNoRemainingExpectations);
}); });

View file

@ -141,7 +141,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
FakeFlutterDevice(this.device); FakeFlutterDevice(this.device);
@override @override
Stream<Uri> get observatoryUris => const Stream<Uri>.empty(); Stream<Uri> get vmServiceUris => const Stream<Uri>.empty();
@override @override
final Device device; final Device device;

View file

@ -647,7 +647,7 @@ class TestTestDevice extends TestDevice {
Future<void> kill() => Future<void>.value(); Future<void> kill() => Future<void>.value();
@override @override
Future<Uri?> get observatoryUri => Future<Uri?>.value(Uri()); Future<Uri?> get vmServiceUri => Future<Uri?>.value(Uri());
@override @override
Future<StreamChannel<String>> start(String entrypointPath) { Future<StreamChannel<String>> start(String entrypointPath) {

View file

@ -359,7 +359,7 @@ void main() {
expect(forwardPortCommandCompleter.isCompleted, true); expect(forwardPortCommandCompleter.isCompleted, true);
}); });
testWithoutContext('CustomDevice forwards observatory port correctly when port forwarding is configured', () async { testWithoutContext('CustomDevice forwards VM Service port correctly when port forwarding is configured', () async {
final Completer<void> runDebugCompleter = Completer<void>(); final Completer<void> runDebugCompleter = Completer<void>();
final Completer<void> forwardPortCompleter = Completer<void>(); final Completer<void> forwardPortCompleter = Completer<void>();
@ -391,7 +391,7 @@ void main() {
final LaunchResult launchResult = await appSession.start(debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug)); final LaunchResult launchResult = await appSession.start(debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug));
expect(launchResult.started, true); expect(launchResult.started, true);
expect(launchResult.observatoryUri, Uri.parse('http://127.0.0.1:12345/abcd/')); expect(launchResult.vmServiceUri, Uri.parse('http://127.0.0.1:12345/abcd/'));
expect(runDebugCompleter.isCompleted, false); expect(runDebugCompleter.isCompleted, false);
expect(forwardPortCompleter.isCompleted, false); expect(forwardPortCompleter.isCompleted, false);
@ -400,7 +400,7 @@ void main() {
expect(forwardPortCompleter.isCompleted, true); expect(forwardPortCompleter.isCompleted, true);
}); });
testWithoutContext('CustomDeviceAppSession forwards observatory port correctly when port forwarding is not configured', () async { testWithoutContext('CustomDeviceAppSession forwards VM Service port correctly when port forwarding is not configured', () async {
final Completer<void> runDebugCompleter = Completer<void>(); final Completer<void> runDebugCompleter = Completer<void>();
final FakeProcessManager processManager = FakeProcessManager.list( final FakeProcessManager processManager = FakeProcessManager.list(
@ -428,7 +428,7 @@ void main() {
final LaunchResult launchResult = await appSession.start(debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug)); final LaunchResult launchResult = await appSession.start(debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug));
expect(launchResult.started, true); expect(launchResult.started, true);
expect(launchResult.observatoryUri, Uri.parse('http://192.168.178.123:12345/abcd/')); expect(launchResult.vmServiceUri, Uri.parse('http://192.168.178.123:12345/abcd/'));
expect(runDebugCompleter.isCompleted, false); expect(runDebugCompleter.isCompleted, false);
expect(await appSession.stop(), true); expect(await appSession.stop(), true);
@ -501,8 +501,8 @@ void main() {
bundleBuilder: FakeBundleBuilder() bundleBuilder: FakeBundleBuilder()
); );
expect(result.started, true); expect(result.started, true);
expect(result.hasObservatory, true); expect(result.hasVmService, true);
expect(result.observatoryUri, Uri.tryParse('http://127.0.0.1:12345/abcd/')); expect(result.vmServiceUri, Uri.tryParse('http://127.0.0.1:12345/abcd/'));
expect(runDebugCompleter.isCompleted, false); expect(runDebugCompleter.isCompleted, false);
expect(forwardPortCompleter.isCompleted, false); expect(forwardPortCompleter.isCompleted, false);

View file

@ -96,7 +96,7 @@ void main() {
); );
expect(result.started, true); expect(result.started, true);
expect(result.observatoryUri, Uri.parse('http://127.0.0.1/0')); expect(result.vmServiceUri, Uri.parse('http://127.0.0.1/0'));
}); });
testWithoutContext('Null executable path fails gracefully', () async { testWithoutContext('Null executable path fails gracefully', () async {

View file

@ -509,7 +509,7 @@ void main() {
<String>[ <String>[
'--enable-dart-profiling', '--enable-dart-profiling',
'--disable-service-auth-codes', '--disable-service-auth-codes',
'--disable-observatory-publication', '--disable-vm-service-publication',
'--start-paused', '--start-paused',
'--dart-flags="--foo,--null_assertions"', '--dart-flags="--foo,--null_assertions"',
'--use-test-fonts', '--use-test-fonts',
@ -529,7 +529,7 @@ void main() {
'--route=/test', '--route=/test',
'--trace-startup', '--trace-startup',
'--enable-impeller', '--enable-impeller',
'--observatory-port=0', '--vm-service-port=0',
].join(' '), ].join(' '),
); );
}); });
@ -573,7 +573,7 @@ void main() {
'--enable-dart-profiling', '--enable-dart-profiling',
'--enable-checked-mode', '--enable-checked-mode',
'--verify-entry-points', '--verify-entry-points',
'--observatory-host=0.0.0.0', '--vm-service-host=0.0.0.0',
].join(' '), ].join(' '),
); );
}); });
@ -597,7 +597,7 @@ void main() {
'--enable-dart-profiling', '--enable-dart-profiling',
'--enable-checked-mode', '--enable-checked-mode',
'--verify-entry-points', '--verify-entry-points',
'--observatory-host=::0', '--vm-service-host=::0',
].join(' '), ].join(' '),
); );
}); });
@ -669,7 +669,7 @@ void main() {
<String>[ <String>[
'--enable-dart-profiling', '--enable-dart-profiling',
'--disable-service-auth-codes', '--disable-service-auth-codes',
'--disable-observatory-publication', '--disable-vm-service-publication',
'--start-paused', '--start-paused',
'--dart-flags=--foo,--null_assertions', '--dart-flags=--foo,--null_assertions',
'--use-test-fonts', '--use-test-fonts',
@ -689,7 +689,7 @@ void main() {
'--route=/test', '--route=/test',
'--trace-startup', '--trace-startup',
'--enable-impeller', '--enable-impeller',
'--observatory-port=1', '--vm-service-port=1',
].join(' '), ].join(' '),
); );
}); });

View file

@ -114,7 +114,7 @@ void main() {
]); ]);
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService); final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
final Device device = FakeDevice(LaunchResult.succeeded( final Device device = FakeDevice(LaunchResult.succeeded(
observatoryUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'), vmServiceUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'),
))..failOnce = true; ))..failOnce = true;
await expectLater( await expectLater(
@ -139,7 +139,7 @@ void main() {
]); ]);
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService); final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
final Device device = FakeDevice(LaunchResult.succeeded( final Device device = FakeDevice(LaunchResult.succeeded(
observatoryUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'), vmServiceUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'),
)); ));
await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true); await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true);
@ -170,7 +170,7 @@ void main() {
final FakeDevtoolsLauncher launcher = FakeDevtoolsLauncher(); final FakeDevtoolsLauncher launcher = FakeDevtoolsLauncher();
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService, devtoolsLauncher: launcher); final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService, devtoolsLauncher: launcher);
final Device device = FakeDevice(LaunchResult.succeeded( final Device device = FakeDevice(LaunchResult.succeeded(
observatoryUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'), vmServiceUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'),
)); ));
await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true); await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true);
@ -202,7 +202,7 @@ void main() {
]); ]);
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService); final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
final Device device = FakeDevice(LaunchResult.succeeded( final Device device = FakeDevice(LaunchResult.succeeded(
observatoryUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'), vmServiceUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'),
)); ));
await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true); await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true);
@ -232,7 +232,7 @@ void main() {
]); ]);
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService); final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
final Device device = FakeDevice(LaunchResult.succeeded( final Device device = FakeDevice(LaunchResult.succeeded(
observatoryUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'), vmServiceUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'),
)); ));
final FakeDartDevelopmentService dds = device.dds as FakeDartDevelopmentService; final FakeDartDevelopmentService dds = device.dds as FakeDartDevelopmentService;
@ -258,7 +258,7 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.empty(); final FakeProcessManager processManager = FakeProcessManager.empty();
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService); final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
final FakeDevice device = FakeDevice(LaunchResult.succeeded( final FakeDevice device = FakeDevice(LaunchResult.succeeded(
observatoryUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'), vmServiceUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'),
)); ));
await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true); await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true);
@ -290,7 +290,7 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.empty(); final FakeProcessManager processManager = FakeProcessManager.empty();
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService); final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
final FakeDevice device = FakeDevice(LaunchResult.succeeded( final FakeDevice device = FakeDevice(LaunchResult.succeeded(
observatoryUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'), vmServiceUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/'),
)); ));
await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true); await driverService.start(BuildInfo.profile, device, DebuggingOptions.enabled(BuildInfo.profile), true);
@ -551,7 +551,7 @@ class FakeDartDevelopmentService extends Fake implements DartDevelopmentService
@override @override
Future<void> startDartDevelopmentService( Future<void> startDartDevelopmentService(
Uri observatoryUri, { Uri vmServiceUri, {
required Logger logger, required Logger logger,
int? hostPort, int? hostPort,
bool? ipv6, bool? ipv6,

View file

@ -26,14 +26,14 @@ void main() {
group('FlutterPlatform', () { group('FlutterPlatform', () {
testUsingContext('ensureConfiguration throws an error if an ' testUsingContext('ensureConfiguration throws an error if an '
'explicitObservatoryPort is specified and more than one test file', () async { 'explicitVmServicePort is specified and more than one test file', () async {
final FlutterPlatform flutterPlatform = FlutterPlatform( final FlutterPlatform flutterPlatform = FlutterPlatform(
shellPath: '/', shellPath: '/',
debuggingOptions: DebuggingOptions.enabled( debuggingOptions: DebuggingOptions.enabled(
BuildInfo.debug, BuildInfo.debug,
hostVmServicePort: 1234, hostVmServicePort: 1234,
), ),
enableObservatory: false, enableVmService: false,
); );
flutterPlatform.loadChannel('test1.dart', FakeSuitePlatform()); flutterPlatform.loadChannel('test1.dart', FakeSuitePlatform());
@ -49,7 +49,7 @@ void main() {
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
shellPath: '/', shellPath: '/',
precompiledDillPath: 'example.dill', precompiledDillPath: 'example.dill',
enableObservatory: false, enableVmService: false,
); );
flutterPlatform.loadChannel('test1.dart', FakeSuitePlatform()); flutterPlatform.loadChannel('test1.dart', FakeSuitePlatform());
@ -87,7 +87,7 @@ void main() {
disableServiceAuthCodes: true, disableServiceAuthCodes: true,
hostVmServicePort: 200, hostVmServicePort: 200,
), ),
enableObservatory: true, enableVmService: true,
machine: true, machine: true,
precompiledDillPath: 'def', precompiledDillPath: 'def',
precompiledDillFiles: expectedPrecompiledDillFiles, precompiledDillFiles: expectedPrecompiledDillFiles,
@ -107,7 +107,7 @@ void main() {
expect(flutterPlatform.debuggingOptions.startPaused, equals(true)); expect(flutterPlatform.debuggingOptions.startPaused, equals(true));
expect(flutterPlatform.debuggingOptions.disableServiceAuthCodes, equals(true)); expect(flutterPlatform.debuggingOptions.disableServiceAuthCodes, equals(true));
expect(flutterPlatform.debuggingOptions.hostVmServicePort, equals(200)); expect(flutterPlatform.debuggingOptions.hostVmServicePort, equals(200));
expect(flutterPlatform.enableObservatory, equals(true)); expect(flutterPlatform.enableVmService, equals(true));
expect(flutterPlatform.machine, equals(true)); expect(flutterPlatform.machine, equals(true));
expect(flutterPlatform.host, InternetAddress.loopbackIPv6); expect(flutterPlatform.host, InternetAddress.loopbackIPv6);
expect(flutterPlatform.precompiledDillPath, equals('def')); expect(flutterPlatform.precompiledDillPath, equals('def'));

View file

@ -38,13 +38,13 @@ void main() {
FlutterTesterTestDevice createDevice({ FlutterTesterTestDevice createDevice({
List<String> dartEntrypointArgs = const <String>[], List<String> dartEntrypointArgs = const <String>[],
bool enableObservatory = false, bool enableVmService = false,
}) => }) =>
TestFlutterTesterDevice( TestFlutterTesterDevice(
platform: platform, platform: platform,
fileSystem: fileSystem, fileSystem: fileSystem,
processManager: processManager, processManager: processManager,
enableObservatory: enableObservatory, enableVmService: enableVmService,
dartEntrypointArgs: dartEntrypointArgs, dartEntrypointArgs: dartEntrypointArgs,
uriConverter: (String input) => '$input/converted', uriConverter: (String input) => '$input/converted',
); );
@ -63,7 +63,7 @@ void main() {
FakeCommand flutterTestCommand(String expectedFlutterTestValue) { FakeCommand flutterTestCommand(String expectedFlutterTestValue) {
return FakeCommand(command: const <String>[ return FakeCommand(command: const <String>[
'/', '/',
'--disable-observatory', '--disable-vm-service',
'--ipv6', '--ipv6',
'--enable-checked-mode', '--enable-checked-mode',
'--verify-entry-points', '--verify-entry-points',
@ -121,7 +121,7 @@ void main() {
const FakeCommand( const FakeCommand(
command: <String>[ command: <String>[
'/', '/',
'--disable-observatory', '--disable-vm-service',
'--ipv6', '--ipv6',
'--enable-checked-mode', '--enable-checked-mode',
'--verify-entry-points', '--verify-entry-points',
@ -156,7 +156,7 @@ void main() {
const FakeCommand( const FakeCommand(
command: <String>[ command: <String>[
'/', '/',
'--observatory-port=0', '--vm-service-port=0',
'--ipv6', '--ipv6',
'--enable-checked-mode', '--enable-checked-mode',
'--verify-entry-points', '--verify-entry-points',
@ -173,12 +173,12 @@ void main() {
stderr: 'failure', stderr: 'failure',
), ),
]); ]);
device = createDevice(enableObservatory: true); device = createDevice(enableVmService: true);
}); });
testUsingContext('skips setting observatory port and uses the input port for DDS instead', () async { testUsingContext('skips setting VM Service port and uses the input port for DDS instead', () async {
await device.start('example.dill'); await device.start('example.dill');
await device.observatoryUri; await device.vmServiceUri;
final Uri uri = await (device as TestFlutterTesterDevice).ddsServiceUriFuture(); final Uri uri = await (device as TestFlutterTesterDevice).ddsServiceUriFuture();
expect(uri.port, 1234); expect(uri.port, 1234);
@ -186,7 +186,7 @@ void main() {
testUsingContext('sets up UriConverter from context', () async { testUsingContext('sets up UriConverter from context', () async {
await device.start('example.dill'); await device.start('example.dill');
await device.observatoryUri; await device.vmServiceUri;
final FakeDartDevelopmentService dds = (device as TestFlutterTesterDevice).dds final FakeDartDevelopmentService dds = (device as TestFlutterTesterDevice).dds
as FakeDartDevelopmentService; as FakeDartDevelopmentService;
@ -206,7 +206,7 @@ class TestFlutterTesterDevice extends FlutterTesterTestDevice {
required super.platform, required super.platform,
required super.fileSystem, required super.fileSystem,
required super.processManager, required super.processManager,
required super.enableObservatory, required super.enableVmService,
required List<String> dartEntrypointArgs, required List<String> dartEntrypointArgs,
required UriConverter uriConverter, required UriConverter uriConverter,
}) : super( }) : super(

View file

@ -152,7 +152,7 @@ void main() {
final LaunchResult launchResult = final LaunchResult launchResult =
await setupAndStartApp(prebuilt: true, mode: BuildMode.release); await setupAndStartApp(prebuilt: true, mode: BuildMode.release);
expect(launchResult.started, isFalse); expect(launchResult.started, isFalse);
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasVmService, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => artifacts, Artifacts: () => artifacts,
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
@ -167,7 +167,7 @@ void main() {
final LaunchResult launchResult = final LaunchResult launchResult =
await setupAndStartApp(prebuilt: true, mode: BuildMode.release); await setupAndStartApp(prebuilt: true, mode: BuildMode.release);
expect(launchResult.started, isTrue); expect(launchResult.started, isTrue);
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasVmService, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => artifacts, Artifacts: () => artifacts,
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
@ -194,7 +194,7 @@ void main() {
final LaunchResult launchResult = await device.startApp(app, final LaunchResult launchResult = await device.startApp(app,
prebuiltApplication: true, debuggingOptions: debuggingOptions); prebuiltApplication: true, debuggingOptions: debuggingOptions);
expect(launchResult.started, isFalse); expect(launchResult.started, isFalse);
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasVmService, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => artifacts, Artifacts: () => artifacts,
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
@ -220,7 +220,7 @@ void main() {
final LaunchResult launchResult = await device.startApp(app, final LaunchResult launchResult = await device.startApp(app,
prebuiltApplication: true, debuggingOptions: debuggingOptions); prebuiltApplication: true, debuggingOptions: debuggingOptions);
expect(launchResult.started, isTrue); expect(launchResult.started, isTrue);
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasVmService, isFalse);
expect(await device.stopApp(app), isTrue); expect(await device.stopApp(app), isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => artifacts, Artifacts: () => artifacts,
@ -252,7 +252,7 @@ void main() {
final LaunchResult launchResult = final LaunchResult launchResult =
await setupAndStartApp(prebuilt: true, mode: BuildMode.debug); await setupAndStartApp(prebuilt: true, mode: BuildMode.debug);
expect(launchResult.started, isTrue); expect(launchResult.started, isTrue);
expect(launchResult.hasObservatory, isTrue); expect(launchResult.hasVmService, isTrue);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => artifacts, Artifacts: () => artifacts,
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
@ -413,7 +413,7 @@ void main() {
final LaunchResult launchResult = final LaunchResult launchResult =
await setupAndStartApp(prebuilt: true, mode: BuildMode.release); await setupAndStartApp(prebuilt: true, mode: BuildMode.release);
expect(launchResult.started, isFalse); expect(launchResult.started, isFalse);
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasVmService, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => artifacts, Artifacts: () => artifacts,
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,
@ -429,7 +429,7 @@ void main() {
final LaunchResult launchResult = final LaunchResult launchResult =
await setupAndStartApp(prebuilt: true, mode: BuildMode.release); await setupAndStartApp(prebuilt: true, mode: BuildMode.release);
expect(launchResult.started, isFalse); expect(launchResult.started, isFalse);
expect(launchResult.hasObservatory, isFalse); expect(launchResult.hasVmService, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Artifacts: () => artifacts, Artifacts: () => artifacts,
FileSystem: () => memoryFileSystem, FileSystem: () => memoryFileSystem,

View file

@ -1035,7 +1035,7 @@ class FakeDartDevelopmentService extends Fake
implements DartDevelopmentService { implements DartDevelopmentService {
@override @override
Future<void> startDartDevelopmentService( Future<void> startDartDevelopmentService(
Uri observatoryUri, { Uri vmServiceUri, {
required Logger logger, required Logger logger,
int? hostPort, int? hostPort,
bool? ipv6, bool? ipv6,

View file

@ -58,7 +58,7 @@ final FakeVmServiceRequest listViewsRequest = FakeVmServiceRequest(
}, },
); );
final Uri observatoryUri = Uri.parse('http://localhost:1234'); final Uri vmServiceUri = Uri.parse('http://localhost:1234');
void main() { void main() {
late FakeVmServiceHost fakeVmServiceHost; late FakeVmServiceHost fakeVmServiceHost;
@ -71,7 +71,7 @@ void main() {
'ephemeral', 'ephemeral',
'ephemeral', 'ephemeral',
type: PlatformType.android, type: PlatformType.android,
launchResult: LaunchResult.succeeded(observatoryUri: observatoryUri), launchResult: LaunchResult.succeeded(vmServiceUri: vmServiceUri),
), ),
debuggingOptions: DebuggingOptions.enabled( debuggingOptions: DebuggingOptions.enabled(
BuildInfo.debug, BuildInfo.debug,
@ -126,7 +126,7 @@ void main() {
testUsingContext('Can start the entrypoint', () async { testUsingContext('Can start the entrypoint', () async {
await testDevice.start('entrypointPath'); await testDevice.start('entrypointPath');
expect(await testDevice.observatoryUri, observatoryUri); expect(await testDevice.vmServiceUri, vmServiceUri);
expect(testDevice.finished, doesNotComplete); expect(testDevice.finished, doesNotComplete);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ApplicationPackageFactory: () => FakeApplicationPackageFactory(), ApplicationPackageFactory: () => FakeApplicationPackageFactory(),
@ -161,7 +161,7 @@ void main() {
}) async => fakeVmServiceHost.vmService, }) async => fakeVmServiceHost.vmService,
}); });
testUsingContext('when the device starts without providing an observatory URI', () async { testUsingContext('when the device starts without providing an vmService URI', () async {
final TestDevice testDevice = IntegrationTestTestDevice( final TestDevice testDevice = IntegrationTestTestDevice(
id: 1, id: 1,
device: FakeDevice( device: FakeDevice(

View file

@ -85,7 +85,7 @@ FakeCommand attachDebuggerCommand({
if (!isNetworkDevice) '--no-wifi', if (!isNetworkDevice) '--no-wifi',
'--args', '--args',
if (isNetworkDevice) if (isNetworkDevice)
'--enable-dart-profiling --enable-checked-mode --verify-entry-points --observatory-host=0.0.0.0' '--enable-dart-profiling --enable-checked-mode --verify-entry-points --vm-service-host=0.0.0.0'
else else
'--enable-dart-profiling --enable-checked-mode --verify-entry-points', '--enable-dart-profiling --enable-checked-mode --verify-entry-points',
], ],
@ -152,7 +152,7 @@ void main() {
); );
expect(launchResult.started, true); expect(launchResult.started, true);
expect(launchResult.hasObservatory, true); expect(launchResult.hasVmService, true);
expect(await device.stopApp(iosApp), false); expect(await device.stopApp(iosApp), false);
}); });
@ -190,7 +190,7 @@ void main() {
); );
expect(launchResult.started, true); expect(launchResult.started, true);
expect(launchResult.hasObservatory, true); expect(launchResult.hasVmService, true);
expect(await device.stopApp(iosApp), false); expect(await device.stopApp(iosApp), false);
}); });
@ -230,7 +230,7 @@ void main() {
); );
expect(launchResult.started, true); expect(launchResult.started, true);
expect(launchResult.hasObservatory, true); expect(launchResult.hasVmService, true);
expect(await device.stopApp(iosApp), false); expect(await device.stopApp(iosApp), false);
expect(logger.errorText, contains('The Dart VM Service was not discovered after 30 seconds. This is taking much longer than expected...')); expect(logger.errorText, contains('The Dart VM Service was not discovered after 30 seconds. This is taking much longer than expected...'));
expect(utf8.decoder.convert(stdin.writes.first), contains('process interrupt')); expect(utf8.decoder.convert(stdin.writes.first), contains('process interrupt'));
@ -275,7 +275,7 @@ void main() {
); );
expect(launchResult.started, true); expect(launchResult.started, true);
expect(launchResult.hasObservatory, true); expect(launchResult.hasVmService, true);
expect(await device.stopApp(iosApp), false); expect(await device.stopApp(iosApp), false);
expect(logger.errorText, contains('The Dart VM Service was not discovered after 45 seconds. This is taking much longer than expected...')); expect(logger.errorText, contains('The Dart VM Service was not discovered after 45 seconds. This is taking much longer than expected...'));
expect(logger.errorText, contains('Click "Allow" to the prompt asking if you would like to find and connect devices on your local network.')); expect(logger.errorText, contains('Click "Allow" to the prompt asking if you would like to find and connect devices on your local network.'));
@ -308,7 +308,7 @@ void main() {
); );
expect(launchResult.started, true); expect(launchResult.started, true);
expect(launchResult.hasObservatory, false); expect(launchResult.hasVmService, false);
expect(await device.stopApp(iosApp), false); expect(await device.stopApp(iosApp), false);
expect(processManager, hasNoRemainingExpectations); expect(processManager, hasNoRemainingExpectations);
}); });
@ -335,7 +335,7 @@ void main() {
<String>[ <String>[
'--enable-dart-profiling', '--enable-dart-profiling',
'--disable-service-auth-codes', '--disable-service-auth-codes',
'--disable-observatory-publication', '--disable-vm-service-publication',
'--start-paused', '--start-paused',
'--dart-flags="--foo,--null_assertions"', '--dart-flags="--foo,--null_assertions"',
'--use-test-fonts', '--use-test-fonts',

View file

@ -1067,7 +1067,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
'--purge-persistent-cache', '--purge-persistent-cache',
'--dart-flags=--baz,--null_assertions', '--dart-flags=--baz,--null_assertions',
'--enable-impeller', '--enable-impeller',
'--observatory-port=0', '--vm-service-port=0',
])); ]));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
PlistParser: () => testPlistParser, PlistParser: () => testPlistParser,

View file

@ -78,7 +78,7 @@ void main() {
); );
expect(result.started, true); expect(result.started, true);
expect(result.observatoryUri, Uri.parse('http://127.0.0.1:64494/fZ_B2N6JRwY=/')); expect(result.vmServiceUri, Uri.parse('http://127.0.0.1:64494/fZ_B2N6JRwY=/'));
}); });
} }

View file

@ -17,7 +17,7 @@ void main() {
setUp(() { setUp(() {
logReader = FakeDeviceLogReader(); logReader = FakeDeviceLogReader();
discoverer = ProtocolDiscovery.observatory( discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
ipv6: false, ipv6: false,
throttleDuration: const Duration(milliseconds: 5), throttleDuration: const Duration(milliseconds: 5),
@ -106,7 +106,7 @@ void main() {
testWithoutContext('uri waits for correct log line', () async { testWithoutContext('uri waits for correct log line', () async {
final Future<Uri?> uriFuture = discoverer.uri; final Future<Uri?> uriFuture = discoverer.uri;
logReader.addLine('Observatory not listening...'); logReader.addLine('VM Service not listening...');
final Uri timeoutUri = Uri.parse('http://timeout'); final Uri timeoutUri = Uri.parse('http://timeout');
final Uri? actualUri = await uriFuture.timeout( final Uri? actualUri = await uriFuture.timeout(
const Duration(milliseconds: 100), const Duration(milliseconds: 100),
@ -139,7 +139,7 @@ void main() {
}); });
testWithoutContext('skips uri if port does not match the requested vmservice - requested last', () async { testWithoutContext('skips uri if port does not match the requested vmservice - requested last', () async {
discoverer = ProtocolDiscovery.observatory( discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
ipv6: false, ipv6: false,
devicePort: 12346, devicePort: 12346,
@ -155,7 +155,7 @@ void main() {
}); });
testWithoutContext('skips uri if port does not match the requested vmservice - requested first', () async { testWithoutContext('skips uri if port does not match the requested vmservice - requested first', () async {
discoverer = ProtocolDiscovery.observatory( discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
ipv6: false, ipv6: false,
devicePort: 12346, devicePort: 12346,
@ -179,7 +179,7 @@ void main() {
}); });
testWithoutContext('first uri in the stream is the last one from the log that matches the port', () async { testWithoutContext('first uri in the stream is the last one from the log that matches the port', () async {
discoverer = ProtocolDiscovery.observatory( discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
ipv6: false, ipv6: false,
devicePort: 12345, devicePort: 12345,
@ -195,7 +195,7 @@ void main() {
}); });
testWithoutContext('protocol discovery does not crash if the log reader is closed while delaying', () async { testWithoutContext('protocol discovery does not crash if the log reader is closed while delaying', () async {
discoverer = ProtocolDiscovery.observatory( discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
ipv6: false, ipv6: false,
devicePort: 12346, devicePort: 12346,
@ -216,7 +216,7 @@ void main() {
const Duration kThrottleDuration = Duration(milliseconds: 10); const Duration kThrottleDuration = Duration(milliseconds: 10);
FakeAsync().run((FakeAsync time) { FakeAsync().run((FakeAsync time) {
discoverer = ProtocolDiscovery.observatory( discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
ipv6: false, ipv6: false,
throttleDuration: kThrottleDuration, throttleDuration: kThrottleDuration,
@ -250,7 +250,7 @@ void main() {
const Duration kThrottleTimeInMilliseconds = Duration(milliseconds: 10); const Duration kThrottleTimeInMilliseconds = Duration(milliseconds: 10);
FakeAsync().run((FakeAsync time) { FakeAsync().run((FakeAsync time) {
discoverer = ProtocolDiscovery.observatory( discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
ipv6: false, ipv6: false,
devicePort: 12345, devicePort: 12345,
@ -285,7 +285,7 @@ void main() {
group('port forwarding', () { group('port forwarding', () {
testWithoutContext('default port', () async { testWithoutContext('default port', () async {
final FakeDeviceLogReader logReader = FakeDeviceLogReader(); final FakeDeviceLogReader logReader = FakeDeviceLogReader();
final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( final ProtocolDiscovery discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
portForwarder: MockPortForwarder(99), portForwarder: MockPortForwarder(99),
ipv6: false, ipv6: false,
@ -305,7 +305,7 @@ void main() {
testWithoutContext('specified port', () async { testWithoutContext('specified port', () async {
final FakeDeviceLogReader logReader = FakeDeviceLogReader(); final FakeDeviceLogReader logReader = FakeDeviceLogReader();
final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( final ProtocolDiscovery discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
portForwarder: MockPortForwarder(99), portForwarder: MockPortForwarder(99),
hostPort: 1243, hostPort: 1243,
@ -326,7 +326,7 @@ void main() {
testWithoutContext('specified port zero', () async { testWithoutContext('specified port zero', () async {
final FakeDeviceLogReader logReader = FakeDeviceLogReader(); final FakeDeviceLogReader logReader = FakeDeviceLogReader();
final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( final ProtocolDiscovery discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
portForwarder: MockPortForwarder(99), portForwarder: MockPortForwarder(99),
hostPort: 0, hostPort: 0,
@ -347,7 +347,7 @@ void main() {
testWithoutContext('ipv6', () async { testWithoutContext('ipv6', () async {
final FakeDeviceLogReader logReader = FakeDeviceLogReader(); final FakeDeviceLogReader logReader = FakeDeviceLogReader();
final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( final ProtocolDiscovery discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
portForwarder: MockPortForwarder(99), portForwarder: MockPortForwarder(99),
hostPort: 54777, hostPort: 54777,
@ -368,7 +368,7 @@ void main() {
testWithoutContext('ipv6 with Ascii Escape code', () async { testWithoutContext('ipv6 with Ascii Escape code', () async {
final FakeDeviceLogReader logReader = FakeDeviceLogReader(); final FakeDeviceLogReader logReader = FakeDeviceLogReader();
final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( final ProtocolDiscovery discoverer = ProtocolDiscovery.vmService(
logReader, logReader,
portForwarder: MockPortForwarder(99), portForwarder: MockPortForwarder(99),
hostPort: 54777, hostPort: 54777,

View file

@ -421,7 +421,7 @@ void main() {
expect(handler.launchedInBrowser, isTrue); expect(handler.launchedInBrowser, isTrue);
}); });
testWithoutContext('Converts a VmService URI with a query parameter to a pretty display string', () { testWithoutContext('Converts a VM Service URI with a query parameter to a pretty display string', () {
const String value = 'http://127.0.0.1:9100?uri=http%3A%2F%2F127.0.0.1%3A57922%2F_MXpzytpH20%3D%2F'; const String value = 'http://127.0.0.1:9100?uri=http%3A%2F%2F127.0.0.1%3A57922%2F_MXpzytpH20%3D%2F';
final Uri uri = Uri.parse(value); final Uri uri = Uri.parse(value);

View file

@ -1492,7 +1492,7 @@ flutter:
commandHelp.c, commandHelp.c,
commandHelp.q, commandHelp.q,
'', '',
'An Observatory debugger and profiler on FakeDevice is available at: null', 'A Dart VM Service on FakeDevice is available at: null',
'', '',
].join('\n') ].join('\n')
)); ));
@ -1521,7 +1521,7 @@ flutter:
commandHelp.c, commandHelp.c,
commandHelp.q, commandHelp.q,
'', '',
'An Observatory debugger and profiler on FakeDevice is available at: null', 'A Dart VM Service on FakeDevice is available at: null',
'', '',
].join('\n') ].join('\n')
)); ));
@ -2123,7 +2123,7 @@ flutter:
}; };
final TestFlutterDevice flutterDevice = TestFlutterDevice( final TestFlutterDevice flutterDevice = TestFlutterDevice(
device, device,
observatoryUris: Stream<Uri>.value(testUri), vmServiceUris: Stream<Uri>.value(testUri),
); );
bool caught = false; bool caught = false;
final Completer<void>done = Completer<void>(); final Completer<void>done = Completer<void>();
@ -2166,7 +2166,7 @@ flutter:
}; };
final TestFlutterDevice flutterDevice = TestFlutterDevice( final TestFlutterDevice flutterDevice = TestFlutterDevice(
device, device,
observatoryUris: Stream<Uri>.value(testUri), vmServiceUris: Stream<Uri>.value(testUri),
); );
final Completer<void> done = Completer<void>(); final Completer<void> done = Completer<void>();
await runZonedGuarded( await runZonedGuarded(
@ -2199,7 +2199,7 @@ flutter:
}; };
final TestFlutterDevice flutterDevice = TestFlutterDevice( final TestFlutterDevice flutterDevice = TestFlutterDevice(
device, device,
observatoryUris: Stream<Uri>.value(testUri), vmServiceUris: Stream<Uri>.value(testUri),
); );
final Completer<void>done = Completer<void>(); final Completer<void>done = Completer<void>();
await runZonedGuarded( await runZonedGuarded(
@ -2238,7 +2238,7 @@ flutter:
}; };
final TestFlutterDevice flutterDevice = TestFlutterDevice( final TestFlutterDevice flutterDevice = TestFlutterDevice(
device, device,
observatoryUris: Stream<Uri>.value(testUri), vmServiceUris: Stream<Uri>.value(testUri),
); );
await flutterDevice.connect(allowExistingDdsInstance: true, ipv6: true, disableServiceAuthCodes: true); await flutterDevice.connect(allowExistingDdsInstance: true, ipv6: true, disableServiceAuthCodes: true);
await done.future; await done.future;
@ -2279,7 +2279,7 @@ flutter:
}; };
final TestFlutterDevice flutterDevice = TestFlutterDevice( final TestFlutterDevice flutterDevice = TestFlutterDevice(
device, device,
observatoryUris: Stream<Uri>.value(testUri), vmServiceUris: Stream<Uri>.value(testUri),
); );
await flutterDevice.connect(allowExistingDdsInstance: true, ipv6: true, disableServiceAuthCodes: true); await flutterDevice.connect(allowExistingDdsInstance: true, ipv6: true, disableServiceAuthCodes: true);
await done.future; await done.future;
@ -2319,7 +2319,7 @@ flutter:
}; };
final TestFlutterDevice flutterDevice = TestFlutterDevice( final TestFlutterDevice flutterDevice = TestFlutterDevice(
device, device,
observatoryUris: Stream<Uri>.value(testUri), vmServiceUris: Stream<Uri>.value(testUri),
); );
bool caught = false; bool caught = false;
final Completer<void>done = Completer<void>(); final Completer<void>done = Completer<void>();
@ -2487,13 +2487,13 @@ class FakeDartDevelopmentServiceException implements dds.DartDevelopmentServiceE
} }
class TestFlutterDevice extends FlutterDevice { class TestFlutterDevice extends FlutterDevice {
TestFlutterDevice(super.device, { Stream<Uri>? observatoryUris }) TestFlutterDevice(super.device, { Stream<Uri>? vmServiceUris })
: _observatoryUris = observatoryUris, super(buildInfo: BuildInfo.debug, developmentShaderCompiler: const FakeShaderCompiler()); : _vmServiceUris = vmServiceUris, super(buildInfo: BuildInfo.debug, developmentShaderCompiler: const FakeShaderCompiler());
final Stream<Uri>? _observatoryUris; final Stream<Uri>? _vmServiceUris;
@override @override
Stream<Uri> get observatoryUris => _observatoryUris!; Stream<Uri> get vmServiceUris => _vmServiceUris!;
} }
class ThrowingForwardingFileSystem extends ForwardingFileSystem { class ThrowingForwardingFileSystem extends ForwardingFileSystem {
@ -2530,7 +2530,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
TargetPlatform get targetPlatform => TargetPlatform.android; TargetPlatform get targetPlatform => TargetPlatform.android;
@override @override
Stream<Uri?> get observatoryUris => Stream<Uri?>.value(testUri); Stream<Uri?> get vmServiceUris => Stream<Uri?>.value(testUri);
@override @override
FlutterVmService? get vmService => vmServiceHost?.call()?.vmService; FlutterVmService? get vmService => vmServiceHost?.call()?.vmService;

View file

@ -1597,7 +1597,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
ResidentCompiler? generator; ResidentCompiler? generator;
@override @override
Stream<Uri?> get observatoryUris => Stream<Uri?>.value(testUri); Stream<Uri?> get vmServiceUris => Stream<Uri?>.value(testUri);
@override @override
DevelopmentShaderCompiler get developmentShaderCompiler => const FakeShaderCompiler(); DevelopmentShaderCompiler get developmentShaderCompiler => const FakeShaderCompiler();

View file

@ -10,7 +10,7 @@ import '../../src/common.dart';
void main() { void main() {
group(EventPrinter, () { group(EventPrinter, () {
final Uri observatoryUri = Uri.parse('http://localhost:1234'); final Uri vmServiceUri = Uri.parse('http://localhost:1234');
late EventPrinter eventPrinter; late EventPrinter eventPrinter;
late StringBuffer output; late StringBuffer output;
@ -23,30 +23,32 @@ void main() {
final FakeDevice device = FakeDevice(); final FakeDevice device = FakeDevice();
expect(() => eventPrinter.handleFinishedTest(device), returnsNormally); expect(() => eventPrinter.handleFinishedTest(device), returnsNormally);
expect(() => eventPrinter.handleStartedDevice(observatoryUri), returnsNormally); expect(() => eventPrinter.handleStartedDevice(vmServiceUri), returnsNormally);
expect(() => eventPrinter.handleTestCrashed(device), returnsNormally); expect(() => eventPrinter.handleTestCrashed(device), returnsNormally);
expect(() => eventPrinter.handleTestTimedOut(device), returnsNormally); expect(() => eventPrinter.handleTestTimedOut(device), returnsNormally);
}); });
group('handleStartedDevice', () { group('handleStartedDevice', () {
testWithoutContext('with non-null observatory', () { testWithoutContext('with non-null VM Service', () {
eventPrinter.handleStartedDevice(observatoryUri); eventPrinter.handleStartedDevice(vmServiceUri);
expect( expect(
output.toString(), output.toString(),
'\n' '\n'
'[{"event":"test.startedProcess","params":{"observatoryUri":"http://localhost:1234"}}]' '[{"event":"test.startedProcess","params":{"vmServiceUri":"http://localhost:1234",'
'"observatoryUri":"http://localhost:1234"}}]'
'\n', '\n',
); );
}); });
testWithoutContext('with null observatory', () { testWithoutContext('with null VM Service', () {
eventPrinter.handleStartedDevice(null); eventPrinter.handleStartedDevice(null);
expect( expect(
output.toString(), output.toString(),
'\n' '\n'
'[{"event":"test.startedProcess","params":{"observatoryUri":null}}]' '[{"event":"test.startedProcess","params":{"vmServiceUri":null,'
'"observatoryUri":null}}]'
'\n', '\n',
); );
}); });

View file

@ -140,7 +140,7 @@ void main() {
testUsingContext('performs a build and starts in debug mode', () async { testUsingContext('performs a build and starts in debug mode', () async {
final FlutterTesterApp app = FlutterTesterApp.fromCurrentDirectory(fileSystem); final FlutterTesterApp app = FlutterTesterApp.fromCurrentDirectory(fileSystem);
final Uri observatoryUri = Uri.parse('http://127.0.0.1:6666/'); final Uri vmServiceUri = Uri.parse('http://127.0.0.1:6666/');
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
fakeProcessManager.addCommand(FakeCommand( fakeProcessManager.addCommand(FakeCommand(
command: const <String>[ command: const <String>[
@ -155,7 +155,7 @@ void main() {
completer: completer, completer: completer,
stdout: stdout:
''' '''
The Dart VM service is listening on $observatoryUri The Dart VM service is listening on $vmServiceUri
Hello! Hello!
''', ''',
)); ));
@ -166,14 +166,14 @@ Hello!
); );
expect(result.started, isTrue); expect(result.started, isTrue);
expect(result.observatoryUri, observatoryUri); expect(result.vmServiceUri, vmServiceUri);
expect(logLines.last, 'Hello!'); expect(logLines.last, 'Hello!');
expect(fakeProcessManager, hasNoRemainingExpectations); expect(fakeProcessManager, hasNoRemainingExpectations);
}, overrides: startOverrides); }, overrides: startOverrides);
testUsingContext('performs a build and starts in debug mode with track-widget-creation', () async { testUsingContext('performs a build and starts in debug mode with track-widget-creation', () async {
final FlutterTesterApp app = FlutterTesterApp.fromCurrentDirectory(fileSystem); final FlutterTesterApp app = FlutterTesterApp.fromCurrentDirectory(fileSystem);
final Uri observatoryUri = Uri.parse('http://127.0.0.1:6666/'); final Uri vmServiceUri = Uri.parse('http://127.0.0.1:6666/');
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
fakeProcessManager.addCommand(FakeCommand( fakeProcessManager.addCommand(FakeCommand(
command: const <String>[ command: const <String>[
@ -188,7 +188,7 @@ Hello!
completer: completer, completer: completer,
stdout: stdout:
''' '''
The Dart VM service is listening on $observatoryUri The Dart VM service is listening on $vmServiceUri
Hello! Hello!
''', ''',
)); ));
@ -199,7 +199,7 @@ Hello!
); );
expect(result.started, isTrue); expect(result.started, isTrue);
expect(result.observatoryUri, observatoryUri); expect(result.vmServiceUri, vmServiceUri);
expect(logLines.last, 'Hello!'); expect(logLines.last, 'Hello!');
expect(fakeProcessManager, hasNoRemainingExpectations); expect(fakeProcessManager, hasNoRemainingExpectations);
}, overrides: startOverrides); }, overrides: startOverrides);

View file

@ -59,7 +59,7 @@ final FakeVmServiceRequest listViewsRequest = FakeVmServiceRequest(
); );
void main() { void main() {
testWithoutContext('VmService registers reloadSources', () async { testWithoutContext('VM Service registers reloadSources', () async {
Future<void> reloadSources(String isolateId, { bool? pause, bool? force}) async {} Future<void> reloadSources(String isolateId, { bool? pause, bool? force}) async {}
final MockVMService mockVMService = MockVMService(); final MockVMService mockVMService = MockVMService();
@ -76,7 +76,7 @@ void main() {
expect(mockVMService.services, containsPair('reloadSources', 'Flutter Tools')); expect(mockVMService.services, containsPair('reloadSources', 'Flutter Tools'));
}); });
testWithoutContext('VmService registers flutterMemoryInfo service', () async { testWithoutContext('VM Service registers flutterMemoryInfo service', () async {
final FakeDevice mockDevice = FakeDevice(); final FakeDevice mockDevice = FakeDevice();
final MockVMService mockVMService = MockVMService(); final MockVMService mockVMService = MockVMService();
@ -93,7 +93,7 @@ void main() {
expect(mockVMService.services, containsPair('flutterMemoryInfo', 'Flutter Tools')); expect(mockVMService.services, containsPair('flutterMemoryInfo', 'Flutter Tools'));
}); });
testWithoutContext('VmService registers flutterGetSkSL service', () async { testWithoutContext('VM Service registers flutterGetSkSL service', () async {
final MockVMService mockVMService = MockVMService(); final MockVMService mockVMService = MockVMService();
await setUpVmService( await setUpVmService(
null, null,
@ -108,7 +108,7 @@ void main() {
expect(mockVMService.services, containsPair('flutterGetSkSL', 'Flutter Tools')); expect(mockVMService.services, containsPair('flutterGetSkSL', 'Flutter Tools'));
}); });
testWithoutContext('VmService throws tool exit on service registration failure.', () async { testWithoutContext('VM Service throws tool exit on service registration failure.', () async {
final MockVMService mockVMService = MockVMService() final MockVMService mockVMService = MockVMService()
..errorOnRegisterService = true; ..errorOnRegisterService = true;
@ -123,7 +123,7 @@ void main() {
), throwsToolExit()); ), throwsToolExit());
}); });
testWithoutContext('VmService throws tool exit on service registration failure with awaited future.', () async { testWithoutContext('VM Service throws tool exit on service registration failure with awaited future.', () async {
final MockVMService mockVMService = MockVMService() final MockVMService mockVMService = MockVMService()
..errorOnRegisterService = true; ..errorOnRegisterService = true;
@ -138,7 +138,7 @@ void main() {
), throwsToolExit()); ), throwsToolExit());
}); });
testWithoutContext('VmService registers flutterPrintStructuredErrorLogMethod', () async { testWithoutContext('VM Service registers flutterPrintStructuredErrorLogMethod', () async {
final MockVMService mockVMService = MockVMService(); final MockVMService mockVMService = MockVMService();
await setUpVmService( await setUpVmService(
null, null,
@ -152,7 +152,7 @@ void main() {
expect(mockVMService.listenedStreams, contains(vm_service.EventStreams.kExtension)); expect(mockVMService.listenedStreams, contains(vm_service.EventStreams.kExtension));
}); });
testWithoutContext('VMService returns correct FlutterVersion', () async { testWithoutContext('VM Service returns correct FlutterVersion', () async {
final MockVMService mockVMService = MockVMService(); final MockVMService mockVMService = MockVMService();
await setUpVmService( await setUpVmService(
null, null,
@ -167,7 +167,7 @@ void main() {
expect(mockVMService.services, containsPair('flutterVersion', 'Flutter Tools')); expect(mockVMService.services, containsPair('flutterVersion', 'Flutter Tools'));
}); });
testUsingContext('VMService prints messages for connection failures', () { testUsingContext('VM Service prints messages for connection failures', () {
final BufferLogger logger = BufferLogger.test(); final BufferLogger logger = BufferLogger.test();
FakeAsync().run((FakeAsync time) { FakeAsync().run((FakeAsync time) {
final Uri uri = Uri.parse('ws://127.0.0.1:12345/QqL7EFEDNG0=/ws'); final Uri uri = Uri.parse('ws://127.0.0.1:12345/QqL7EFEDNG0=/ws');

View file

@ -40,7 +40,7 @@ void main() {
processManager.addCommand(FakeCommand( processManager.addCommand(FakeCommand(
command: const <String>[ command: const <String>[
'shell', 'shell',
'--disable-observatory', '--disable-vm-service',
'--non-interactive', '--non-interactive',
'--packages=.dart_tool/package_config.json', '--packages=.dart_tool/package_config.json',
'compiler_output', 'compiler_output',
@ -74,7 +74,7 @@ void main() {
processManager.addCommand(FakeCommand( processManager.addCommand(FakeCommand(
command: const <String>[ command: const <String>[
'shell', 'shell',
'--disable-observatory', '--disable-vm-service',
'--non-interactive', '--non-interactive',
'--packages=.dart_tool/package_config.json', '--packages=.dart_tool/package_config.json',
'compiler_output', 'compiler_output',
@ -107,7 +107,7 @@ void main() {
processManager.addCommand(FakeCommand( processManager.addCommand(FakeCommand(
command: const <String>[ command: const <String>[
'shell', 'shell',
'--disable-observatory', '--disable-vm-service',
'--non-interactive', '--non-interactive',
'--packages=.dart_tool/package_config.json', '--packages=.dart_tool/package_config.json',
'compiler_output', 'compiler_output',
@ -143,7 +143,7 @@ void main() {
processManager.addCommand(FakeCommand( processManager.addCommand(FakeCommand(
command: const <String>[ command: const <String>[
'shell', 'shell',
'--disable-observatory', '--disable-vm-service',
'--non-interactive', '--non-interactive',
'--packages=.dart_tool/package_config.json', '--packages=.dart_tool/package_config.json',
'compiler_output', 'compiler_output',
@ -152,7 +152,7 @@ void main() {
processManager.addCommand(FakeCommand( processManager.addCommand(FakeCommand(
command: const <String>[ command: const <String>[
'shell', 'shell',
'--disable-observatory', '--disable-vm-service',
'--non-interactive', '--non-interactive',
'--packages=.dart_tool/package_config.json', '--packages=.dart_tool/package_config.json',
'compiler_output', 'compiler_output',
@ -186,7 +186,7 @@ void main() {
processManager.addCommand(FakeCommand( processManager.addCommand(FakeCommand(
command: const <String>[ command: const <String>[
'shell', 'shell',
'--disable-observatory', '--disable-vm-service',
'--non-interactive', '--non-interactive',
'--packages=.dart_tool/package_config.json', '--packages=.dart_tool/package_config.json',
'compiler_output', 'compiler_output',

View file

@ -195,12 +195,12 @@ void main() {
}); });
}); });
group('test_observatory_bonjour_service', () { group('test_vm_service_bonjour_service', () {
test('handles when the Info.plist is missing', () { test('handles when the Info.plist is missing', () {
final Directory buildDir = fileSystem.directory('/path/to/builds'); final Directory buildDir = fileSystem.directory('/path/to/builds');
buildDir.createSync(recursive: true); buildDir.createSync(recursive: true);
final TestContext context = TestContext( final TestContext context = TestContext(
<String>['test_observatory_bonjour_service'], <String>['test_vm_service_bonjour_service'],
<String, String>{ <String, String>{
'CONFIGURATION': 'Debug', 'CONFIGURATION': 'Debug',
'BUILT_PRODUCTS_DIR': buildDir.path, 'BUILT_PRODUCTS_DIR': buildDir.path,
@ -212,7 +212,7 @@ void main() {
expect( expect(
context.stdout, context.stdout,
contains( contains(
'Info.plist does not exist. Skipping _dartobservatory._tcp NSBonjourServices insertion.'), 'Info.plist does not exist. Skipping _dartVmService._tcp NSBonjourServices insertion.'),
); );
}); });
}); });

View file

@ -157,7 +157,7 @@ void main() {
expect(_containsBitcode(outputFlutterFrameworkBinary.path, processManager), isFalse); expect(_containsBitcode(outputFlutterFrameworkBinary.path, processManager), isFalse);
}); });
testWithoutContext('Info.plist dart observatory Bonjour service', () { testWithoutContext('Info.plist dart VM Service Bonjour service', () {
final String infoPlistPath = fileSystem.path.join( final String infoPlistPath = fileSystem.path.join(
outputApp.path, outputApp.path,
'Info.plist', 'Info.plist',
@ -173,7 +173,7 @@ void main() {
infoPlistPath, infoPlistPath,
], ],
); );
final bool bonjourServicesFound = (bonjourServices.stdout as String).contains('_dartobservatory._tcp'); final bool bonjourServicesFound = (bonjourServices.stdout as String).contains('_dartVmService._tcp');
expect(bonjourServicesFound, buildMode == BuildMode.debug); expect(bonjourServicesFound, buildMode == BuildMode.debug);
final ProcessResult localNetworkUsage = processManager.runSync( final ProcessResult localNetworkUsage = processManager.runSync(

View file

@ -52,7 +52,7 @@ void main() {
transformToLines(process.stdout).listen((String line) async { transformToLines(process.stdout).listen((String line) async {
stdout.writeln(line); stdout.writeln(line);
if (line.startsWith('An Observatory debugger')) { if (line.startsWith('A Dart VM Service on')) {
final RegExp exp = RegExp(r'http://127.0.0.1:(\d+)/'); final RegExp exp = RegExp(r'http://127.0.0.1:(\d+)/');
final RegExpMatch match = exp.firstMatch(line)!; final RegExpMatch match = exp.firstMatch(line)!;
final String port = match.group(1)!; final String port = match.group(1)!;

View file

@ -20,13 +20,13 @@ Future<int> getFreePort() async {
return port; return port;
} }
Future<void> waitForObservatoryMessage(Process process, int port) async { Future<void> waitForVmServiceMessage(Process process, int port) async {
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
process.stdout process.stdout
.transform(utf8.decoder) .transform(utf8.decoder)
.listen((String line) { .listen((String line) {
printOnFailure(line); printOnFailure(line);
if (line.contains('An Observatory debugger and profiler on Flutter test device is available at')) { if (line.contains('A Dart VM Service on Flutter test device is available at')) {
if (line.contains('http://127.0.0.1:$port')) { if (line.contains('http://127.0.0.1:$port')) {
completer.complete(); completer.complete();
} else { } else {
@ -53,43 +53,43 @@ void main() {
tryToDelete(tempDir); tryToDelete(tempDir);
}); });
testWithoutContext('flutter run --observatory-port', () async { testWithoutContext('flutter run --vm-service-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int port = await getFreePort(); final int port = await getFreePort();
// If only --observatory-port is provided, --observatory-port will be used by DDS // If only --vm-service-port is provided, --vm-service-port will be used by DDS
// and the VM service will bind to a random port. // and the VM service will bind to a random port.
final Process process = await processManager.start(<String>[ final Process process = await processManager.start(<String>[
flutterBin, flutterBin,
'run', 'run',
'--show-test-device', '--show-test-device',
'--observatory-port=$port', '--vm-service-port=$port',
'-d', '-d',
'flutter-tester', 'flutter-tester',
], workingDirectory: tempDir.path); ], workingDirectory: tempDir.path);
await waitForObservatoryMessage(process, port); await waitForVmServiceMessage(process, port);
process.kill(); process.kill();
await process.exitCode; await process.exitCode;
}); });
testWithoutContext('flutter run --dds-port --observatory-port', () async { testWithoutContext('flutter run --dds-port --vm-service-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int observatoryPort = await getFreePort(); final int vmServicePort = await getFreePort();
int ddsPort = await getFreePort(); int ddsPort = await getFreePort();
while(ddsPort == observatoryPort) { while(ddsPort == vmServicePort) {
ddsPort = await getFreePort(); ddsPort = await getFreePort();
} }
// If both --dds-port and --observatory-port are provided, --dds-port will be used by // If both --dds-port and --vm-service-port are provided, --dds-port will be used by
// DDS and --observatory-port will be used by the VM service. // DDS and --vm-service-port will be used by the VM service.
final Process process = await processManager.start(<String>[ final Process process = await processManager.start(<String>[
flutterBin, flutterBin,
'run', 'run',
'--show-test-device', '--show-test-device',
'--observatory-port=$observatoryPort', '--vm-service-port=$vmServicePort',
'--dds-port=$ddsPort', '--dds-port=$ddsPort',
'-d', '-d',
'flutter-tester', 'flutter-tester',
], workingDirectory: tempDir.path); ], workingDirectory: tempDir.path);
await waitForObservatoryMessage(process, ddsPort); await waitForVmServiceMessage(process, ddsPort);
process.kill(); process.kill();
await process.exitCode; await process.exitCode;
}); });
@ -107,7 +107,7 @@ void main() {
'-d', '-d',
'flutter-tester', 'flutter-tester',
], workingDirectory: tempDir.path); ], workingDirectory: tempDir.path);
await waitForObservatoryMessage(process, ddsPort); await waitForVmServiceMessage(process, ddsPort);
process.kill(); process.kill();
await process.exitCode; await process.exitCode;
}); });

View file

@ -502,7 +502,7 @@ void main() {
<String>['run', '-dflutter-tester', testScript], <String>['run', '-dflutter-tester', testScript],
testDirectory, testDirectory,
<Transition>[ <Transition>[
Barrier(RegExp(r'^An Observatory debugger and profiler on Flutter test device is available at: ')), Barrier(RegExp(r'^A Dart VM Service on Flutter test device is available at: ')),
Barrier(RegExp(r'^The Flutter DevTools debugger and profiler on Flutter test device is available at: '), handler: (String line) { Barrier(RegExp(r'^The Flutter DevTools debugger and profiler on Flutter test device is available at: '), handler: (String line) {
return 'r'; return 'r';
}), }),
@ -594,7 +594,7 @@ void main() {
'c Clear the screen', 'c Clear the screen',
'q Quit (terminate the application on the device).', 'q Quit (terminate the application on the device).',
'', '',
startsWith('An Observatory debugger and profiler on Flutter test device is available at: http://'), startsWith('A Dart VM Service on Flutter test device is available at: http://'),
startsWith('The Flutter DevTools debugger and profiler on Flutter test device is available at: http://'), startsWith('The Flutter DevTools debugger and profiler on Flutter test device is available at: http://'),
'', '',
'Flutter run key commands.', 'Flutter run key commands.',
@ -621,7 +621,7 @@ void main() {
'c Clear the screen', 'c Clear the screen',
'q Quit (terminate the application on the device).', 'q Quit (terminate the application on the device).',
'', '',
startsWith('An Observatory debugger and profiler on Flutter test device is available at: http://'), startsWith('A Dart VM Service on Flutter test device is available at: http://'),
startsWith('The Flutter DevTools debugger and profiler on Flutter test device is available at: http://'), startsWith('The Flutter DevTools debugger and profiler on Flutter test device is available at: http://'),
'', '',
'Application finished.', 'Application finished.',

View file

@ -812,7 +812,7 @@ class FlutterTestTestDriver extends FlutterTestDriver {
if (withDebugger) { if (withDebugger) {
final Map<String, Object?> startedProcessParams = final Map<String, Object?> startedProcessParams =
(await _waitFor(event: 'test.startedProcess', timeout: appStartTimeout))['params']! as Map<String, Object?>; (await _waitFor(event: 'test.startedProcess', timeout: appStartTimeout))['params']! as Map<String, Object?>;
final String vmServiceHttpString = startedProcessParams['observatoryUri']! as String; final String vmServiceHttpString = startedProcessParams['vmServiceUri']! as String;
_vmServiceWsUri = Uri.parse(vmServiceHttpString).replace(scheme: 'ws', path: '/ws'); _vmServiceWsUri = Uri.parse(vmServiceHttpString).replace(scheme: 'ws', path: '/ws');
await connectToVmService(pauseOnExceptions: pauseOnExceptions); await connectToVmService(pauseOnExceptions: pauseOnExceptions);
// Allow us to run code before we start, eg. to set up breakpoints. // Allow us to run code before we start, eg. to set up breakpoints.

View file

@ -66,7 +66,7 @@ void main() {
expect(result.exitCode, isNot(0)); expect(result.exitCode, isNot(0));
}, skip: !io.Platform.isMacOS); // [intended] requires macos toolchain. }, skip: !io.Platform.isMacOS); // [intended] requires macos toolchain.
group('observatory Bonjour service keys', () { group('vmService Bonjour service keys', () {
late Directory buildDirectory; late Directory buildDirectory;
late File infoPlist; late File infoPlist;
@ -78,7 +78,7 @@ void main() {
test('handles when the Info.plist is missing', () async { test('handles when the Info.plist is missing', () async {
final ProcessResult result = await Process.run( final ProcessResult result = await Process.run(
xcodeBackendPath, xcodeBackendPath,
<String>['test_observatory_bonjour_service'], <String>['test_vm_service_bonjour_service'],
environment: <String, String>{ environment: <String, String>{
'CONFIGURATION': 'Debug', 'CONFIGURATION': 'Debug',
'BUILT_PRODUCTS_DIR': buildDirectory.path, 'BUILT_PRODUCTS_DIR': buildDirectory.path,
@ -102,7 +102,7 @@ void main() {
final ProcessResult result = await Process.run( final ProcessResult result = await Process.run(
xcodeBackendPath, xcodeBackendPath,
<String>['test_observatory_bonjour_service'], <String>['test_vm_service_bonjour_service'],
environment: <String, String>{ environment: <String, String>{
'CONFIGURATION': 'Release', 'CONFIGURATION': 'Release',
'BUILT_PRODUCTS_DIR': buildDirectory.path, 'BUILT_PRODUCTS_DIR': buildDirectory.path,
@ -112,7 +112,7 @@ void main() {
final String actualInfoPlist = infoPlist.readAsStringSync(); final String actualInfoPlist = infoPlist.readAsStringSync();
expect(actualInfoPlist, isNot(contains('NSBonjourServices'))); expect(actualInfoPlist, isNot(contains('NSBonjourServices')));
expect(actualInfoPlist, isNot(contains('dartobservatory'))); expect(actualInfoPlist, isNot(contains('dartVmService')));
expect(actualInfoPlist, isNot(contains('NSLocalNetworkUsageDescription'))); expect(actualInfoPlist, isNot(contains('NSLocalNetworkUsageDescription')));
expect(result.exitCode, 0); expect(result.exitCode, 0);
@ -124,7 +124,7 @@ void main() {
final ProcessResult result = await Process.run( final ProcessResult result = await Process.run(
xcodeBackendPath, xcodeBackendPath,
<String>['test_observatory_bonjour_service'], <String>['test_vm_service_bonjour_service'],
environment: <String, String>{ environment: <String, String>{
'CONFIGURATION': buildConfiguration, 'CONFIGURATION': buildConfiguration,
'BUILT_PRODUCTS_DIR': buildDirectory.path, 'BUILT_PRODUCTS_DIR': buildDirectory.path,
@ -134,7 +134,7 @@ void main() {
final String actualInfoPlist = infoPlist.readAsStringSync(); final String actualInfoPlist = infoPlist.readAsStringSync();
expect(actualInfoPlist, contains('NSBonjourServices')); expect(actualInfoPlist, contains('NSBonjourServices'));
expect(actualInfoPlist, contains('dartobservatory')); expect(actualInfoPlist, contains('dartVmService'));
expect(actualInfoPlist, contains('NSLocalNetworkUsageDescription')); expect(actualInfoPlist, contains('NSLocalNetworkUsageDescription'));
expect(result.exitCode, 0); expect(result.exitCode, 0);
@ -158,7 +158,7 @@ void main() {
final ProcessResult result = await Process.run( final ProcessResult result = await Process.run(
xcodeBackendPath, xcodeBackendPath,
<String>['test_observatory_bonjour_service'], <String>['test_vm_service_bonjour_service'],
environment: <String, String>{ environment: <String, String>{
'CONFIGURATION': 'Debug', 'CONFIGURATION': 'Debug',
'BUILT_PRODUCTS_DIR': buildDirectory.path, 'BUILT_PRODUCTS_DIR': buildDirectory.path,
@ -173,7 +173,7 @@ void main() {
<dict> <dict>
<key>NSBonjourServices</key> <key>NSBonjourServices</key>
<array> <array>
<string>_dartobservatory._tcp</string> <string>_dartVmService._tcp</string>
<string>_bogus._tcp</string> <string>_bogus._tcp</string>
</array> </array>
<key>NSLocalNetworkUsageDescription</key> <key>NSLocalNetworkUsageDescription</key>