Chromium Code Reviews| OLD | NEW |
|---|---|
| (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.passenger; | |
| 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 OnDeviceInstrumentationPassenger that starts the speci fied | |
|
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
| |
| 15 * Instrumentation test. | |
| 16 */ | |
| 17 public class OnDeviceInstrumentationPassenger extends Activity { | |
| 18 | |
| 19 public static final String EXTRA_INSTRUMENTATION_PACKAGE = | |
| 20 "org.chromium.test.passenger.OnDeviceInstrumentationPassenger." | |
| 21 + "InstrumentationPackage"; | |
| 22 public static final String EXTRA_INSTRUMENTATION_CLASS = | |
| 23 "org.chromium.test.passenger.OnDeviceInstrumentationPassenger." | |
| 24 + "InstrumentationClass"; | |
| 25 public static final String EXTRA_TARGET_ARGS = | |
| 26 "org.chromium.test.passenger.OnDeviceInstrumentationPassenger.Target Args"; | |
| 27 public static final String EXTRA_TEST = | |
| 28 "org.chromium.test.passenger.OnDeviceInstrumentationPassenger.Test"; | |
| 29 | |
| 30 private static final String TAG = "OnDeviceInstrumentationPassenger"; | |
| 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 | |
| OLD | NEW |