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

Unified Diff: testing/android/java/src/org/chromium/test/passenger/OnDeviceInstrumentationPassenger.java

Issue 1034053002: [Android] Add an out-of-app instrumentation driver APK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: the rename Created 5 years, 8 months 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
Index: testing/android/java/src/org/chromium/test/passenger/OnDeviceInstrumentationPassenger.java
diff --git a/testing/android/java/src/org/chromium/test/passenger/OnDeviceInstrumentationPassenger.java b/testing/android/java/src/org/chromium/test/passenger/OnDeviceInstrumentationPassenger.java
new file mode 100644
index 0000000000000000000000000000000000000000..507e558cab90fc1c3b5b85ad3c863a10805f49b0
--- /dev/null
+++ b/testing/android/java/src/org/chromium/test/passenger/OnDeviceInstrumentationPassenger.java
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.test.passenger;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+/**
+ * An Activity target for OnDeviceInstrumentationPassenger that starts the specified
Yaron 2015/04/07 15:39:04 Perhaps *Broker? Passenger doesn't mean anything t
jbudorick 2015/04/07 19:24:45 I'm no good with names and am open to suggestions.
Yaron 2015/04/07 20:12:29 Broker seemed like a decent-ish analog based on: h
+ * Instrumentation test.
+ */
+public class OnDeviceInstrumentationPassenger extends Activity {
+
+ public static final String EXTRA_INSTRUMENTATION_PACKAGE =
+ "org.chromium.test.passenger.OnDeviceInstrumentationPassenger."
+ + "InstrumentationPackage";
+ public static final String EXTRA_INSTRUMENTATION_CLASS =
+ "org.chromium.test.passenger.OnDeviceInstrumentationPassenger."
+ + "InstrumentationClass";
+ public static final String EXTRA_TARGET_ARGS =
+ "org.chromium.test.passenger.OnDeviceInstrumentationPassenger.TargetArgs";
+ public static final String EXTRA_TEST =
+ "org.chromium.test.passenger.OnDeviceInstrumentationPassenger.Test";
+
+ private static final String TAG = "OnDeviceInstrumentationPassenger";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Log.d(TAG, "onCreate()");
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+
+ Intent i = getIntent();
+ String instrumentationPackage = i.getStringExtra(EXTRA_INSTRUMENTATION_PACKAGE);
+ String instrumentationClass = i.getStringExtra(EXTRA_INSTRUMENTATION_CLASS);
+ Bundle targetArgs = i.getBundleExtra(EXTRA_TARGET_ARGS);
+ String test = i.getStringExtra(EXTRA_TEST);
+
+ if (instrumentationPackage == null || instrumentationClass == null) {
+ finish();
+ return;
+ }
+
+ ComponentName instrumentationComponent =
+ new ComponentName(instrumentationPackage, instrumentationClass);
+
+ if (test != null) {
+ targetArgs.putString("class", test);
+ }
+
+ startInstrumentation(instrumentationComponent, null, targetArgs);
+ finish();
+ }
+}
+

Powered by Google App Engine
This is Rietveld 408576698