Android tests: start adb server before emulator start, print emulator log to console

This commit is contained in:
Natalia.Ukhorskaya
2013-02-26 19:48:49 +04:00
parent ab792a587c
commit efe74a3b88
@@ -102,12 +102,32 @@ public class Emulator {
OutputUtils.checkResult(RunUtils.execute(getCreateCommand(), "no"));
}
public void startEmulator() {
System.out.println("Starting emulator...");
OutputUtils.checkResult(RunUtils.executeOnSeparateThread(getStartCommand(), false));
public void startServer() {
GeneralCommandLine commandLine = new GeneralCommandLine();
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
commandLine.addParameter("start-server");
System.out.println("Start adb server...");
OutputUtils.checkResult(RunUtils.execute(commandLine));
}
public void startEmulator() {
startServer();
System.out.println("Starting emulator...");
OutputUtils.checkResult(RunUtils.executeOnSeparateThread(getStartCommand(), false));
printLog();
}
public void printLog() {
GeneralCommandLine commandLine = new GeneralCommandLine();
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
commandLine.addParameter("logcat");
commandLine.addParameter("-v");
commandLine.addParameter("time");
commandLine.addParameter("*:I");
OutputUtils.checkResult(RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(commandLine, null, false, "LOGCAT: ", true)));
}
public void waitEmulatorStart() {
System.out.println("Waiting for emulator start...");