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

Side by Side Diff: testing/android/broker/java/src/org/chromium/test/broker/OnDeviceInstrumentationBroker.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: cjhopman comment Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « testing/android/broker/BUILD.gn ('k') | testing/android/driver/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.test.broker;
6
7 import android.app.Activity;
8 import android.content.ComponentName;
9 import android.content.Intent;
10 import android.os.Bundle;
11 import android.util.Log;
12
13 /**
14 * An Activity target for OnDeviceInstrumentationDriver that starts the specifie d
15 * Instrumentation test.
16 */
17 public class OnDeviceInstrumentationBroker extends Activity {
18
19 public static final String EXTRA_INSTRUMENTATION_PACKAGE =
20 "org.chromium.test.broker.OnDeviceInstrumentationBroker."
21 + "InstrumentationPackage";
22 public static final String EXTRA_INSTRUMENTATION_CLASS =
23 "org.chromium.test.broker.OnDeviceInstrumentationBroker."
24 + "InstrumentationClass";
25 public static final String EXTRA_TARGET_ARGS =
26 "org.chromium.test.broker.OnDeviceInstrumentationBroker.TargetArgs";
27 public static final String EXTRA_TEST =
28 "org.chromium.test.broker.OnDeviceInstrumentationBroker.Test";
29
30 private static final String TAG = "OnDeviceInstrumentationBroker";
31
32 @Override
33 public void onCreate(Bundle savedInstanceState) {
34 super.onCreate(savedInstanceState);
35 Log.d(TAG, "onCreate()");
36 }
37
38 @Override
39 public void onStart() {
40 super.onStart();
41
42 Intent i = getIntent();
43 String instrumentationPackage = i.getStringExtra(EXTRA_INSTRUMENTATION_P ACKAGE);
44 String instrumentationClass = i.getStringExtra(EXTRA_INSTRUMENTATION_CLA SS);
45 Bundle targetArgs = i.getBundleExtra(EXTRA_TARGET_ARGS);
46 String test = i.getStringExtra(EXTRA_TEST);
47
48 if (instrumentationPackage == null || instrumentationClass == null) {
49 finish();
50 return;
51 }
52
53 ComponentName instrumentationComponent =
54 new ComponentName(instrumentationPackage, instrumentationClass);
55
56 if (test != null) {
57 targetArgs.putString("class", test);
58 }
59
60 startInstrumentation(instrumentationComponent, null, targetArgs);
61 finish();
62 }
63 }
64
OLDNEW
« no previous file with comments | « testing/android/broker/BUILD.gn ('k') | testing/android/driver/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698