mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
This reverts commit 66b01c1f29
.
* Add DDS ipv6 support
* Use --dds-port for DDS instead of hijacking --host-vmservice-port
This commit is contained in:
parent
71fa330931
commit
a17b330980
@ -36,7 +36,7 @@ dependencies:
|
|||||||
glob: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
glob: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||||
html: 0.14.0+3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
html: 0.14.0+3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||||
http_multi_server: 2.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
http_multi_server: 2.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||||
image: 2.1.14 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
image: 2.1.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||||
io: 0.3.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
io: 0.3.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||||
js: 0.6.3-nullsafety # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
js: 0.6.3-nullsafety # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||||
json_rpc_2: 2.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
json_rpc_2: 2.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||||
@ -76,4 +76,4 @@ dev_dependencies:
|
|||||||
mockito: 4.1.1
|
mockito: 4.1.1
|
||||||
test_api: 0.2.19-nullsafety
|
test_api: 0.2.19-nullsafety
|
||||||
|
|
||||||
# PUBSPEC CHECKSUM: 7ac4
|
# PUBSPEC CHECKSUM: c8c5
|
||||||
|
@ -10,7 +10,7 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
args: 1.6.0
|
args: 1.6.0
|
||||||
file: 6.0.0-nullsafety.1
|
file: 6.0.0-nullsafety.1
|
||||||
image: 2.1.14
|
image: 2.1.15
|
||||||
meta: 1.3.0-nullsafety.2
|
meta: 1.3.0-nullsafety.2
|
||||||
path: 1.8.0-nullsafety
|
path: 1.8.0-nullsafety
|
||||||
platform: 3.0.0-nullsafety.1
|
platform: 3.0.0-nullsafety.1
|
||||||
@ -75,4 +75,4 @@ dev_dependencies:
|
|||||||
webkit_inspection_protocol: 0.7.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
webkit_inspection_protocol: 0.7.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||||
yaml: 2.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
yaml: 2.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||||
|
|
||||||
# PUBSPEC CHECKSUM: a87f
|
# PUBSPEC CHECKSUM: da80
|
||||||
|
@ -6,7 +6,7 @@ environment:
|
|||||||
sdk: ">=2.8.0 <3.0.0"
|
sdk: ">=2.8.0 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
image: 2.1.14
|
image: 2.1.15
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_driver:
|
flutter_driver:
|
||||||
@ -84,4 +84,4 @@ dev_dependencies:
|
|||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
# PUBSPEC CHECKSUM: 2dc6
|
# PUBSPEC CHECKSUM: 6fc7
|
||||||
|
@ -13,30 +13,24 @@ import 'logger.dart';
|
|||||||
class DartDevelopmentService {
|
class DartDevelopmentService {
|
||||||
DartDevelopmentService({@required this.logger});
|
DartDevelopmentService({@required this.logger});
|
||||||
|
|
||||||
// TODO(bkonyi): enable once VM service can handle SSE forwarding for
|
|
||||||
// Devtools (https://github.com/flutter/flutter/issues/62507)
|
|
||||||
static const bool ddsDisabled = true;
|
|
||||||
final Logger logger;
|
final Logger logger;
|
||||||
dds.DartDevelopmentService _ddsInstance;
|
dds.DartDevelopmentService _ddsInstance;
|
||||||
|
|
||||||
|
Uri get uri => _ddsInstance.uri;
|
||||||
|
|
||||||
Future<void> startDartDevelopmentService(
|
Future<void> startDartDevelopmentService(
|
||||||
Uri observatoryUri,
|
Uri observatoryUri,
|
||||||
|
int hostPort,
|
||||||
bool ipv6,
|
bool ipv6,
|
||||||
|
bool disableServiceAuthCodes,
|
||||||
) async {
|
) async {
|
||||||
if (ddsDisabled) {
|
|
||||||
logger.printTrace(
|
|
||||||
'DDS is currently disabled due to '
|
|
||||||
'https://github.com/flutter/flutter/issues/62507'
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Uri ddsUri = Uri(
|
final Uri ddsUri = Uri(
|
||||||
scheme: 'http',
|
scheme: 'http',
|
||||||
host: (ipv6 ?
|
host: (ipv6 ?
|
||||||
io.InternetAddress.loopbackIPv6 :
|
io.InternetAddress.loopbackIPv6 :
|
||||||
io.InternetAddress.loopbackIPv4
|
io.InternetAddress.loopbackIPv4
|
||||||
).host,
|
).host,
|
||||||
port: 0,
|
port: hostPort ?? 0,
|
||||||
);
|
);
|
||||||
logger.printTrace(
|
logger.printTrace(
|
||||||
'Launching a Dart Developer Service (DDS) instance at $ddsUri, '
|
'Launching a Dart Developer Service (DDS) instance at $ddsUri, '
|
||||||
@ -46,6 +40,8 @@ class DartDevelopmentService {
|
|||||||
_ddsInstance = await dds.DartDevelopmentService.startDartDevelopmentService(
|
_ddsInstance = await dds.DartDevelopmentService.startDartDevelopmentService(
|
||||||
observatoryUri,
|
observatoryUri,
|
||||||
serviceUri: ddsUri,
|
serviceUri: ddsUri,
|
||||||
|
enableAuthCodes: !disableServiceAuthCodes,
|
||||||
|
ipv6: ipv6,
|
||||||
);
|
);
|
||||||
logger.printTrace('DDS is listening at ${_ddsInstance.uri}.');
|
logger.printTrace('DDS is listening at ${_ddsInstance.uri}.');
|
||||||
} on dds.DartDevelopmentServiceException catch (e) {
|
} on dds.DartDevelopmentServiceException catch (e) {
|
||||||
|
@ -236,12 +236,18 @@ class DriveCommand extends RunCommandBase {
|
|||||||
}
|
}
|
||||||
observatoryUri = result.observatoryUri.toString();
|
observatoryUri = result.observatoryUri.toString();
|
||||||
// TODO(bkonyi): add web support (https://github.com/flutter/flutter/issues/61259)
|
// TODO(bkonyi): add web support (https://github.com/flutter/flutter/issues/61259)
|
||||||
if (!isWebPlatform) {
|
if (!isWebPlatform && !disableDds) {
|
||||||
try {
|
try {
|
||||||
// If there's another flutter_tools instance still connected to the target
|
// If there's another flutter_tools instance still connected to the target
|
||||||
// application, DDS will already be running remotely and this call will fail.
|
// application, DDS will already be running remotely and this call will fail.
|
||||||
// We can ignore this and continue to use the remote DDS instance.
|
// We can ignore this and continue to use the remote DDS instance.
|
||||||
await device.dds.startDartDevelopmentService(Uri.parse(observatoryUri), ipv6);
|
await device.dds.startDartDevelopmentService(
|
||||||
|
Uri.parse(observatoryUri),
|
||||||
|
ddsPort,
|
||||||
|
ipv6,
|
||||||
|
disableServiceAuthCodes,
|
||||||
|
);
|
||||||
|
observatoryUri = device.dds.uri.toString();
|
||||||
} on dds.DartDevelopmentServiceException catch(_) {
|
} on dds.DartDevelopmentServiceException catch(_) {
|
||||||
globals.printTrace('Note: DDS is already connected to $observatoryUri.');
|
globals.printTrace('Note: DDS is already connected to $observatoryUri.');
|
||||||
}
|
}
|
||||||
@ -480,7 +486,8 @@ Future<LaunchResult> _startApp(
|
|||||||
debuggingOptions: DebuggingOptions.enabled(
|
debuggingOptions: DebuggingOptions.enabled(
|
||||||
command.getBuildInfo(),
|
command.getBuildInfo(),
|
||||||
startPaused: true,
|
startPaused: true,
|
||||||
hostVmServicePort: command.hostVmservicePort,
|
hostVmServicePort: webUri != null ? command.hostVmservicePort : 0,
|
||||||
|
ddsPort: command.ddsPort,
|
||||||
verboseSystemLogs: command.verboseSystemLogs,
|
verboseSystemLogs: command.verboseSystemLogs,
|
||||||
cacheSkSL: command.cacheSkSL,
|
cacheSkSL: command.cacheSkSL,
|
||||||
dumpSkpOnShaderCompilation: command.dumpSkpOnShaderCompilation,
|
dumpSkpOnShaderCompilation: command.dumpSkpOnShaderCompilation,
|
||||||
|
@ -66,7 +66,12 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
help: 'A file to write the attached vmservice uri to after an'
|
help: 'A file to write the attached vmservice uri to after an'
|
||||||
' application is started.',
|
' application is started.',
|
||||||
valueHelp: 'project/example/out.txt'
|
valueHelp: 'project/example/out.txt'
|
||||||
);
|
)
|
||||||
|
..addFlag('disable-service-auth-codes',
|
||||||
|
negatable: false,
|
||||||
|
hide: !verboseHelp,
|
||||||
|
help: 'No longer require an authentication code to connect to the VM '
|
||||||
|
'service (not recommended).');
|
||||||
usesWebOptions(hide: !verboseHelp);
|
usesWebOptions(hide: !verboseHelp);
|
||||||
usesTargetOption();
|
usesTargetOption();
|
||||||
usesPortOptions();
|
usesPortOptions();
|
||||||
@ -76,13 +81,14 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
addNullSafetyModeOptions(hide: !verboseHelp);
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
usesDeviceUserOption();
|
usesDeviceUserOption();
|
||||||
usesDeviceTimeoutOption();
|
usesDeviceTimeoutOption();
|
||||||
|
addDdsOptions(verboseHelp: verboseHelp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get traceStartup => boolArg('trace-startup');
|
bool get traceStartup => boolArg('trace-startup');
|
||||||
bool get cacheSkSL => boolArg('cache-sksl');
|
bool get cacheSkSL => boolArg('cache-sksl');
|
||||||
bool get dumpSkpOnShaderCompilation => boolArg('dump-skp-on-shader-compilation');
|
bool get dumpSkpOnShaderCompilation => boolArg('dump-skp-on-shader-compilation');
|
||||||
bool get purgePersistentCache => boolArg('purge-persistent-cache');
|
bool get purgePersistentCache => boolArg('purge-persistent-cache');
|
||||||
|
bool get disableServiceAuthCodes => boolArg('disable-service-auth-codes');
|
||||||
String get route => stringArg('route');
|
String get route => stringArg('route');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,11 +212,6 @@ class RunCommand extends RunCommandBase {
|
|||||||
'results out to "refresh_benchmark.json", and exit. This flag is '
|
'results out to "refresh_benchmark.json", and exit. This flag is '
|
||||||
'intended for use in generating automated flutter benchmarks.',
|
'intended for use in generating automated flutter benchmarks.',
|
||||||
)
|
)
|
||||||
..addFlag('disable-service-auth-codes',
|
|
||||||
negatable: false,
|
|
||||||
hide: !verboseHelp,
|
|
||||||
help: 'No longer require an authentication code to connect to the VM '
|
|
||||||
'service (not recommended).')
|
|
||||||
..addFlag('web-initialize-platform',
|
..addFlag('web-initialize-platform',
|
||||||
negatable: true,
|
negatable: true,
|
||||||
defaultsTo: true,
|
defaultsTo: true,
|
||||||
@ -227,7 +228,6 @@ class RunCommand extends RunCommandBase {
|
|||||||
'Currently this is only supported on Android devices. This option '
|
'Currently this is only supported on Android devices. This option '
|
||||||
'cannot be paired with --use-application-binary.'
|
'cannot be paired with --use-application-binary.'
|
||||||
);
|
);
|
||||||
addDdsOptions(verboseHelp: verboseHelp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -408,6 +408,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
purgePersistentCache: purgePersistentCache,
|
purgePersistentCache: purgePersistentCache,
|
||||||
deviceVmServicePort: deviceVmservicePort,
|
deviceVmServicePort: deviceVmservicePort,
|
||||||
hostVmServicePort: hostVmservicePort,
|
hostVmServicePort: hostVmservicePort,
|
||||||
|
ddsPort: ddsPort,
|
||||||
verboseSystemLogs: boolArg('verbose-system-logs'),
|
verboseSystemLogs: boolArg('verbose-system-logs'),
|
||||||
initializePlatform: boolArg('web-initialize-platform'),
|
initializePlatform: boolArg('web-initialize-platform'),
|
||||||
hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '',
|
hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '',
|
||||||
|
@ -131,6 +131,7 @@ class TestCommand extends FlutterCommand {
|
|||||||
'This flag is ignored if --start-paused or coverage are requested. '
|
'This flag is ignored if --start-paused or coverage are requested. '
|
||||||
'The vmservice will be enabled no matter what in those cases.'
|
'The vmservice will be enabled no matter what in those cases.'
|
||||||
);
|
);
|
||||||
|
addDdsOptions(verboseHelp: verboseHelp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The interface for starting and configuring the tester.
|
/// The interface for starting and configuring the tester.
|
||||||
@ -274,6 +275,7 @@ class TestCommand extends FlutterCommand {
|
|||||||
enableObservatory: collector != null || startPaused || boolArg('enable-vmservice'),
|
enableObservatory: collector != null || startPaused || boolArg('enable-vmservice'),
|
||||||
startPaused: startPaused,
|
startPaused: startPaused,
|
||||||
disableServiceAuthCodes: disableServiceAuthCodes,
|
disableServiceAuthCodes: disableServiceAuthCodes,
|
||||||
|
disableDds: disableDds,
|
||||||
ipv6: boolArg('ipv6'),
|
ipv6: boolArg('ipv6'),
|
||||||
machine: machine,
|
machine: machine,
|
||||||
buildMode: BuildMode.debug,
|
buildMode: BuildMode.debug,
|
||||||
|
@ -789,6 +789,7 @@ class DebuggingOptions {
|
|||||||
this.verboseSystemLogs = false,
|
this.verboseSystemLogs = false,
|
||||||
this.hostVmServicePort,
|
this.hostVmServicePort,
|
||||||
this.deviceVmServicePort,
|
this.deviceVmServicePort,
|
||||||
|
this.ddsPort,
|
||||||
this.initializePlatform = true,
|
this.initializePlatform = true,
|
||||||
this.hostname,
|
this.hostname,
|
||||||
this.port,
|
this.port,
|
||||||
@ -830,6 +831,7 @@ class DebuggingOptions {
|
|||||||
verboseSystemLogs = false,
|
verboseSystemLogs = false,
|
||||||
hostVmServicePort = null,
|
hostVmServicePort = null,
|
||||||
deviceVmServicePort = null,
|
deviceVmServicePort = null,
|
||||||
|
ddsPort = null,
|
||||||
vmserviceOutFile = null,
|
vmserviceOutFile = null,
|
||||||
fastStart = false,
|
fastStart = false,
|
||||||
webEnableExpressionEvaluation = false,
|
webEnableExpressionEvaluation = false,
|
||||||
@ -857,6 +859,7 @@ class DebuggingOptions {
|
|||||||
final bool initializePlatform;
|
final bool initializePlatform;
|
||||||
final int hostVmServicePort;
|
final int hostVmServicePort;
|
||||||
final int deviceVmServicePort;
|
final int deviceVmServicePort;
|
||||||
|
final int ddsPort;
|
||||||
final String port;
|
final String port;
|
||||||
final String hostname;
|
final String hostname;
|
||||||
final bool webEnableExposeUrl;
|
final bool webEnableExposeUrl;
|
||||||
|
@ -55,8 +55,14 @@ Future<vm_service.VmService> _kDefaultFuchsiaIsolateDiscoveryConnector(Uri uri)
|
|||||||
Future<void> _kDefaultDartDevelopmentServiceStarter(
|
Future<void> _kDefaultDartDevelopmentServiceStarter(
|
||||||
Device device,
|
Device device,
|
||||||
Uri observatoryUri,
|
Uri observatoryUri,
|
||||||
|
bool disableServiceAuthCodes,
|
||||||
) async {
|
) async {
|
||||||
await device.dds.startDartDevelopmentService(observatoryUri, true);
|
await device.dds.startDartDevelopmentService(
|
||||||
|
observatoryUri,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
disableServiceAuthCodes,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read the log for a particular device.
|
/// Read the log for a particular device.
|
||||||
@ -738,7 +744,7 @@ class FuchsiaIsolateDiscoveryProtocol {
|
|||||||
final String _isolateName;
|
final String _isolateName;
|
||||||
final Completer<Uri> _foundUri = Completer<Uri>();
|
final Completer<Uri> _foundUri = Completer<Uri>();
|
||||||
final Future<vm_service.VmService> Function(Uri) _vmServiceConnector;
|
final Future<vm_service.VmService> Function(Uri) _vmServiceConnector;
|
||||||
final Future<void> Function(Device, Uri) _ddsStarter;
|
final Future<void> Function(Device, Uri, bool) _ddsStarter;
|
||||||
// whether to only poll once.
|
// whether to only poll once.
|
||||||
final bool _pollOnce;
|
final bool _pollOnce;
|
||||||
Timer _pollingTimer;
|
Timer _pollingTimer;
|
||||||
@ -781,8 +787,8 @@ class FuchsiaIsolateDiscoveryProtocol {
|
|||||||
final int localPort = await _device.portForwarder.forward(port);
|
final int localPort = await _device.portForwarder.forward(port);
|
||||||
try {
|
try {
|
||||||
final Uri uri = Uri.parse('http://[$_ipv6Loopback]:$localPort');
|
final Uri uri = Uri.parse('http://[$_ipv6Loopback]:$localPort');
|
||||||
await _ddsStarter(_device, uri);
|
await _ddsStarter(_device, uri, true);
|
||||||
service = await _vmServiceConnector(uri);
|
service = await _vmServiceConnector(_device.dds.uri);
|
||||||
_ports[port] = service;
|
_ports[port] = service;
|
||||||
} on SocketException catch (err) {
|
} on SocketException catch (err) {
|
||||||
globals.printTrace('Failed to connect to $localPort: $err');
|
globals.printTrace('Failed to connect to $localPort: $err');
|
||||||
|
@ -424,8 +424,8 @@ class IOSSimulator extends Device {
|
|||||||
if (debuggingOptions.skiaDeterministicRendering) '--skia-deterministic-rendering',
|
if (debuggingOptions.skiaDeterministicRendering) '--skia-deterministic-rendering',
|
||||||
if (debuggingOptions.useTestFonts) '--use-test-fonts',
|
if (debuggingOptions.useTestFonts) '--use-test-fonts',
|
||||||
if (debuggingOptions.traceAllowlist != null) '--trace-allowlist="${debuggingOptions.traceAllowlist}"',
|
if (debuggingOptions.traceAllowlist != null) '--trace-allowlist="${debuggingOptions.traceAllowlist}"',
|
||||||
if (dartVmFlags.isNotEmpty) '--dart-flags=$dartVmFlags'
|
if (dartVmFlags.isNotEmpty) '--dart-flags=$dartVmFlags',
|
||||||
'--observatory-port=${debuggingOptions.hostVmServicePort ?? 0}',
|
'--observatory-port=${debuggingOptions.hostVmServicePort ?? 0}'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -237,7 +237,9 @@ Future<Uri> buildObservatoryUri(
|
|||||||
if (!path.endsWith('/')) {
|
if (!path.endsWith('/')) {
|
||||||
path += '/';
|
path += '/';
|
||||||
}
|
}
|
||||||
final int actualHostPort = hostVmservicePort ?? await device
|
hostVmservicePort ??= 0;
|
||||||
.portForwarder.forward(devicePort);
|
final int actualHostPort = hostVmservicePort == 0 ?
|
||||||
|
await device.portForwarder.forward(devicePort) :
|
||||||
|
hostVmservicePort;
|
||||||
return Uri(scheme: 'http', host: host, port: actualHostPort, path: path);
|
return Uri(scheme: 'http', host: host, port: actualHostPort, path: path);
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,9 @@ class FlutterDevice {
|
|||||||
ReloadMethod reloadMethod,
|
ReloadMethod reloadMethod,
|
||||||
GetSkSLMethod getSkSLMethod,
|
GetSkSLMethod getSkSLMethod,
|
||||||
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
|
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
|
||||||
|
int hostVmServicePort,
|
||||||
|
int ddsPort,
|
||||||
|
bool disableServiceAuthCodes = false,
|
||||||
bool disableDds = false,
|
bool disableDds = false,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
}) {
|
}) {
|
||||||
@ -220,12 +223,14 @@ class FlutterDevice {
|
|||||||
if (!disableDds) {
|
if (!disableDds) {
|
||||||
await device.dds.startDartDevelopmentService(
|
await device.dds.startDartDevelopmentService(
|
||||||
observatoryUri,
|
observatoryUri,
|
||||||
|
ddsPort,
|
||||||
ipv6,
|
ipv6,
|
||||||
|
disableServiceAuthCodes,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
service = await connectToVmService(
|
service = await connectToVmService(
|
||||||
observatoryUri,
|
disableDds ? observatoryUri : device.dds.uri,
|
||||||
reloadSources: reloadSources,
|
reloadSources: reloadSources,
|
||||||
restart: restart,
|
restart: restart,
|
||||||
compileExpression: compileExpression,
|
compileExpression: compileExpression,
|
||||||
@ -1238,10 +1243,13 @@ abstract class ResidentRunner {
|
|||||||
restart: restart,
|
restart: restart,
|
||||||
compileExpression: compileExpression,
|
compileExpression: compileExpression,
|
||||||
disableDds: debuggingOptions.disableDds,
|
disableDds: debuggingOptions.disableDds,
|
||||||
|
ddsPort: debuggingOptions.ddsPort,
|
||||||
|
hostVmServicePort: debuggingOptions.hostVmServicePort,
|
||||||
reloadMethod: reloadMethod,
|
reloadMethod: reloadMethod,
|
||||||
getSkSLMethod: getSkSLMethod,
|
getSkSLMethod: getSkSLMethod,
|
||||||
printStructuredErrorLogMethod: printStructuredErrorLog,
|
printStructuredErrorLogMethod: printStructuredErrorLog,
|
||||||
ipv6: ipv6,
|
ipv6: ipv6,
|
||||||
|
disableServiceAuthCodes: debuggingOptions.disableServiceAuthCodes
|
||||||
);
|
);
|
||||||
// This will wait for at least one flutter view before returning.
|
// This will wait for at least one flutter view before returning.
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
|
@ -285,7 +285,9 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
argParser.addOption(observatoryPortOption,
|
argParser.addOption(observatoryPortOption,
|
||||||
help: '(deprecated use host-vmservice-port instead) '
|
help: '(deprecated use host-vmservice-port instead) '
|
||||||
'Listen to the given port for an observatory debugger connection.\n'
|
'Listen to the given port for an observatory debugger connection.\n'
|
||||||
'Specifying port 0 (the default) will find a random free port.',
|
'Specifying port 0 (the default) will find a random free port.\nNote: '
|
||||||
|
'if the Dart Development Service (DDS) is enabled, this will not be the port '
|
||||||
|
'of the Observatory instance advertised on the command line.',
|
||||||
);
|
);
|
||||||
argParser.addOption('device-vmservice-port',
|
argParser.addOption('device-vmservice-port',
|
||||||
help: 'Look for vmservice connections only from the specified port.\n'
|
help: 'Look for vmservice connections only from the specified port.\n'
|
||||||
@ -301,6 +303,10 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addDdsOptions({@required bool verboseHelp}) {
|
void addDdsOptions({@required bool verboseHelp}) {
|
||||||
|
argParser.addOption('dds-port',
|
||||||
|
help: 'When this value is provided, the Dart Development Service (DDS) will be '
|
||||||
|
'bound to the provided port.\nSpecifying port 0 (the default) will find '
|
||||||
|
'a random free port.');
|
||||||
argParser.addFlag(
|
argParser.addFlag(
|
||||||
'disable-dds',
|
'disable-dds',
|
||||||
hide: !verboseHelp,
|
hide: !verboseHelp,
|
||||||
@ -313,6 +319,15 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get disableDds => boolArg('disable-dds');
|
||||||
|
|
||||||
|
int get ddsPort {
|
||||||
|
if (argResults.wasParsed('dds-port')) {
|
||||||
|
return int.tryParse(stringArg('dds-port')) ?? 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets the vmservice port provided to in the 'observatory-port' or
|
/// Gets the vmservice port provided to in the 'observatory-port' or
|
||||||
/// 'host-vmservice-port option.
|
/// 'host-vmservice-port option.
|
||||||
///
|
///
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:dds/dds.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:package_config/package_config.dart';
|
import 'package:package_config/package_config.dart';
|
||||||
import 'package:stream_channel/stream_channel.dart';
|
import 'package:stream_channel/stream_channel.dart';
|
||||||
@ -52,6 +53,7 @@ FlutterPlatform installHook({
|
|||||||
bool machine = false,
|
bool machine = false,
|
||||||
bool startPaused = false,
|
bool startPaused = false,
|
||||||
bool disableServiceAuthCodes = false,
|
bool disableServiceAuthCodes = false,
|
||||||
|
bool disableDds = false,
|
||||||
int port = 0,
|
int port = 0,
|
||||||
String precompiledDillPath,
|
String precompiledDillPath,
|
||||||
Map<String, String> precompiledDillFiles,
|
Map<String, String> precompiledDillFiles,
|
||||||
@ -89,6 +91,7 @@ FlutterPlatform installHook({
|
|||||||
enableObservatory: enableObservatory,
|
enableObservatory: enableObservatory,
|
||||||
startPaused: startPaused,
|
startPaused: startPaused,
|
||||||
disableServiceAuthCodes: disableServiceAuthCodes,
|
disableServiceAuthCodes: disableServiceAuthCodes,
|
||||||
|
disableDds: disableDds,
|
||||||
explicitObservatoryPort: observatoryPort,
|
explicitObservatoryPort: observatoryPort,
|
||||||
host: _kHosts[serverType],
|
host: _kHosts[serverType],
|
||||||
port: port,
|
port: port,
|
||||||
@ -233,6 +236,7 @@ class FlutterPlatform extends PlatformPlugin {
|
|||||||
this.machine,
|
this.machine,
|
||||||
this.startPaused,
|
this.startPaused,
|
||||||
this.disableServiceAuthCodes,
|
this.disableServiceAuthCodes,
|
||||||
|
this.disableDds,
|
||||||
this.explicitObservatoryPort,
|
this.explicitObservatoryPort,
|
||||||
this.host,
|
this.host,
|
||||||
this.port,
|
this.port,
|
||||||
@ -255,6 +259,7 @@ class FlutterPlatform extends PlatformPlugin {
|
|||||||
final bool machine;
|
final bool machine;
|
||||||
final bool startPaused;
|
final bool startPaused;
|
||||||
final bool disableServiceAuthCodes;
|
final bool disableServiceAuthCodes;
|
||||||
|
final bool disableDds;
|
||||||
final int explicitObservatoryPort;
|
final int explicitObservatoryPort;
|
||||||
final InternetAddress host;
|
final InternetAddress host;
|
||||||
final int port;
|
final int port;
|
||||||
@ -402,7 +407,7 @@ class FlutterPlatform extends PlatformPlugin {
|
|||||||
controllerSinkClosed = true;
|
controllerSinkClosed = true;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Prepare our WebSocket server to talk to the engine subproces.
|
// Prepare our WebSocket server to talk to the engine subprocess.
|
||||||
final HttpServer server = await bind(host, port);
|
final HttpServer server = await bind(host, port);
|
||||||
finalizers.add(() async {
|
finalizers.add(() async {
|
||||||
globals.printTrace('test $ourTestCount: shutting down test harness socket server');
|
globals.printTrace('test $ourTestCount: shutting down test harness socket server');
|
||||||
@ -496,15 +501,17 @@ class FlutterPlatform extends PlatformPlugin {
|
|||||||
assert(processObservatoryUri == null);
|
assert(processObservatoryUri == null);
|
||||||
assert(explicitObservatoryPort == null ||
|
assert(explicitObservatoryPort == null ||
|
||||||
explicitObservatoryPort == detectedUri.port);
|
explicitObservatoryPort == detectedUri.port);
|
||||||
if (startPaused && !machine) {
|
if (!disableDds) {
|
||||||
globals.printStatus('The test process has been started.');
|
final DartDevelopmentService dds = await DartDevelopmentService.startDartDevelopmentService(
|
||||||
globals.printStatus('You can now connect to it using observatory. To connect, load the following Web site in your browser:');
|
detectedUri,
|
||||||
globals.printStatus(' $detectedUri');
|
enableAuthCodes: !disableServiceAuthCodes,
|
||||||
globals.printStatus('You should first set appropriate breakpoints, then resume the test in the debugger.');
|
ipv6: host.type == InternetAddressType.IPv6,
|
||||||
|
);
|
||||||
|
processObservatoryUri = dds.uri;
|
||||||
|
globals.printTrace('Dart Development Service started at ${dds.uri}, forwarding to VM service at ${dds.remoteVmServiceUri}.');
|
||||||
} else {
|
} else {
|
||||||
globals.printTrace('test $ourTestCount: using observatory uri $detectedUri from pid ${process.pid}');
|
processObservatoryUri = detectedUri;
|
||||||
}
|
}
|
||||||
processObservatoryUri = detectedUri;
|
|
||||||
{
|
{
|
||||||
globals.printTrace('Connecting to service protocol: $processObservatoryUri');
|
globals.printTrace('Connecting to service protocol: $processObservatoryUri');
|
||||||
final Future<vm_service.VmService> localVmService = connectToVmService(processObservatoryUri,
|
final Future<vm_service.VmService> localVmService = connectToVmService(processObservatoryUri,
|
||||||
@ -513,6 +520,14 @@ class FlutterPlatform extends PlatformPlugin {
|
|||||||
globals.printTrace('Successfully connected to service protocol: $processObservatoryUri');
|
globals.printTrace('Successfully connected to service protocol: $processObservatoryUri');
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
if (startPaused && !machine) {
|
||||||
|
globals.printStatus('The test process has been started.');
|
||||||
|
globals.printStatus('You can now connect to it using observatory. To connect, load the following Web site in your browser:');
|
||||||
|
globals.printStatus(' $processObservatoryUri');
|
||||||
|
globals.printStatus('You should first set appropriate breakpoints, then resume the test in the debugger.');
|
||||||
|
} else {
|
||||||
|
globals.printTrace('test $ourTestCount: using observatory uri $processObservatoryUri from pid ${process.pid}');
|
||||||
|
}
|
||||||
gotProcessObservatoryUri.complete();
|
gotProcessObservatoryUri.complete();
|
||||||
watcher?.handleStartedProcess(
|
watcher?.handleStartedProcess(
|
||||||
ProcessEvent(ourTestCount, process, processObservatoryUri));
|
ProcessEvent(ourTestCount, process, processObservatoryUri));
|
||||||
|
@ -34,6 +34,7 @@ abstract class FlutterTestRunner {
|
|||||||
bool enableObservatory = false,
|
bool enableObservatory = false,
|
||||||
bool startPaused = false,
|
bool startPaused = false,
|
||||||
bool disableServiceAuthCodes = false,
|
bool disableServiceAuthCodes = false,
|
||||||
|
bool disableDds = false,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
bool machine = false,
|
bool machine = false,
|
||||||
String precompiledDillPath,
|
String precompiledDillPath,
|
||||||
@ -69,6 +70,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
|
|||||||
bool enableObservatory = false,
|
bool enableObservatory = false,
|
||||||
bool startPaused = false,
|
bool startPaused = false,
|
||||||
bool disableServiceAuthCodes = false,
|
bool disableServiceAuthCodes = false,
|
||||||
|
bool disableDds = false,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
bool machine = false,
|
bool machine = false,
|
||||||
String precompiledDillPath,
|
String precompiledDillPath,
|
||||||
@ -167,6 +169,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
|
|||||||
machine: machine,
|
machine: machine,
|
||||||
startPaused: startPaused,
|
startPaused: startPaused,
|
||||||
disableServiceAuthCodes: disableServiceAuthCodes,
|
disableServiceAuthCodes: disableServiceAuthCodes,
|
||||||
|
disableDds: disableDds,
|
||||||
serverType: serverType,
|
serverType: serverType,
|
||||||
precompiledDillPath: precompiledDillPath,
|
precompiledDillPath: precompiledDillPath,
|
||||||
precompiledDillFiles: precompiledDillFiles,
|
precompiledDillFiles: precompiledDillFiles,
|
||||||
|
@ -11,7 +11,7 @@ dependencies:
|
|||||||
# To update these, use "flutter update-packages --force-upgrade".
|
# To update these, use "flutter update-packages --force-upgrade".
|
||||||
archive: 2.0.13
|
archive: 2.0.13
|
||||||
args: 1.6.0
|
args: 1.6.0
|
||||||
dds: 1.3.1
|
dds: 1.3.4
|
||||||
dwds: 6.0.0
|
dwds: 6.0.0
|
||||||
completion: 0.2.2
|
completion: 0.2.2
|
||||||
coverage: 0.14.1
|
coverage: 0.14.1
|
||||||
@ -113,4 +113,4 @@ dartdoc:
|
|||||||
# Exclude this package from the hosted API docs.
|
# Exclude this package from the hosted API docs.
|
||||||
nodoc: true
|
nodoc: true
|
||||||
|
|
||||||
# PUBSPEC CHECKSUM: 7423
|
# PUBSPEC CHECKSUM: 9526
|
||||||
|
@ -90,8 +90,8 @@ void main() {
|
|||||||
when(portForwarder.unforward(any))
|
when(portForwarder.unforward(any))
|
||||||
.thenAnswer((_) async {});
|
.thenAnswer((_) async {});
|
||||||
when(device.dds).thenReturn(mockDds);
|
when(device.dds).thenReturn(mockDds);
|
||||||
when(mockDds.startDartDevelopmentService(any, false)).thenReturn(null);
|
when(mockDds.startDartDevelopmentService(any, any, false, any)).thenReturn(null);
|
||||||
|
when(mockDds.uri).thenReturn(Uri.parse('http://localhost:8181'));
|
||||||
final HttpClientRequest httpClientRequest = MockHttpClientRequest();
|
final HttpClientRequest httpClientRequest = MockHttpClientRequest();
|
||||||
httpClient = MockHttpClient();
|
httpClient = MockHttpClient();
|
||||||
when(httpClient.putUrl(any))
|
when(httpClient.putUrl(any))
|
||||||
@ -317,7 +317,8 @@ void main() {
|
|||||||
)).thenReturn(mockHotRunner);
|
)).thenReturn(mockHotRunner);
|
||||||
when(mockHotRunner.exited).thenReturn(false);
|
when(mockHotRunner.exited).thenReturn(false);
|
||||||
when(mockHotRunner.isWaitingForObservatory).thenReturn(false);
|
when(mockHotRunner.isWaitingForObservatory).thenReturn(false);
|
||||||
when(mockDds.startDartDevelopmentService(any, false)).thenReturn(null);
|
when(mockDds.startDartDevelopmentService(any, any, false, any)).thenReturn(null);
|
||||||
|
when(mockDds.uri).thenReturn(Uri.parse('http://localhost:8181'));
|
||||||
|
|
||||||
testDeviceManager.addDevice(device);
|
testDeviceManager.addDevice(device);
|
||||||
when(device.getLogReader(includePastLogs: anyNamed('includePastLogs')))
|
when(device.getLogReader(includePastLogs: anyNamed('includePastLogs')))
|
||||||
@ -398,7 +399,8 @@ void main() {
|
|||||||
)).thenReturn(mockHotRunner);
|
)).thenReturn(mockHotRunner);
|
||||||
when(mockHotRunner.exited).thenReturn(false);
|
when(mockHotRunner.exited).thenReturn(false);
|
||||||
when(mockHotRunner.isWaitingForObservatory).thenReturn(false);
|
when(mockHotRunner.isWaitingForObservatory).thenReturn(false);
|
||||||
when(mockDds.startDartDevelopmentService(any, false)).thenReturn(null);
|
when(mockDds.startDartDevelopmentService(any, any, false, any)).thenReturn(null);
|
||||||
|
when(mockDds.uri).thenReturn(Uri.parse('http://localhost:8181'));
|
||||||
|
|
||||||
testDeviceManager.addDevice(device);
|
testDeviceManager.addDevice(device);
|
||||||
|
|
||||||
@ -444,8 +446,9 @@ void main() {
|
|||||||
.thenAnswer((_) async {});
|
.thenAnswer((_) async {});
|
||||||
when(device.dds)
|
when(device.dds)
|
||||||
.thenReturn(mockDds);
|
.thenReturn(mockDds);
|
||||||
when(mockDds.startDartDevelopmentService(any, any))
|
when(mockDds.startDartDevelopmentService(any, any, any, any))
|
||||||
.thenReturn(null);
|
.thenReturn(null);
|
||||||
|
when(mockDds.uri).thenReturn(Uri.parse('http://localhost:8181'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('succeeds in ipv4 mode', () async {
|
testUsingContext('succeeds in ipv4 mode', () async {
|
||||||
|
@ -69,7 +69,8 @@ void main() {
|
|||||||
void applyDdsMocks(Device device) {
|
void applyDdsMocks(Device device) {
|
||||||
final MockDartDevelopmentService mockDds = MockDartDevelopmentService();
|
final MockDartDevelopmentService mockDds = MockDartDevelopmentService();
|
||||||
when(device.dds).thenReturn(mockDds);
|
when(device.dds).thenReturn(mockDds);
|
||||||
when(mockDds.startDartDevelopmentService(any, any)).thenReturn(null);
|
when(mockDds.startDartDevelopmentService(any, any, any, any)).thenReturn(null);
|
||||||
|
when(mockDds.uri).thenReturn(Uri.parse('http://localhost:8181'));
|
||||||
}
|
}
|
||||||
|
|
||||||
testUsingContext('returns 1 when test file is not found', () async {
|
testUsingContext('returns 1 when test file is not found', () async {
|
||||||
@ -222,6 +223,7 @@ void main() {
|
|||||||
'drive',
|
'drive',
|
||||||
'--target=$testApp',
|
'--target=$testApp',
|
||||||
'--no-pub',
|
'--no-pub',
|
||||||
|
'--disable-dds',
|
||||||
'--device-user',
|
'--device-user',
|
||||||
'10',
|
'10',
|
||||||
];
|
];
|
||||||
|
@ -168,6 +168,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
|
|||||||
String excludeTags,
|
String excludeTags,
|
||||||
bool enableObservatory = false,
|
bool enableObservatory = false,
|
||||||
bool startPaused = false,
|
bool startPaused = false,
|
||||||
|
bool disableDds = false,
|
||||||
bool disableServiceAuthCodes = false,
|
bool disableServiceAuthCodes = false,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
bool machine = false,
|
bool machine = false,
|
||||||
|
@ -138,6 +138,9 @@ class TestFlutterDevice extends FlutterDevice {
|
|||||||
GetSkSLMethod getSkSLMethod,
|
GetSkSLMethod getSkSLMethod,
|
||||||
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
|
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
|
||||||
bool disableDds = false,
|
bool disableDds = false,
|
||||||
|
bool disableServiceAuthCodes = false,
|
||||||
|
int hostVmServicePort,
|
||||||
|
int ddsPort,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
}) async {
|
}) async {
|
||||||
throw exception;
|
throw exception;
|
||||||
|
@ -10,6 +10,7 @@ import 'package:flutter_tools/src/application_package.dart';
|
|||||||
import 'package:flutter_tools/src/artifacts.dart';
|
import 'package:flutter_tools/src/artifacts.dart';
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
|
import 'package:flutter_tools/src/base/dds.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
@ -769,10 +770,13 @@ void main() {
|
|||||||
fuchsiaDevice,
|
fuchsiaDevice,
|
||||||
expectedIsolateName,
|
expectedIsolateName,
|
||||||
(Uri uri) async => fakeVmServiceHost.vmService,
|
(Uri uri) async => fakeVmServiceHost.vmService,
|
||||||
(Device device, Uri uri) => null,
|
(Device device, Uri uri, bool enableServiceAuthCodes) => null,
|
||||||
true, // only poll once.
|
true, // only poll once.
|
||||||
);
|
);
|
||||||
|
final MockDartDevelopmentService mockDds = MockDartDevelopmentService();
|
||||||
|
when(fuchsiaDevice.dds).thenReturn(mockDds);
|
||||||
|
when(mockDds.startDartDevelopmentService(any, any, any, any)).thenReturn(null);
|
||||||
|
when(mockDds.uri).thenReturn(Uri.parse('example'));
|
||||||
when(fuchsiaDevice.servicePorts())
|
when(fuchsiaDevice.servicePorts())
|
||||||
.thenAnswer((Invocation invocation) async => <int>[1]);
|
.thenAnswer((Invocation invocation) async => <int>[1]);
|
||||||
when(portForwarder.forward(1))
|
when(portForwarder.forward(1))
|
||||||
@ -1600,5 +1604,6 @@ class MockFuchsiaSdk extends Mock implements FuchsiaSdk {
|
|||||||
final FuchsiaDevFinder fuchsiaDevFinder;
|
final FuchsiaDevFinder fuchsiaDevFinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MockDartDevelopmentService extends Mock implements DartDevelopmentService {}
|
||||||
class MockFuchsiaWorkflow extends Mock implements FuchsiaWorkflow {}
|
class MockFuchsiaWorkflow extends Mock implements FuchsiaWorkflow {}
|
||||||
class MockCache extends Mock implements Cache {}
|
class MockCache extends Mock implements Cache {}
|
||||||
|
@ -576,8 +576,11 @@ class TestFlutterDevice extends FlutterDevice {
|
|||||||
ReloadMethod reloadMethod,
|
ReloadMethod reloadMethod,
|
||||||
GetSkSLMethod getSkSLMethod,
|
GetSkSLMethod getSkSLMethod,
|
||||||
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
|
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
|
||||||
|
bool disableServiceAuthCodes = false,
|
||||||
bool disableDds = false,
|
bool disableDds = false,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
|
int hostVmServicePort,
|
||||||
|
int ddsPort,
|
||||||
}) async {
|
}) async {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import 'dart:async';
|
|||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/application_package.dart';
|
import 'package:flutter_tools/src/application_package.dart';
|
||||||
import 'package:flutter_tools/src/artifacts.dart';
|
import 'package:flutter_tools/src/artifacts.dart';
|
||||||
|
import 'package:flutter_tools/src/base/dds.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart' as io;
|
import 'package:flutter_tools/src/base/io.dart' as io;
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
@ -135,7 +136,8 @@ void main() {
|
|||||||
when(MDnsObservatoryDiscovery.instance.getObservatoryUri(
|
when(MDnsObservatoryDiscovery.instance.getObservatoryUri(
|
||||||
any,
|
any,
|
||||||
any,
|
any,
|
||||||
usesIpv6: anyNamed('usesIpv6')
|
usesIpv6: anyNamed('usesIpv6'),
|
||||||
|
hostVmservicePort: anyNamed('hostVmservicePort')
|
||||||
)).thenAnswer((Invocation invocation) async => uri);
|
)).thenAnswer((Invocation invocation) async => uri);
|
||||||
|
|
||||||
final LaunchResult launchResult = await device.startApp(iosApp,
|
final LaunchResult launchResult = await device.startApp(iosApp,
|
||||||
@ -367,6 +369,7 @@ void main() {
|
|||||||
any,
|
any,
|
||||||
any,
|
any,
|
||||||
usesIpv6: anyNamed('usesIpv6'),
|
usesIpv6: anyNamed('usesIpv6'),
|
||||||
|
hostVmservicePort: anyNamed('hostVmservicePort')
|
||||||
)).thenAnswer((Invocation invocation) async => uri);
|
)).thenAnswer((Invocation invocation) async => uri);
|
||||||
|
|
||||||
final LaunchResult launchResult = await device.startApp(iosApp,
|
final LaunchResult launchResult = await device.startApp(iosApp,
|
||||||
@ -454,3 +457,4 @@ class MockMDnsObservatoryDiscovery extends Mock implements MDnsObservatoryDiscov
|
|||||||
class MockArtifacts extends Mock implements Artifacts {}
|
class MockArtifacts extends Mock implements Artifacts {}
|
||||||
class MockCache extends Mock implements Cache {}
|
class MockCache extends Mock implements Cache {}
|
||||||
class MockVmService extends Mock implements VmService {}
|
class MockVmService extends Mock implements VmService {}
|
||||||
|
class MockDartDevelopmentService extends Mock implements DartDevelopmentService {}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
import 'package:flutter_tools/src/device.dart';
|
||||||
import 'package:flutter_tools/src/mdns_discovery.dart';
|
import 'package:flutter_tools/src/mdns_discovery.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:multicast_dns/multicast_dns.dart';
|
import 'package:multicast_dns/multicast_dns.dart';
|
||||||
@ -205,6 +206,25 @@ void main() {
|
|||||||
throwsA(isA<Exception>()),
|
throwsA(isA<Exception>()),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('Correctly builds Observatory URI with hostVmservicePort == 0', () async {
|
||||||
|
final MDnsClient client = getMockClient(
|
||||||
|
<PtrResourceRecord>[
|
||||||
|
PtrResourceRecord('foo', year3000, domainName: 'bar'),
|
||||||
|
],
|
||||||
|
<String, List<SrvResourceRecord>>{
|
||||||
|
'bar': <SrvResourceRecord>[
|
||||||
|
SrvResourceRecord('bar', year3000, port: 123, weight: 1, priority: 1, target: 'appId'),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
final MockIOSDevice mockDevice = MockIOSDevice();
|
||||||
|
when(mockDevice.portForwarder).thenReturn(const NoOpDevicePortForwarder());
|
||||||
|
final MDnsObservatoryDiscovery portDiscovery = MDnsObservatoryDiscovery(mdnsClient: client);
|
||||||
|
final Uri uri = await portDiscovery.getObservatoryUri('bar', mockDevice, hostVmservicePort: 0);
|
||||||
|
expect(uri.toString(), 'http://127.0.0.1:123/');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2258,7 +2258,8 @@ void main() {
|
|||||||
final MockDeviceLogReader mockLogReader = MockDeviceLogReader();
|
final MockDeviceLogReader mockLogReader = MockDeviceLogReader();
|
||||||
when(mockDevice.getLogReader(app: anyNamed('app'))).thenReturn(mockLogReader);
|
when(mockDevice.getLogReader(app: anyNamed('app'))).thenReturn(mockLogReader);
|
||||||
when(mockDevice.dds).thenReturn(mockDds);
|
when(mockDevice.dds).thenReturn(mockDds);
|
||||||
when(mockDds.startDartDevelopmentService(any, any)).thenReturn(null);
|
when(mockDds.startDartDevelopmentService(any, any, any, any)).thenReturn(null);
|
||||||
|
when(mockDds.uri).thenReturn(Uri.parse('http://localhost:8181'));
|
||||||
|
|
||||||
final TestFlutterDevice flutterDevice = TestFlutterDevice(
|
final TestFlutterDevice flutterDevice = TestFlutterDevice(
|
||||||
mockDevice,
|
mockDevice,
|
||||||
@ -2345,10 +2346,13 @@ class FakeFlutterDevice extends FlutterDevice {
|
|||||||
ReloadSources reloadSources,
|
ReloadSources reloadSources,
|
||||||
Restart restart,
|
Restart restart,
|
||||||
bool disableDds = false,
|
bool disableDds = false,
|
||||||
|
bool disableServiceAuthCodes = false,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
CompileExpression compileExpression,
|
CompileExpression compileExpression,
|
||||||
ReloadMethod reloadMethod,
|
ReloadMethod reloadMethod,
|
||||||
GetSkSLMethod getSkSLMethod,
|
GetSkSLMethod getSkSLMethod,
|
||||||
|
int hostVmServicePort,
|
||||||
|
int ddsPort,
|
||||||
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
|
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
|
||||||
}) async { }
|
}) async { }
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:flutter_tools/src/base/dds.dart';
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:matcher/matcher.dart';
|
import 'package:matcher/matcher.dart';
|
||||||
import 'package:vm_service/vm_service.dart';
|
import 'package:vm_service/vm_service.dart';
|
||||||
@ -44,7 +43,7 @@ void main() {
|
|||||||
for (final Protocol protocol in protocolList.protocols) {
|
for (final Protocol protocol in protocolList.protocols) {
|
||||||
expect(protocol.protocolName, anyOf('VM Service', 'DDS'));
|
expect(protocol.protocolName, anyOf('VM Service', 'DDS'));
|
||||||
}
|
}
|
||||||
}, skip: DartDevelopmentService.ddsDisabled);
|
});
|
||||||
|
|
||||||
testWithoutContext('flutterVersion can be called', () async {
|
testWithoutContext('flutterVersion can be called', () async {
|
||||||
final Response response =
|
final Response response =
|
||||||
|
Loading…
Reference in New Issue
Block a user