Devicelab android emulator (#113472)

* Testing whether emulator is possible.

* Adding changes to see if emulator can be used from recipe.

* adding emulator support.

* Add the emulator flag for testing.

* Using string for boolean since it cannot be parsed in properties

* Checking to see if these changes are being used.

* Updated bool back to string

* Remove trailing whitespace from file.
This commit is contained in:
Ricardo Amador
2023-01-17 14:01:11 -08:00
committed by GitHub
parent 0449030a96
commit f989d551ce
5 changed files with 28 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ Future<void> runTasks(
String? luciBuilder,
String? resultsPath,
List<String>? taskArgs,
bool useEmulator = false,
@visibleForTesting Map<String, String>? isolateParams,
@visibleForTesting Function(String) print = print,
@visibleForTesting List<String>? logs,
@@ -59,6 +60,7 @@ Future<void> runTasks(
gitBranch: gitBranch,
luciBuilder: luciBuilder,
isolateParams: isolateParams,
useEmulator: useEmulator,
);
if (!result.succeeded) {
@@ -104,6 +106,7 @@ Future<TaskResult> rerunTask(
String? resultsPath,
String? gitBranch,
String? luciBuilder,
bool useEmulator = false,
@visibleForTesting Map<String, String>? isolateParams,
}) async {
section('Running task "$taskName"');
@@ -116,6 +119,7 @@ Future<TaskResult> rerunTask(
silent: silent,
taskArgs: taskArgs,
isolateParams: isolateParams,
useEmulator: useEmulator,
);
print('Task result:');
@@ -152,6 +156,7 @@ Future<TaskResult> runTask(
String? localEngineSrcPath,
String? deviceId,
List<String>? taskArgs,
bool useEmulator = false,
@visibleForTesting Map<String, String>? isolateParams,
}) async {
final String taskExecutable = 'bin/tasks/$taskName.dart';
@@ -160,6 +165,13 @@ Future<TaskResult> runTask(
throw 'Executable Dart file not found: $taskExecutable';
}
if (useEmulator) {
taskArgs ??= <String>[];
taskArgs
..add('--android-emulator')
..add('--browser-name=android-chrome');
}
final Process runner = await startProcess(
dartBin,
<String>[

View File

@@ -283,6 +283,7 @@ Future<Process> startProcess(
newEnvironment['BOT'] = isBot ? 'true' : 'false';
newEnvironment['LANG'] = 'en_US.UTF-8';
print('Executing "$command" in "$finalWorkingDirectory" with environment $newEnvironment');
final Process process = await _processManager.start(
<String>[executable, ...?arguments],
environment: newEnvironment,