Pass device-user in machine mode (#107747)
This commit is contained in:
@@ -499,6 +499,7 @@ class AppDomain extends Domain {
|
||||
bool multidexEnabled = false,
|
||||
String? isolateFilter,
|
||||
bool machine = true,
|
||||
String? userIdentifier,
|
||||
}) async {
|
||||
if (!await device.supportsRuntimeMode(options.buildInfo.mode)) {
|
||||
throw Exception(
|
||||
@@ -517,6 +518,7 @@ class AppDomain extends Domain {
|
||||
target: target,
|
||||
buildInfo: options.buildInfo,
|
||||
platform: globals.platform,
|
||||
userIdentifier: userIdentifier,
|
||||
);
|
||||
|
||||
ResidentRunner runner;
|
||||
|
||||
@@ -605,6 +605,7 @@ class RunCommand extends RunCommandBase {
|
||||
dillOutputPath: stringArgDeprecated('output-dill'),
|
||||
ipv6: ipv6 ?? false,
|
||||
multidexEnabled: boolArgDeprecated('multidex'),
|
||||
userIdentifier: userIdentifier,
|
||||
);
|
||||
} on Exception catch (error) {
|
||||
throwToolExit(error.toString());
|
||||
|
||||
@@ -520,6 +520,37 @@ void main() {
|
||||
Stdio: () => FakeStdio(),
|
||||
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 {
|
||||
CapturingAppDomain(Daemon daemon) : super(daemon);
|
||||
|
||||
bool /*?*/ multidexEnabled;
|
||||
String /*?*/ userIdentifier;
|
||||
|
||||
@override
|
||||
Future<AppInstance> startApp(
|
||||
@@ -1098,8 +1130,10 @@ class CapturingAppDomain extends AppDomain {
|
||||
bool multidexEnabled = false,
|
||||
String isolateFilter,
|
||||
bool machine = true,
|
||||
String userIdentifier,
|
||||
}) async {
|
||||
this.multidexEnabled = multidexEnabled;
|
||||
this.userIdentifier = userIdentifier;
|
||||
throwToolExit('');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user