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
"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
and Read Timeline Traces" on this blog post:
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())
.listen((String line) {
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) {
uri.complete(serviceUri);
}

View file

@ -664,14 +664,14 @@ Future<void> runAndCaptureAsyncStacks(Future<void> Function() callback) {
bool canRun(String path) => _processManager.canRun(path);
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 _obsUriRegExp = RegExp(r'((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)');
/// Tries to extract a port from the string.
///
/// 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, {
Pattern? prefix,
}) {
@ -689,7 +689,7 @@ int? parseServicePort(String line, {
/// Tries to extract a URL from the string.
///
/// 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, {
Pattern? prefix,
}) {

View file

@ -1184,11 +1184,11 @@ class PerfTestWithSkSL extends PerfTest {
await _generateSkSL();
// 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.
final TaskResult result = await internalRun(
existingApp: observatoryUri,
existingApp: vmServiceUri,
);
_runProcess.kill();
@ -1207,8 +1207,8 @@ class PerfTestWithSkSL extends PerfTest {
// `--write-sksl-on-exit` option doesn't seem to be compatible with
// `flutter drive --existing-app` as it will complain web socket connection
// issues.
final String observatoryUri = await _runApp(cacheSkSL: true);
await super.internalRun(cacheSkSL: true, existingApp: observatoryUri);
final String vmServiceUri = await _runApp(cacheSkSL: true);
await super.internalRun(cacheSkSL: true, existingApp: vmServiceUri);
_runProcess.kill();
await _runProcess.exitCode;

View file

@ -19,7 +19,7 @@ void main() {
group('parse service', () {
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=/';
test('uri', () {

View file

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

View file

@ -69,10 +69,10 @@ abstract class ShaderWarmUp {
///
/// To decide which draw operations to be added to your custom warm up
/// 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
/// `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.
@protected
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.
///
/// Used by the `showPerformanceOverlay` observatory extension.
/// Used by the `showPerformanceOverlay` VM service extension.
static bool showPerformanceOverlayOverride = false;
/// 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
/// 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
/// more detailed information is shown in the IDE or Observatory.
/// more detailed information is shown in the IDE or DevTools.
static bool debugShowWidgetInspectorOverride = false;
/// 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
/// with "s".

View file

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

View file

@ -703,7 +703,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService;
/// operation making it easier to avoid memory leaks.
///
/// 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
/// 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)
@ -712,7 +712,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService;
/// All methods returning String values return JSON.
mixin WidgetInspectorService {
/// 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);
int _serializeRingIndex = 0;
@ -739,7 +739,7 @@ mixin WidgetInspectorService {
/// when the inspection target changes on device.
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
/// alive.
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
/// 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
/// contents.
//

View file

@ -148,7 +148,7 @@ Future<void> run(List<String> args) async {
),
),
watcher: collector,
enableObservatory: collector != null,
enableVmService: collector != null,
precompiledDillFiles: tests,
concurrency: math.max(1, globals.platform.numberOfProcessors - 2),
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.
embedFlutterFrameworks();
break;
case 'test_observatory_bonjour_service':
case 'test_vm_service_bonjour_service':
// 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.
void addObservatoryBonjourService() {
// Add the vmService publisher Bonjour service to the produced app bundle Info.plist.
void addVmServiceBonjourService() {
final String buildMode = parseFlutterBuildMode();
// Debug and profile only.
@ -239,13 +239,13 @@ class Context {
// The file will be present on re-run.
echo(
'${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".');
return;
}
// 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(
'plutil',
<String>[
@ -265,19 +265,19 @@ class Context {
'-insert',
'NSBonjourServices.0',
'-string',
'_dartobservatory._tcp',
'_dartVmService._tcp',
builtProductsPlist,
],
);
} else {
// Otherwise, add the NSBonjourServices key and observatory service name.
// Otherwise, add the NSBonjourServices key and vmService service name.
runSync(
'plutil',
<String>[
'-insert',
'NSBonjourServices',
'-json',
'["_dartobservatory._tcp"]',
'["_dartVmService._tcp"]',
builtProductsPlist,
],
);

View file

@ -17,7 +17,7 @@ immediately discover the port
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
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.
`$ 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
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

View file

@ -599,12 +599,12 @@ class AndroidDevice extends Device {
}
final bool traceStartup = platformArgs['trace-startup'] as bool? ?? false;
ProtocolDiscovery? observatoryDiscovery;
ProtocolDiscovery? vmServiceDiscovery;
if (debuggingOptions.debuggingEnabled) {
observatoryDiscovery = ProtocolDiscovery.observatory(
vmServiceDiscovery = ProtocolDiscovery.vmService(
// 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`.
await AdbLogReader.createLogReader(
this,
@ -687,13 +687,13 @@ class AndroidDevice extends Device {
}
// Wait for the service protocol port here. This will complete once the
// device has printed "Observatory is listening on...".
_logger.printTrace('Waiting for observatory port to be available...');
// device has printed "VM Service is listening on...".
_logger.printTrace('Waiting for VM Service port to be available...');
try {
Uri? observatoryUri;
Uri? vmServiceUri;
if (debuggingOptions.buildInfo.isDebug || debuggingOptions.buildInfo.isProfile) {
observatoryUri = await observatoryDiscovery?.uri;
if (observatoryUri == null) {
vmServiceUri = await vmServiceDiscovery?.uri;
if (vmServiceUri == null) {
_logger.printError(
'Error waiting for a debug connection: '
'The log reader stopped unexpectedly',
@ -701,12 +701,12 @@ class AndroidDevice extends Device {
return LaunchResult.failed();
}
}
return LaunchResult.succeeded(observatoryUri: observatoryUri);
return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
} on Exception catch (error) {
_logger.printError('Error waiting for a debug connection: $error');
return LaunchResult.failed();
} finally {
await observatoryDiscovery?.cancel();
await vmServiceDiscovery?.cancel();
}
}

View file

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

View file

@ -394,16 +394,16 @@ class BuildMode {
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');
/// 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');
/// 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');
/// 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 List<BuildMode> values = <BuildMode>[

View file

@ -56,7 +56,7 @@ import '../vmservice.dart';
/// ```
/// $ 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.
///
/// To attach to a flutter mod running on a fuchsia device, `--module` must
@ -97,18 +97,18 @@ class AttachCommand extends FlutterCommand {
..addOption(
'debug-port',
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 '
'application at launch, otherwise this command will fail to connect to '
'the application. In general, "--debug-url" should be used instead.',
)..addOption(
'debug-url',
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(
'app-id',
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'
'If you have multiple devices or emulators running, you should include the '
'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
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.
`$ 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.',
);
}
if (debugPort == null && debugUri == null && argResults!.wasParsed(FlutterCommand.observatoryPortOption)) {
if (debugPort == null && debugUri == null && argResults!.wasParsed(FlutterCommand.vmServicePortOption)) {
throwToolExit(
'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) {
@ -281,7 +281,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
)
: null;
Stream<Uri>? observatoryUri;
Stream<Uri>? vmServiceUri;
bool usesIpv6 = ipv6!;
final String ipv6Loopback = InternetAddress.loopbackIPv6.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;
try {
isolateDiscoveryProtocol = device.getIsolateDiscoveryProtocol(module);
observatoryUri = Stream<Uri>.value(await isolateDiscoveryProtocol.uri).asBroadcastStream();
vmServiceUri = Stream<Uri>.value(await isolateDiscoveryProtocol.uri).asBroadcastStream();
} on Exception {
isolateDiscoveryProtocol?.dispose();
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;
if (compatibleWithProtocolDiscovery) {
final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.observatory(
final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.vmService(
device.getLogReader(),
portForwarder: device.portForwarder,
ipv6: ipv6!,
@ -372,14 +372,14 @@ known, it can be explicitly provided to attach via the command-line, e.g.
}
discoveryStatus.stop();
observatoryUri = foundUrl == null
vmServiceUri = foundUrl == null
? null
: Stream<Uri>.value(foundUrl).asBroadcastStream();
}
// If MDNS discovery fails or we're not on iOS, fallback to ProtocolDiscovery.
if (observatoryUri == null) {
final ProtocolDiscovery observatoryDiscovery =
ProtocolDiscovery.observatory(
if (vmServiceUri == null) {
final ProtocolDiscovery vmServiceDiscovery =
ProtocolDiscovery.vmService(
// If it's an Android device, attaching relies on past log searching
// to find the service protocol.
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.printStatus('Waiting for a connection from Flutter on ${device.name}...');
observatoryUri = observatoryDiscovery.uris;
vmServiceUri = vmServiceDiscovery.uris;
// Determine ipv6 status from the scanned logs.
usesIpv6 = observatoryDiscovery.ipv6;
usesIpv6 = vmServiceDiscovery.ipv6;
}
} else {
observatoryUri = Stream<Uri>
vmServiceUri = Stream<Uri>
.fromFuture(
buildVMServiceUri(
device,
@ -413,7 +413,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
int? result;
if (daemon != null) {
final ResidentRunner runner = await createResidentRunner(
observatoryUris: observatoryUri,
vmServiceUris: vmServiceUri,
device: device,
flutterProject: flutterProject,
usesIpv6: usesIpv6,
@ -446,7 +446,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
}
while (true) {
final ResidentRunner runner = await createResidentRunner(
observatoryUris: observatoryUri,
vmServiceUris: vmServiceUri,
device: device,
flutterProject: flutterProject,
usesIpv6: usesIpv6,
@ -476,7 +476,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
}
terminalHandler?.stop();
assert(result != null);
if (runner.exited || !runner.isWaitingForObservatory) {
if (runner.exited || !runner.isWaitingForVmService) {
break;
}
_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({
required Stream<Uri> observatoryUris,
required Stream<Uri> vmServiceUris,
required Device device,
required FlutterProject flutterProject,
required bool usesIpv6,
@ -510,7 +510,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
userIdentifier: userIdentifier,
platform: _platform,
);
flutterDevice.observatoryUris = observatoryUris;
flutterDevice.vmServiceUris = vmServiceUris;
final List<FlutterDevice> flutterDevices = <FlutterDevice>[flutterDevice];
final DebuggingOptions debuggingOptions = DebuggingOptions.enabled(
buildInfo,

View file

@ -650,7 +650,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
description: 'Should the device use port forwarding? '
'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 '
'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.',
);

View file

@ -1016,7 +1016,9 @@ class DeviceDomain extends Domain {
);
return <String, Object?>{
'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.',
)
..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, '
'and it will only be stopped if "--no-keep-app-running" is explicitly set.',
valueHelp: 'url',

View file

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

View file

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

View file

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

View file

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

View file

@ -933,7 +933,7 @@ class DebuggingOptions {
return <String>[
if (enableDartProfiling) '--enable-dart-profiling',
if (disableServiceAuthCodes) '--disable-service-auth-codes',
if (disablePortPublication) '--disable-observatory-publication',
if (disablePortPublication) '--disable-vm-service-publication',
if (startPaused) '--start-paused',
// Wrap dart flags in quotes for physical devices
if (environmentType == EnvironmentType.physical && dartVmFlags.isNotEmpty)
@ -960,14 +960,14 @@ class DebuggingOptions {
if (platformArgs['trace-startup'] as bool? ?? false) '--trace-startup',
if (enableImpeller) '--enable-impeller',
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.
// Use the suggested host port.
if (environmentType == EnvironmentType.simulator && hostVmServicePort != null)
'--observatory-port=$hostVmServicePort',
// Tell the observatory to listen on all interfaces, don't restrict to the loopback.
'--vm-service-port=$hostVmServicePort',
// Tell the VM service to listen on all interfaces, don't restrict to the loopback.
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 {
LaunchResult.succeeded({ this.observatoryUri }) : started = true;
LaunchResult.succeeded({ Uri? vmServiceUri, Uri? observatoryUri }) :
started = true,
vmServiceUri = vmServiceUri ?? observatoryUri;
LaunchResult.failed()
: started = false,
observatoryUri = null;
vmServiceUri = null;
bool get hasObservatory => observatoryUri != null;
bool get hasVmService => vmServiceUri != null;
final bool started;
final Uri? observatoryUri;
final Uri? vmServiceUri;
@override
String toString() {
final StringBuffer buf = StringBuffer('started=$started');
if (observatoryUri != null) {
buf.write(', observatory=$observatoryUri');
if (vmServiceUri != null) {
buf.write(', vmService=$vmServiceUri');
}
return buf.toString();
}
@ -1109,9 +1112,9 @@ abstract class DeviceLogReader {
/// Describes an app running on the device.
class DiscoveredApp {
DiscoveredApp(this.id, this.observatoryPort);
DiscoveredApp(this.id, this.vmServicePort);
final String id;
final int observatoryPort;
final int vmServicePort;
}
// 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);
}
return reuseApplication(
result.observatoryUri!,
result.vmServiceUri!,
device,
debuggingOptions,
ipv6,

View file

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

View file

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

View file

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

View file

@ -450,9 +450,9 @@ class IOSSimulator extends Device {
platformArgs,
);
ProtocolDiscovery? observatoryDiscovery;
ProtocolDiscovery? vmServiceDiscovery;
if (debuggingOptions.debuggingEnabled) {
observatoryDiscovery = ProtocolDiscovery.observatory(
vmServiceDiscovery = ProtocolDiscovery.vmService(
getLogReader(app: package),
ipv6: ipv6,
hostPort: debuggingOptions.hostVmServicePort,
@ -485,13 +485,13 @@ class IOSSimulator extends Device {
}
// Wait for the service protocol port here. This will complete once the
// device has printed "Observatory is listening on..."
globals.printTrace('Waiting for observatory port to be available...');
// device has printed "Dart VM Service is listening on..."
globals.printTrace('Waiting for VM Service port to be available...');
try {
final Uri? deviceUri = await observatoryDiscovery?.uri;
final Uri? deviceUri = await vmServiceDiscovery?.uri;
if (deviceUri != null) {
return LaunchResult.succeeded(observatoryUri: deviceUri);
return LaunchResult.succeeded(vmServiceUri: deviceUri);
}
globals.printError(
'Error waiting for a debug connection: '
@ -500,7 +500,7 @@ class IOSSimulator extends Device {
} on Exception catch (error) {
globals.printError('Error waiting for a debug connection: $error');
} finally {
await observatoryDiscovery?.cancel();
await vmServiceDiscovery?.cancel();
}
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
/// Xcode build. By default, this is located under
/// "~/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.
static MacOSApp? fromPrebuiltApp(FileSystemEntity 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
// found in the LICENSE file.
import 'dart:async';
import 'package:meta/meta.dart';
import 'package:multicast_dns/multicast_dns.dart';
@ -39,7 +41,7 @@ class MDnsVmServiceDiscovery {
final Usage _flutterUsage;
@visibleForTesting
static const String dartVmServiceName = '_dartobservatory._tcp.local';
static const String dartVmServiceName = '_dartVmService._tcp.local';
static MDnsVmServiceDiscovery? get instance => context.get<MDnsVmServiceDiscovery>();

View file

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

View file

@ -29,7 +29,7 @@ class ProtocolDiscovery {
);
}
factory ProtocolDiscovery.observatory(
factory ProtocolDiscovery.vmService(
DeviceLogReader logReader, {
DevicePortForwarder? portForwarder,
Duration? throttleDuration,
@ -38,10 +38,10 @@ class ProtocolDiscovery {
required bool ipv6,
required Logger logger,
}) {
const String kObservatoryService = 'Observatory';
const String kVmServiceService = 'VM Service';
return ProtocolDiscovery._(
logReader,
kObservatoryService,
kVmServiceService,
portForwarder: portForwarder,
throttleDuration: throttleDuration ?? const Duration(milliseconds: 200),
hostPort: hostPort,
@ -59,7 +59,7 @@ class ProtocolDiscovery {
final bool ipv6;
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;
StreamSubscription<String>? _deviceLogSubscription;
@ -81,12 +81,12 @@ class ProtocolDiscovery {
/// 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].
/// Returns when no event has been observed for [throttleTimeout].
///
/// 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 {
final Stream<Uri> uriStream = _uriStreamController.stream
.transform(_throttle<Uri>(
@ -107,7 +107,7 @@ class ProtocolDiscovery {
return globals.kVMServiceMessageRegExp.firstMatch(line);
}
Uri? _getObservatoryUri(String line) {
Uri? _getVmServiceUri(String line) {
final Match? match = _getPatternMatch(line);
if (match != null) {
return Uri.parse(match[1]!);
@ -118,7 +118,7 @@ class ProtocolDiscovery {
void _handleLine(String line) {
Uri? uri;
try {
uri = _getObservatoryUri(line);
uri = _getVmServiceUri(line);
} on FormatException catch (error, stackTrace) {
_uriStreamController.addError(error, stackTrace);
}
@ -126,7 +126,7 @@ class ProtocolDiscovery {
return;
}
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;
}
_uriStreamController.add(uri);

View file

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

View file

@ -114,7 +114,7 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
if (_residentRunner.reportedDebuggers) {
// Since the DevTools only just became available, we haven't had a chance to
// 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;
DevFSWriter? devFSWriter;
Stream<Uri?>? observatoryUris;
Stream<Uri?>? vmServiceUris;
FlutterVmService? vmService;
DevFS? devFS;
ApplicationPackage? package;
// ignore: cancel_subscriptions
StreamSubscription<String>? _loggingSubscription;
bool? _isListeningForObservatoryUri;
bool? _isListeningForVmServiceUri;
/// Whether the stream [observatoryUris] is still open.
bool get isWaitingForObservatory => _isListeningForObservatoryUri ?? false;
/// Whether the stream [vmServiceUris] is still open.
bool get isWaitingForVmService => _isListeningForVmServiceUri ?? false;
/// If the [reloadSources] parameter is not null the 'reloadSources' service
/// will be registered.
/// 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).
/// The 'compileExpression' service can be used to compile user-provided
/// expressions requested during debugging of the application.
@ -262,29 +262,29 @@ class FlutterDevice {
late StreamSubscription<void> subscription;
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.
globals.printTrace('Connecting to service protocol: $observatoryUri');
globals.printTrace('Connecting to service protocol: $vmServiceUri');
isWaitingForVm = true;
bool existingDds = false;
FlutterVmService? service;
if (enableDds) {
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) {
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
// from an old application instance, we shouldn't try and start DDS.
try {
service = await connectToVmService(observatoryUri!, logger: globals.logger);
service = await connectToVmService(vmServiceUri!, logger: globals.logger);
await service.dispose();
} on Exception catch (exception) {
globals.printTrace('Fail to connect to service protocol: $observatoryUri: $exception');
if (!completer.isCompleted && !_isListeningForObservatoryUri!) {
completer.completeError('failed to connect to $observatoryUri');
globals.printTrace('Fail to connect to service protocol: $vmServiceUri: $exception');
if (!completer.isCompleted && !_isListeningForVmServiceUri!) {
completer.completeError('failed to connect to $vmServiceUri');
}
return;
}
@ -294,7 +294,7 @@ class FlutterDevice {
// attaching to a VM service with existing clients, etc.).
try {
await device!.dds.startDartDevelopmentService(
observatoryUri,
vmServiceUri,
hostPort: ddsPort,
ipv6: ipv6,
disableServiceAuthCodes: disableServiceAuthCodes,
@ -324,7 +324,7 @@ class FlutterDevice {
service = await Future.any<dynamic>(
<Future<dynamic>>[
connectToVmService(
enableDds ? (device!.dds.uri ?? observatoryUri!): observatoryUri!,
enableDds ? (device!.dds.uri ?? vmServiceUri!): vmServiceUri!,
reloadSources: reloadSources,
restart: restart,
compileExpression: compileExpression,
@ -338,30 +338,30 @@ class FlutterDevice {
]
) as FlutterVmService?;
} on Exception catch (exception) {
globals.printTrace('Fail to connect to service protocol: $observatoryUri: $exception');
if (!completer.isCompleted && !_isListeningForObservatoryUri!) {
completer.completeError('failed to connect to $observatoryUri');
globals.printTrace('Fail to connect to service protocol: $vmServiceUri: $exception');
if (!completer.isCompleted && !_isListeningForVmServiceUri!) {
completer.completeError('failed to connect to $vmServiceUri');
}
return;
}
if (completer.isCompleted) {
return;
}
globals.printTrace('Successfully connected to service protocol: $observatoryUri');
globals.printTrace('Successfully connected to service protocol: $vmServiceUri');
vmService = service;
(await device!.getLogReader(app: package)).connectedVMService = vmService;
completer.complete();
await subscription.cancel();
}, onError: (dynamic error) {
globals.printTrace('Fail to handle observatory URI: $error');
globals.printTrace('Fail to handle VM Service URI: $error');
}, onDone: () {
_isListeningForObservatoryUri = false;
_isListeningForVmServiceUri = false;
if (!completer.isCompleted && !isWaitingForVm) {
completer.completeError(Exception('connection to device ended too early'));
}
});
_isListeningForObservatoryUri = true;
_isListeningForVmServiceUri = true;
return completer.future;
}
@ -471,12 +471,12 @@ class FlutterDevice {
await stopEchoingDeviceLog();
return 2;
}
if (result.hasObservatory) {
observatoryUris = Stream<Uri?>
.value(result.observatoryUri)
if (result.hasVmService) {
vmServiceUris = Stream<Uri?>
.value(result.vmServiceUri)
.asBroadcastStream();
} else {
observatoryUris = const Stream<Uri>
vmServiceUris = const Stream<Uri>
.empty()
.asBroadcastStream();
}
@ -536,12 +536,12 @@ class FlutterDevice {
await stopEchoingDeviceLog();
return 2;
}
if (result.hasObservatory) {
observatoryUris = Stream<Uri?>
.value(result.observatoryUri)
if (result.hasVmService) {
vmServiceUris = Stream<Uri?>
.value(result.vmServiceUri)
.asBroadcastStream();
} else {
observatoryUris = const Stream<Uri>
vmServiceUris = const Stream<Uri>
.empty()
.asBroadcastStream();
}
@ -1131,10 +1131,10 @@ abstract class ResidentRunner extends ResidentHandlers {
@override
bool hotMode;
/// Returns true if every device is streaming observatory URIs.
bool get isWaitingForObservatory {
/// Returns true if every device is streaming vmService URIs.
bool get isWaitingForVmService {
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 _reportedDebuggers = false;
void printDebuggerList({ bool includeObservatory = true, bool includeDevtools = true }) {
void printDebuggerList({ bool includeVmService = true, bool includeDevtools = true }) {
final DevToolsServerAddress? devToolsServerAddress = residentDevtoolsHandler!.activeDevToolsServer;
if (!residentDevtoolsHandler!.readyToAnnounce) {
includeDevtools = false;
@ -1488,10 +1488,10 @@ abstract class ResidentRunner extends ResidentHandlers {
if (device!.vmService == null) {
continue;
}
if (includeObservatory) {
if (includeVmService) {
// Caution: This log line is parsed by device lab tests.
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}',
);
}

View file

@ -69,7 +69,7 @@ class ColdRunner extends ResidentRunner {
return 1;
}
// Connect to observatory.
// Connect to the VM Service.
if (debuggingEnabled) {
try {
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.
connectionInfoCompleter?.complete(DebugConnectionInfo(
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.
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';
/// 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 }) {
argParser.addOption(observatoryPortOption,
argParser.addOption(vmServicePortOption,
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 '
'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,
);
argParser.addOption('device-vmservice-port',
@ -490,19 +501,21 @@ abstract class FlutterCommand extends Command<void> {
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);
int _tryParseHostVmservicePort() {
final String? observatoryPort = stringArgDeprecated('observatory-port');
final String? vmServicePort = stringArgDeprecated(vmServicePortOption) ??
stringArgDeprecated(observatoryPortOption);
final String? hostPort = stringArgDeprecated('host-vmservice-port');
if (observatoryPort == null && hostPort == null) {
throwToolExit('Invalid port for `--observatory-port/--host-vmservice-port`');
if (vmServicePort == null && hostPort == null) {
throwToolExit('Invalid port for `--vm-service-port/--host-vmservice-port`');
}
try {
return int.parse((observatoryPort ?? hostPort)!);
return int.parse((vmServicePort ?? hostPort)!);
} 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;
}
/// 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.
///
/// Only one of "host-vmservice-port" and "observatory-port" may be
/// Only one of "host-vmservice-port" and "vm-service-port" may be
/// specified.
///
/// If no port is set, returns null.
@ -539,9 +552,10 @@ abstract class FlutterCommand extends Command<void> {
if (!_usesPortOption || !_hostVmServicePortProvided) {
return null;
}
if ((argResults?.wasParsed('observatory-port') ?? false)
if ((argResults?.wasParsed(vmServicePortOption) ?? false)
&& (argResults?.wasParsed(observatoryPortOption) ?? 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.');
}
// 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.
///
/// The returned [Future] completes when the coverage is collected.
Future<void> collectCoverageIsolate(Uri observatoryUri) async {
_logMessage('collecting coverage data from $observatoryUri...');
Future<void> collectCoverageIsolate(Uri vmServiceUri) async {
_logMessage('collecting coverage data from $vmServiceUri...');
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(
data['coverage'] as List<Map<String, dynamic>>,
packagePath: packageDirectory,
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`.
@ -141,11 +141,11 @@ class CoverageCollector extends TestWatcher {
}
);
final Future<void> collectionComplete = testDevice.observatoryUri
.then((Uri? observatoryUri) {
_logMessage('collecting coverage data from $testDevice at $observatoryUri...');
final Future<void> collectionComplete = testDevice.vmServiceUri
.then((Uri? vmServiceUri) {
_logMessage('collecting coverage data from $testDevice at $vmServiceUri...');
return collect(
observatoryUri!, libraryNames, serviceOverride: serviceOverride,
vmServiceUri!, libraryNames, serviceOverride: serviceOverride,
branchCoverage: branchCoverage)
.then<void>((Map<String, dynamic> result) {
_logMessage('Collected coverage data.');

View file

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

View file

@ -34,7 +34,7 @@ import 'test_time_recorder.dart';
import 'watcher.dart';
/// 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>{
InternetAddressType.IPv4: InternetAddress.loopbackIPv4,
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
/// (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({
TestWrapper testWrapper = const TestWrapper(),
required String shellPath,
required DebuggingOptions debuggingOptions,
TestWatcher? watcher,
// TODO(bkonyi): remove after roll into google3.
bool enableObservatory = false,
bool enableVmService = false,
bool machine = false,
String? precompiledDillPath,
Map<String, String>? precompiledDillFiles,
@ -68,7 +70,7 @@ FlutterPlatform installHook({
TestTimeRecorder? testTimeRecorder,
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.
platformPluginRegistration ??= (FlutterPlatform platform) {
@ -84,7 +86,7 @@ FlutterPlatform installHook({
debuggingOptions: debuggingOptions,
watcher: watcher,
machine: machine,
enableObservatory: enableObservatory,
enableVmService: enableVmService || enableObservatory,
host: _kHosts[serverType],
precompiledDillPath: precompiledDillPath,
precompiledDillFiles: precompiledDillFiles,
@ -276,7 +278,7 @@ class FlutterPlatform extends PlatformPlugin {
required this.shellPath,
required this.debuggingOptions,
this.watcher,
this.enableObservatory,
this.enableVmService,
this.machine,
this.host,
this.precompiledDillPath,
@ -295,7 +297,7 @@ class FlutterPlatform extends PlatformPlugin {
final String shellPath;
final DebuggingOptions debuggingOptions;
final TestWatcher? watcher;
final bool? enableObservatory;
final bool? enableVmService;
final bool? machine;
final InternetAddress? host;
final String? precompiledDillPath;
@ -357,7 +359,7 @@ class FlutterPlatform extends PlatformPlugin {
if (_testCount > 0) {
// Fail if there will be a port conflict.
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.
if (precompiledDillPath != null) {
@ -424,7 +426,7 @@ class FlutterPlatform extends PlatformPlugin {
processManager: globals.processManager,
logger: globals.logger,
shellPath: shellPath,
enableObservatory: enableObservatory!,
enableVmService: enableVmService!,
machine: machine,
debuggingOptions: debuggingOptions,
host: host,
@ -512,13 +514,13 @@ class FlutterPlatform extends PlatformPlugin {
await Future.any<void>(<Future<void>>[
testDevice.finished,
() async {
final Uri? processObservatoryUri = await testDevice.observatoryUri;
if (processObservatoryUri != null) {
globals.printTrace('test $ourTestCount: Observatory uri is available at $processObservatoryUri');
final Uri? processVmServiceUri = await testDevice.vmServiceUri;
if (processVmServiceUri != null) {
globals.printTrace('test $ourTestCount: VM Service uri is available at $processVmServiceUri');
} 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;
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.shellPath,
required this.debuggingOptions,
required this.enableObservatory,
required this.enableVmService,
required this.machine,
required this.host,
required this.testAssetDirectory,
@ -45,8 +45,8 @@ class FlutterTesterTestDevice extends TestDevice {
required this.compileExpression,
required this.fontConfigManager,
required this.uriConverter,
}) : assert(!debuggingOptions.startPaused || enableObservatory),
_gotProcessObservatoryUri = enableObservatory
}) : assert(!debuggingOptions.startPaused || enableVmService),
_gotProcessVmServiceUri = enableVmService
? Completer<Uri?>() : (Completer<Uri?>()..complete());
/// Used for logging to identify the test that is currently being executed.
@ -57,7 +57,7 @@ class FlutterTesterTestDevice extends TestDevice {
final Logger logger;
final String shellPath;
final DebuggingOptions debuggingOptions;
final bool enableObservatory;
final bool enableVmService;
final bool? machine;
final InternetAddress? host;
final String? testAssetDirectory;
@ -67,7 +67,7 @@ class FlutterTesterTestDevice extends TestDevice {
final FontConfigManager fontConfigManager;
final UriConverter? uriConverter;
final Completer<Uri?> _gotProcessObservatoryUri;
final Completer<Uri?> _gotProcessVmServiceUri;
final Completer<int> _exitCode = Completer<int>();
Process? _process;
@ -89,7 +89,7 @@ class FlutterTesterTestDevice extends TestDevice {
logger.printTrace('test $id: test harness socket server is running at port:${_server!.port}');
final List<String> command = <String>[
shellPath,
if (enableObservatory) ...<String>[
if (enableVmService) ...<String>[
// Some systems drive the _FlutterPlatform class in an unusual way, where
// only one test file is processed at a time, and the operating
// 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
// 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.disableServiceAuthCodes) '--disable-service-auth-codes',
]
else
'--disable-observatory',
'--disable-vm-service',
if (host!.type == InternetAddressType.IPv6) '--ipv6',
if (icudtlPath != null) '--icu-data-file-path=$icudtlPath',
'--enable-checked-mode',
@ -154,11 +154,11 @@ class FlutterTesterTestDevice extends TestDevice {
logger.printTrace('test $id: Started flutter_tester process at pid ${_process!.pid}');
// 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(
process: _process!,
reportObservatoryUri: (Uri detectedUri) async {
assert(!_gotProcessObservatoryUri.isCompleted);
reportVmServiceUri: (Uri detectedUri) async {
assert(!_gotProcessVmServiceUri.isCompleted);
assert(debuggingOptions.hostVmServicePort == null ||
debuggingOptions.hostVmServicePort == detectedUri.port);
@ -194,12 +194,11 @@ class FlutterTesterTestDevice extends TestDevice {
if (debuggingOptions.startPaused && !machine!) {
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('You should first set appropriate breakpoints, then resume the test in the debugger.');
}
_gotProcessObservatoryUri.complete(forwardingUri);
_gotProcessVmServiceUri.complete(forwardingUri);
},
);
@ -207,8 +206,8 @@ class FlutterTesterTestDevice extends TestDevice {
}
@override
Future<Uri?> get observatoryUri {
return _gotProcessObservatoryUri.future;
Future<Uri?> get vmServiceUri {
return _gotProcessVmServiceUri.future;
}
@override
@ -293,7 +292,7 @@ class FlutterTesterTestDevice extends TestDevice {
void _pipeStandardStreamsToConsole({
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>>>[
process.stderr,
@ -310,9 +309,9 @@ class FlutterTesterTestDevice extends TestDevice {
if (match != null) {
try {
final Uri uri = Uri.parse(match[1]!);
await reportObservatoryUri(uri);
await reportVmServiceUri(uri);
} 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 {
logger.printStatus('Shell: $line');

View file

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

View file

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

View file

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

View file

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

View file

@ -8,9 +8,9 @@ import 'test_device.dart';
abstract class TestWatcher {
/// 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.
void handleStartedDevice(Uri? observatoryUri) { }
void handleStartedDevice(Uri? vmServiceUri) { }
/// Called after the tests finish but before the test device exits.
///

View file

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

View file

@ -73,7 +73,7 @@ abstract class RPCErrorCodes {
/// The VM Service Protocol allows clients to register custom services that
/// 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
/// invoke Flutter HotReload when connected to a Flutter Application started in
/// hot mode.

View file

@ -153,7 +153,7 @@ abstract class ChromiumDevice extends Device {
);
}
_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
@ -474,7 +474,7 @@ class WebServerDevice extends Device {
'Consider using the Chrome or Edge devices for an improved development workflow.'
);
_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

View file

@ -91,14 +91,14 @@
]
},
"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",
"items": {
"type": "string"
},
"minItems": 1,
"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": {

View file

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

View file

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

View file

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

View file

@ -28,26 +28,26 @@ void main() {
};
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'))),
);
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'))),
);
});
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()))
.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()))
.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()))
.run(<String>['screenshot', '--observatory-url=http://localhost:8181']),
throwsToolExit(message: 'Observatory URI cannot be provided for screenshot type device'),
.run(<String>['screenshot', '--vm-service-url=http://localhost:8181']),
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()),
});
testUsingContext('Pipes enable-observatory', () async {
testUsingContext('Pipes enable-vmService', () async {
final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner(0);
final TestCommand testCommand = TestCommand(testRunner: testRunner);
@ -313,7 +313,7 @@ dev_dependencies:
'test/fake_test.dart',
]);
expect(
testRunner.lastEnableObservatoryValue,
testRunner.lastEnableVmServiceValue,
true,
);
@ -326,7 +326,7 @@ dev_dependencies:
'test/fake_test.dart',
]);
expect(
testRunner.lastEnableObservatoryValue,
testRunner.lastEnableVmServiceValue,
true,
);
@ -337,7 +337,7 @@ dev_dependencies:
'test/fake_test.dart',
]);
expect(
testRunner.lastEnableObservatoryValue,
testRunner.lastEnableVmServiceValue,
false,
);
}, overrides: <Type, Generator>{
@ -848,7 +848,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
int exitCode;
Duration? leastRunTime;
bool? lastEnableObservatoryValue;
bool? lastEnableVmServiceValue;
late DebuggingOptions lastDebuggingOptionsValue;
String? lastFileReporterValue;
String? lastReporterOption;
@ -862,7 +862,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
List<String> plainNames = const <String>[],
String? tags,
String? excludeTags,
bool enableObservatory = false,
bool enableVmService = false,
bool ipv6 = false,
bool machine = false,
String? precompiledDillPath,
@ -886,7 +886,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
String? integrationTestUserIdentifier,
TestTimeRecorder? testTimeRecorder,
}) async {
lastEnableObservatoryValue = enableObservatory;
lastEnableVmServiceValue = enableVmService;
lastDebuggingOptionsValue = debuggingOptions;
lastFileReporterValue = fileReporter;
lastReporterOption = reporter;

View file

@ -285,7 +285,7 @@ void main() {
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(processManager, hasNoRemainingExpectations);
});

View file

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

View file

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

View file

@ -359,7 +359,7 @@ void main() {
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> forwardPortCompleter = Completer<void>();
@ -391,7 +391,7 @@ void main() {
final LaunchResult launchResult = await appSession.start(debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug));
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(forwardPortCompleter.isCompleted, false);
@ -400,7 +400,7 @@ void main() {
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 FakeProcessManager processManager = FakeProcessManager.list(
@ -428,7 +428,7 @@ void main() {
final LaunchResult launchResult = await appSession.start(debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug));
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(await appSession.stop(), true);
@ -501,8 +501,8 @@ void main() {
bundleBuilder: FakeBundleBuilder()
);
expect(result.started, true);
expect(result.hasObservatory, true);
expect(result.observatoryUri, Uri.tryParse('http://127.0.0.1:12345/abcd/'));
expect(result.hasVmService, true);
expect(result.vmServiceUri, Uri.tryParse('http://127.0.0.1:12345/abcd/'));
expect(runDebugCompleter.isCompleted, false);
expect(forwardPortCompleter.isCompleted, false);

View file

@ -96,7 +96,7 @@ void main() {
);
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 {

View file

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

View file

@ -114,7 +114,7 @@ void main() {
]);
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
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;
await expectLater(
@ -139,7 +139,7 @@ void main() {
]);
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
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);
@ -170,7 +170,7 @@ void main() {
final FakeDevtoolsLauncher launcher = FakeDevtoolsLauncher();
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService, devtoolsLauncher: launcher);
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);
@ -202,7 +202,7 @@ void main() {
]);
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
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);
@ -232,7 +232,7 @@ void main() {
]);
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
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;
@ -258,7 +258,7 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.empty();
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
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);
@ -290,7 +290,7 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.empty();
final DriverService driverService = setUpDriverService(processManager: processManager, vmService: fakeVmServiceHost.vmService);
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);
@ -551,7 +551,7 @@ class FakeDartDevelopmentService extends Fake implements DartDevelopmentService
@override
Future<void> startDartDevelopmentService(
Uri observatoryUri, {
Uri vmServiceUri, {
required Logger logger,
int? hostPort,
bool? ipv6,

View file

@ -26,14 +26,14 @@ void main() {
group('FlutterPlatform', () {
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(
shellPath: '/',
debuggingOptions: DebuggingOptions.enabled(
BuildInfo.debug,
hostVmServicePort: 1234,
),
enableObservatory: false,
enableVmService: false,
);
flutterPlatform.loadChannel('test1.dart', FakeSuitePlatform());
@ -49,7 +49,7 @@ void main() {
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
shellPath: '/',
precompiledDillPath: 'example.dill',
enableObservatory: false,
enableVmService: false,
);
flutterPlatform.loadChannel('test1.dart', FakeSuitePlatform());
@ -87,7 +87,7 @@ void main() {
disableServiceAuthCodes: true,
hostVmServicePort: 200,
),
enableObservatory: true,
enableVmService: true,
machine: true,
precompiledDillPath: 'def',
precompiledDillFiles: expectedPrecompiledDillFiles,
@ -107,7 +107,7 @@ void main() {
expect(flutterPlatform.debuggingOptions.startPaused, equals(true));
expect(flutterPlatform.debuggingOptions.disableServiceAuthCodes, equals(true));
expect(flutterPlatform.debuggingOptions.hostVmServicePort, equals(200));
expect(flutterPlatform.enableObservatory, equals(true));
expect(flutterPlatform.enableVmService, equals(true));
expect(flutterPlatform.machine, equals(true));
expect(flutterPlatform.host, InternetAddress.loopbackIPv6);
expect(flutterPlatform.precompiledDillPath, equals('def'));

View file

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

View file

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

View file

@ -1035,7 +1035,7 @@ class FakeDartDevelopmentService extends Fake
implements DartDevelopmentService {
@override
Future<void> startDartDevelopmentService(
Uri observatoryUri, {
Uri vmServiceUri, {
required Logger logger,
int? hostPort,
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() {
late FakeVmServiceHost fakeVmServiceHost;
@ -71,7 +71,7 @@ void main() {
'ephemeral',
'ephemeral',
type: PlatformType.android,
launchResult: LaunchResult.succeeded(observatoryUri: observatoryUri),
launchResult: LaunchResult.succeeded(vmServiceUri: vmServiceUri),
),
debuggingOptions: DebuggingOptions.enabled(
BuildInfo.debug,
@ -126,7 +126,7 @@ void main() {
testUsingContext('Can start the entrypoint', () async {
await testDevice.start('entrypointPath');
expect(await testDevice.observatoryUri, observatoryUri);
expect(await testDevice.vmServiceUri, vmServiceUri);
expect(testDevice.finished, doesNotComplete);
}, overrides: <Type, Generator>{
ApplicationPackageFactory: () => FakeApplicationPackageFactory(),
@ -161,7 +161,7 @@ void main() {
}) 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(
id: 1,
device: FakeDevice(

View file

@ -85,7 +85,7 @@ FakeCommand attachDebuggerCommand({
if (!isNetworkDevice) '--no-wifi',
'--args',
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
'--enable-dart-profiling --enable-checked-mode --verify-entry-points',
],
@ -152,7 +152,7 @@ void main() {
);
expect(launchResult.started, true);
expect(launchResult.hasObservatory, true);
expect(launchResult.hasVmService, true);
expect(await device.stopApp(iosApp), false);
});
@ -190,7 +190,7 @@ void main() {
);
expect(launchResult.started, true);
expect(launchResult.hasObservatory, true);
expect(launchResult.hasVmService, true);
expect(await device.stopApp(iosApp), false);
});
@ -230,7 +230,7 @@ void main() {
);
expect(launchResult.started, true);
expect(launchResult.hasObservatory, true);
expect(launchResult.hasVmService, true);
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(utf8.decoder.convert(stdin.writes.first), contains('process interrupt'));
@ -275,7 +275,7 @@ void main() {
);
expect(launchResult.started, true);
expect(launchResult.hasObservatory, true);
expect(launchResult.hasVmService, true);
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('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.hasObservatory, false);
expect(launchResult.hasVmService, false);
expect(await device.stopApp(iosApp), false);
expect(processManager, hasNoRemainingExpectations);
});
@ -335,7 +335,7 @@ void main() {
<String>[
'--enable-dart-profiling',
'--disable-service-auth-codes',
'--disable-observatory-publication',
'--disable-vm-service-publication',
'--start-paused',
'--dart-flags="--foo,--null_assertions"',
'--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',
'--dart-flags=--baz,--null_assertions',
'--enable-impeller',
'--observatory-port=0',
'--vm-service-port=0',
]));
}, overrides: <Type, Generator>{
PlistParser: () => testPlistParser,

View file

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

View file

@ -421,7 +421,7 @@ void main() {
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';
final Uri uri = Uri.parse(value);

View file

@ -1492,7 +1492,7 @@ flutter:
commandHelp.c,
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')
));
@ -1521,7 +1521,7 @@ flutter:
commandHelp.c,
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')
));
@ -2123,7 +2123,7 @@ flutter:
};
final TestFlutterDevice flutterDevice = TestFlutterDevice(
device,
observatoryUris: Stream<Uri>.value(testUri),
vmServiceUris: Stream<Uri>.value(testUri),
);
bool caught = false;
final Completer<void>done = Completer<void>();
@ -2166,7 +2166,7 @@ flutter:
};
final TestFlutterDevice flutterDevice = TestFlutterDevice(
device,
observatoryUris: Stream<Uri>.value(testUri),
vmServiceUris: Stream<Uri>.value(testUri),
);
final Completer<void> done = Completer<void>();
await runZonedGuarded(
@ -2199,7 +2199,7 @@ flutter:
};
final TestFlutterDevice flutterDevice = TestFlutterDevice(
device,
observatoryUris: Stream<Uri>.value(testUri),
vmServiceUris: Stream<Uri>.value(testUri),
);
final Completer<void>done = Completer<void>();
await runZonedGuarded(
@ -2238,7 +2238,7 @@ flutter:
};
final TestFlutterDevice flutterDevice = TestFlutterDevice(
device,
observatoryUris: Stream<Uri>.value(testUri),
vmServiceUris: Stream<Uri>.value(testUri),
);
await flutterDevice.connect(allowExistingDdsInstance: true, ipv6: true, disableServiceAuthCodes: true);
await done.future;
@ -2279,7 +2279,7 @@ flutter:
};
final TestFlutterDevice flutterDevice = TestFlutterDevice(
device,
observatoryUris: Stream<Uri>.value(testUri),
vmServiceUris: Stream<Uri>.value(testUri),
);
await flutterDevice.connect(allowExistingDdsInstance: true, ipv6: true, disableServiceAuthCodes: true);
await done.future;
@ -2319,7 +2319,7 @@ flutter:
};
final TestFlutterDevice flutterDevice = TestFlutterDevice(
device,
observatoryUris: Stream<Uri>.value(testUri),
vmServiceUris: Stream<Uri>.value(testUri),
);
bool caught = false;
final Completer<void>done = Completer<void>();
@ -2487,13 +2487,13 @@ class FakeDartDevelopmentServiceException implements dds.DartDevelopmentServiceE
}
class TestFlutterDevice extends FlutterDevice {
TestFlutterDevice(super.device, { Stream<Uri>? observatoryUris })
: _observatoryUris = observatoryUris, super(buildInfo: BuildInfo.debug, developmentShaderCompiler: const FakeShaderCompiler());
TestFlutterDevice(super.device, { Stream<Uri>? vmServiceUris })
: _vmServiceUris = vmServiceUris, super(buildInfo: BuildInfo.debug, developmentShaderCompiler: const FakeShaderCompiler());
final Stream<Uri>? _observatoryUris;
final Stream<Uri>? _vmServiceUris;
@override
Stream<Uri> get observatoryUris => _observatoryUris!;
Stream<Uri> get vmServiceUris => _vmServiceUris!;
}
class ThrowingForwardingFileSystem extends ForwardingFileSystem {
@ -2530,7 +2530,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
TargetPlatform get targetPlatform => TargetPlatform.android;
@override
Stream<Uri?> get observatoryUris => Stream<Uri?>.value(testUri);
Stream<Uri?> get vmServiceUris => Stream<Uri?>.value(testUri);
@override
FlutterVmService? get vmService => vmServiceHost?.call()?.vmService;

View file

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

View file

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

View file

@ -140,7 +140,7 @@ void main() {
testUsingContext('performs a build and starts in debug mode', () async {
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>();
fakeProcessManager.addCommand(FakeCommand(
command: const <String>[
@ -155,7 +155,7 @@ void main() {
completer: completer,
stdout:
'''
The Dart VM service is listening on $observatoryUri
The Dart VM service is listening on $vmServiceUri
Hello!
''',
));
@ -166,14 +166,14 @@ Hello!
);
expect(result.started, isTrue);
expect(result.observatoryUri, observatoryUri);
expect(result.vmServiceUri, vmServiceUri);
expect(logLines.last, 'Hello!');
expect(fakeProcessManager, hasNoRemainingExpectations);
}, overrides: startOverrides);
testUsingContext('performs a build and starts in debug mode with track-widget-creation', () async {
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>();
fakeProcessManager.addCommand(FakeCommand(
command: const <String>[
@ -188,7 +188,7 @@ Hello!
completer: completer,
stdout:
'''
The Dart VM service is listening on $observatoryUri
The Dart VM service is listening on $vmServiceUri
Hello!
''',
));
@ -199,7 +199,7 @@ Hello!
);
expect(result.started, isTrue);
expect(result.observatoryUri, observatoryUri);
expect(result.vmServiceUri, vmServiceUri);
expect(logLines.last, 'Hello!');
expect(fakeProcessManager, hasNoRemainingExpectations);
}, overrides: startOverrides);

View file

@ -59,7 +59,7 @@ final FakeVmServiceRequest listViewsRequest = FakeVmServiceRequest(
);
void main() {
testWithoutContext('VmService registers reloadSources', () async {
testWithoutContext('VM Service registers reloadSources', () async {
Future<void> reloadSources(String isolateId, { bool? pause, bool? force}) async {}
final MockVMService mockVMService = MockVMService();
@ -76,7 +76,7 @@ void main() {
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 MockVMService mockVMService = MockVMService();
@ -93,7 +93,7 @@ void main() {
expect(mockVMService.services, containsPair('flutterMemoryInfo', 'Flutter Tools'));
});
testWithoutContext('VmService registers flutterGetSkSL service', () async {
testWithoutContext('VM Service registers flutterGetSkSL service', () async {
final MockVMService mockVMService = MockVMService();
await setUpVmService(
null,
@ -108,7 +108,7 @@ void main() {
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()
..errorOnRegisterService = true;
@ -123,7 +123,7 @@ void main() {
), 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()
..errorOnRegisterService = true;
@ -138,7 +138,7 @@ void main() {
), throwsToolExit());
});
testWithoutContext('VmService registers flutterPrintStructuredErrorLogMethod', () async {
testWithoutContext('VM Service registers flutterPrintStructuredErrorLogMethod', () async {
final MockVMService mockVMService = MockVMService();
await setUpVmService(
null,
@ -152,7 +152,7 @@ void main() {
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();
await setUpVmService(
null,
@ -167,7 +167,7 @@ void main() {
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();
FakeAsync().run((FakeAsync time) {
final Uri uri = Uri.parse('ws://127.0.0.1:12345/QqL7EFEDNG0=/ws');

View file

@ -40,7 +40,7 @@ void main() {
processManager.addCommand(FakeCommand(
command: const <String>[
'shell',
'--disable-observatory',
'--disable-vm-service',
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output',
@ -74,7 +74,7 @@ void main() {
processManager.addCommand(FakeCommand(
command: const <String>[
'shell',
'--disable-observatory',
'--disable-vm-service',
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output',
@ -107,7 +107,7 @@ void main() {
processManager.addCommand(FakeCommand(
command: const <String>[
'shell',
'--disable-observatory',
'--disable-vm-service',
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output',
@ -143,7 +143,7 @@ void main() {
processManager.addCommand(FakeCommand(
command: const <String>[
'shell',
'--disable-observatory',
'--disable-vm-service',
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output',
@ -152,7 +152,7 @@ void main() {
processManager.addCommand(FakeCommand(
command: const <String>[
'shell',
'--disable-observatory',
'--disable-vm-service',
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output',
@ -186,7 +186,7 @@ void main() {
processManager.addCommand(FakeCommand(
command: const <String>[
'shell',
'--disable-observatory',
'--disable-vm-service',
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'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', () {
final Directory buildDir = fileSystem.directory('/path/to/builds');
buildDir.createSync(recursive: true);
final TestContext context = TestContext(
<String>['test_observatory_bonjour_service'],
<String>['test_vm_service_bonjour_service'],
<String, String>{
'CONFIGURATION': 'Debug',
'BUILT_PRODUCTS_DIR': buildDir.path,
@ -212,7 +212,7 @@ void main() {
expect(
context.stdout,
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);
});
testWithoutContext('Info.plist dart observatory Bonjour service', () {
testWithoutContext('Info.plist dart VM Service Bonjour service', () {
final String infoPlistPath = fileSystem.path.join(
outputApp.path,
'Info.plist',
@ -173,7 +173,7 @@ void main() {
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);
final ProcessResult localNetworkUsage = processManager.runSync(

View file

@ -52,7 +52,7 @@ void main() {
transformToLines(process.stdout).listen((String line) async {
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 RegExpMatch match = exp.firstMatch(line)!;
final String port = match.group(1)!;

View file

@ -20,13 +20,13 @@ Future<int> getFreePort() async {
return port;
}
Future<void> waitForObservatoryMessage(Process process, int port) async {
Future<void> waitForVmServiceMessage(Process process, int port) async {
final Completer<void> completer = Completer<void>();
process.stdout
.transform(utf8.decoder)
.listen((String 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')) {
completer.complete();
} else {
@ -53,43 +53,43 @@ void main() {
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 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.
final Process process = await processManager.start(<String>[
flutterBin,
'run',
'--show-test-device',
'--observatory-port=$port',
'--vm-service-port=$port',
'-d',
'flutter-tester',
], workingDirectory: tempDir.path);
await waitForObservatoryMessage(process, port);
await waitForVmServiceMessage(process, port);
process.kill();
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 int observatoryPort = await getFreePort();
final int vmServicePort = await getFreePort();
int ddsPort = await getFreePort();
while(ddsPort == observatoryPort) {
while(ddsPort == vmServicePort) {
ddsPort = await getFreePort();
}
// If both --dds-port and --observatory-port are provided, --dds-port will be used by
// DDS and --observatory-port will be used by the VM service.
// If both --dds-port and --vm-service-port are provided, --dds-port will be used by
// DDS and --vm-service-port will be used by the VM service.
final Process process = await processManager.start(<String>[
flutterBin,
'run',
'--show-test-device',
'--observatory-port=$observatoryPort',
'--vm-service-port=$vmServicePort',
'--dds-port=$ddsPort',
'-d',
'flutter-tester',
], workingDirectory: tempDir.path);
await waitForObservatoryMessage(process, ddsPort);
await waitForVmServiceMessage(process, ddsPort);
process.kill();
await process.exitCode;
});
@ -107,7 +107,7 @@ void main() {
'-d',
'flutter-tester',
], workingDirectory: tempDir.path);
await waitForObservatoryMessage(process, ddsPort);
await waitForVmServiceMessage(process, ddsPort);
process.kill();
await process.exitCode;
});

View file

@ -502,7 +502,7 @@ void main() {
<String>['run', '-dflutter-tester', testScript],
testDirectory,
<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) {
return 'r';
}),
@ -594,7 +594,7 @@ void main() {
'c Clear the screen',
'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://'),
'',
'Flutter run key commands.',
@ -621,7 +621,7 @@ void main() {
'c Clear the screen',
'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://'),
'',
'Application finished.',

View file

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