Unverified Commit 2cfeb0d1 authored by Lau Ching Jun's avatar Lau Ching Jun Committed by GitHub

Pass device-user in machine mode (#107747)

parent 1a4f9635
...@@ -499,6 +499,7 @@ class AppDomain extends Domain { ...@@ -499,6 +499,7 @@ class AppDomain extends Domain {
bool multidexEnabled = false, bool multidexEnabled = false,
String? isolateFilter, String? isolateFilter,
bool machine = true, bool machine = true,
String? userIdentifier,
}) async { }) async {
if (!await device.supportsRuntimeMode(options.buildInfo.mode)) { if (!await device.supportsRuntimeMode(options.buildInfo.mode)) {
throw Exception( throw Exception(
...@@ -517,6 +518,7 @@ class AppDomain extends Domain { ...@@ -517,6 +518,7 @@ class AppDomain extends Domain {
target: target, target: target,
buildInfo: options.buildInfo, buildInfo: options.buildInfo,
platform: globals.platform, platform: globals.platform,
userIdentifier: userIdentifier,
); );
ResidentRunner runner; ResidentRunner runner;
......
...@@ -605,6 +605,7 @@ class RunCommand extends RunCommandBase { ...@@ -605,6 +605,7 @@ class RunCommand extends RunCommandBase {
dillOutputPath: stringArgDeprecated('output-dill'), dillOutputPath: stringArgDeprecated('output-dill'),
ipv6: ipv6 ?? false, ipv6: ipv6 ?? false,
multidexEnabled: boolArgDeprecated('multidex'), multidexEnabled: boolArgDeprecated('multidex'),
userIdentifier: userIdentifier,
); );
} on Exception catch (error) { } on Exception catch (error) {
throwToolExit(error.toString()); throwToolExit(error.toString());
......
...@@ -520,6 +520,37 @@ void main() { ...@@ -520,6 +520,37 @@ void main() {
Stdio: () => FakeStdio(), Stdio: () => FakeStdio(),
Logger: () => AppRunLogger(parent: BufferLogger.test()), Logger: () => AppRunLogger(parent: BufferLogger.test()),
}); });
testUsingContext('can pass --device-user', () async {
final DaemonCapturingRunCommand command = DaemonCapturingRunCommand();
final FakeDevice device = FakeDevice(platformType: PlatformType.android);
mockDeviceManager
..devices = <Device>[device]
..targetDevices = <Device>[device];
await expectLater(
() => createTestCommandRunner(command).run(<String>[
'run',
'--no-pub',
'--machine',
'--device-user',
'10',
'-d',
device.id,
]),
throwsToolExit(),
);
expect(command.appDomain.userIdentifier, '10');
}, overrides: <Type, Generator>{
Artifacts: () => artifacts,
Cache: () => Cache.test(processManager: FakeProcessManager.any()),
DeviceManager: () => mockDeviceManager,
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
Usage: () => usage,
Stdio: () => FakeStdio(),
Logger: () => AppRunLogger(parent: BufferLogger.test()),
});
}); });
}); });
...@@ -1080,6 +1111,7 @@ class CapturingAppDomain extends AppDomain { ...@@ -1080,6 +1111,7 @@ class CapturingAppDomain extends AppDomain {
CapturingAppDomain(Daemon daemon) : super(daemon); CapturingAppDomain(Daemon daemon) : super(daemon);
bool /*?*/ multidexEnabled; bool /*?*/ multidexEnabled;
String /*?*/ userIdentifier;
@override @override
Future<AppInstance> startApp( Future<AppInstance> startApp(
...@@ -1098,8 +1130,10 @@ class CapturingAppDomain extends AppDomain { ...@@ -1098,8 +1130,10 @@ class CapturingAppDomain extends AppDomain {
bool multidexEnabled = false, bool multidexEnabled = false,
String isolateFilter, String isolateFilter,
bool machine = true, bool machine = true,
String userIdentifier,
}) async { }) async {
this.multidexEnabled = multidexEnabled; this.multidexEnabled = multidexEnabled;
this.userIdentifier = userIdentifier;
throwToolExit(''); throwToolExit('');
} }
} }
......
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