Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Unified Diff: testing/android/driver/java/src/org/chromium/test/driver/OnDeviceInstrumentationDriver.java

Issue 1493953002: [Android] Add support for timeouts scaling for OnDevice instrumentation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added wrong GN dependency. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/android/driver/BUILD.gn ('k') | testing/android/on_device_instrumentation.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/android/driver/java/src/org/chromium/test/driver/OnDeviceInstrumentationDriver.java
diff --git a/testing/android/driver/java/src/org/chromium/test/driver/OnDeviceInstrumentationDriver.java b/testing/android/driver/java/src/org/chromium/test/driver/OnDeviceInstrumentationDriver.java
index c209ac7d15d2d76ba8adfa714b706b9c347a3bc0..f9b31b03e97830f1f162fdeeb93b7bbea7282ef9 100644
--- a/testing/android/driver/java/src/org/chromium/test/driver/OnDeviceInstrumentationDriver.java
+++ b/testing/android/driver/java/src/org/chromium/test/driver/OnDeviceInstrumentationDriver.java
@@ -13,6 +13,7 @@ import android.os.Environment;
import android.test.InstrumentationTestRunner;
import android.util.Log;
+import org.chromium.base.test.util.ScalableTimeout;
import org.chromium.test.broker.OnDeviceInstrumentationBroker;
import org.chromium.test.reporter.TestStatusReceiver;
import org.chromium.test.reporter.TestStatusReporter;
@@ -21,8 +22,10 @@ import org.chromium.test.support.RobotiumBundleGenerator;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
+import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -44,6 +47,8 @@ public class OnDeviceInstrumentationDriver extends Instrumentation {
"org.chromium.test.driver.OnDeviceInstrumentationDriver.TargetPackage";
private static final String EXTRA_TARGET_CLASS =
"org.chromium.test.driver.OnDeviceInstrumentationDriver.TargetClass";
+ private static final String EXTRA_TIMEOUT_SCALE =
+ "org.chromium.test.driver.OnDeviceInstrumentationDriver.TimeoutScale";
private static final Pattern COMMA = Pattern.compile(",");
private static final int TEST_WAIT_TIMEOUT = 5 * TestStatusReporter.HEARTBEAT_INTERVAL_MS;
@@ -54,6 +59,7 @@ public class OnDeviceInstrumentationDriver extends Instrumentation {
private String mTargetClass;
private String mTargetPackage;
private List<String> mTestClasses;
+ private String mTimeoutScale;
/** Parse any arguments and prepare to run tests.
@@ -101,6 +107,18 @@ public class OnDeviceInstrumentationDriver extends Instrumentation {
mTargetArgs.remove(EXTRA_TEST_LIST_FILE);
}
+ mTimeoutScale = arguments.getString(EXTRA_TIMEOUT_SCALE);
+ if (mTimeoutScale != null) {
+ try {
+ OutputStreamWriter outputStreamWriter = new OutputStreamWriter(
+ new FileOutputStream(ScalableTimeout.PROPERTY_FILE));
+ outputStreamWriter.write(mTimeoutScale);
+ outputStreamWriter.close();
+ } catch (IOException e) {
+ Log.e(TAG, "Error writing " + ScalableTimeout.PROPERTY_FILE, e);
+ }
+ }
+
if (mTestClasses.isEmpty()) {
fail("No tests.");
return;
@@ -129,6 +147,11 @@ public class OnDeviceInstrumentationDriver extends Instrumentation {
@Override
public void onDestroy() {
super.onDestroy();
+ if (mTimeoutScale != null) {
+ if (!new File(ScalableTimeout.PROPERTY_FILE).delete()) {
+ Log.e(TAG, "Error deleting " + ScalableTimeout.PROPERTY_FILE);
+ }
+ }
}
private class Driver implements Runnable {
« no previous file with comments | « testing/android/driver/BUILD.gn ('k') | testing/android/on_device_instrumentation.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698