Unverified Commit 8ca55605 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tool] forward device-vmservice-port to iOS device launch arguments (#46822)

parent 592a842b
...@@ -345,6 +345,8 @@ class IOSDevice extends Device { ...@@ -345,6 +345,8 @@ class IOSDevice extends Device {
if (debuggingOptions.dumpSkpOnShaderCompilation) '--dump-skp-on-shader-compilation', if (debuggingOptions.dumpSkpOnShaderCompilation) '--dump-skp-on-shader-compilation',
if (debuggingOptions.verboseSystemLogs) '--verbose-logging', if (debuggingOptions.verboseSystemLogs) '--verbose-logging',
if (debuggingOptions.cacheSkSL) '--cache-sksl', if (debuggingOptions.cacheSkSL) '--cache-sksl',
if (debuggingOptions.deviceVmServicePort != null)
'--observatory-port=${debuggingOptions.deviceVmServicePort}',
if (platformArgs['trace-startup'] as bool ?? false) '--trace-startup', if (platformArgs['trace-startup'] as bool ?? false) '--trace-startup',
]; ];
......
...@@ -410,7 +410,7 @@ void main() { ...@@ -410,7 +410,7 @@ void main() {
Usage: () => mockUsage, Usage: () => mockUsage,
}); });
testUsingContext(' succeeds in release mode', () async { testUsingContext('succeeds in release mode', () async {
final IOSDevice device = IOSDevice('123'); final IOSDevice device = IOSDevice('123');
final LaunchResult launchResult = await device.startApp(mockApp, final LaunchResult launchResult = await device.startApp(mockApp,
prebuiltApplication: true, prebuiltApplication: true,
...@@ -428,7 +428,7 @@ void main() { ...@@ -428,7 +428,7 @@ void main() {
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
testUsingContext(' succeeds with --cache-sksl', () async { testUsingContext('succeeds with --cache-sksl', () async {
final IOSDevice device = IOSDevice('123'); final IOSDevice device = IOSDevice('123');
device.setLogReader(mockApp, mockLogReader); device.setLogReader(mockApp, mockLogReader);
final Uri uri = Uri( final Uri uri = Uri(
...@@ -472,6 +472,50 @@ void main() { ...@@ -472,6 +472,50 @@ void main() {
IOSDeploy: () => mockIosDeploy, IOSDeploy: () => mockIosDeploy,
}); });
testUsingContext('succeeds with --device-vmservice-port', () async {
final IOSDevice device = IOSDevice('123');
device.setLogReader(mockApp, mockLogReader);
final Uri uri = Uri(
scheme: 'http',
host: '127.0.0.1',
port: 1234,
path: 'observatory',
);
when(mockMDnsObservatoryDiscovery.getObservatoryUri(any, any, usesIpv6: anyNamed('usesIpv6')))
.thenAnswer((Invocation invocation) => Future<Uri>.value(uri));
List<String> args;
when(mockIosDeploy.runApp(
deviceId: anyNamed('deviceId'),
bundlePath: anyNamed('bundlePath'),
launchArguments: anyNamed('launchArguments'),
)).thenAnswer((Invocation inv) {
args = inv.namedArguments[const Symbol('launchArguments')] as List<String>;
return Future<int>.value(0);
});
final LaunchResult launchResult = await device.startApp(mockApp,
prebuiltApplication: true,
debuggingOptions: DebuggingOptions.enabled(
const BuildInfo(BuildMode.debug, null),
deviceVmServicePort: 8181,
),
platformArgs: <String, dynamic>{},
);
expect(launchResult.started, isTrue);
expect(args, contains('--observatory-port=8181'));
expect(await device.stopApp(mockApp), isFalse);
}, overrides: <Type, Generator>{
Artifacts: () => mockArtifacts,
Cache: () => mockCache,
FileSystem: () => mockFileSystem,
MDnsObservatoryDiscovery: () => mockMDnsObservatoryDiscovery,
Platform: () => macPlatform,
ProcessManager: () => mockProcessManager,
Usage: () => mockUsage,
IOSDeploy: () => mockIosDeploy,
});
void testNonPrebuilt( void testNonPrebuilt(
String name, { String name, {
@required bool showBuildSettingsFlakes, @required bool showBuildSettingsFlakes,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment