| Index: testing/android/java/src/org/chromium/test/outstrumentation/slave/OutstrumentationSlaveActivity.java
|
| diff --git a/testing/android/java/src/org/chromium/test/outstrumentation/slave/OutstrumentationSlaveActivity.java b/testing/android/java/src/org/chromium/test/outstrumentation/slave/OutstrumentationSlaveActivity.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e7e7014e8c5e4b378b735bd9d7c92d56f61be3a5
|
| --- /dev/null
|
| +++ b/testing/android/java/src/org/chromium/test/outstrumentation/slave/OutstrumentationSlaveActivity.java
|
| @@ -0,0 +1,63 @@
|
| +// 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.outstrumentation.slave;
|
| +
|
| +import android.app.Activity;
|
| +import android.content.ComponentName;
|
| +import android.content.Intent;
|
| +import android.os.Bundle;
|
| +import android.util.Log;
|
| +
|
| +/**
|
| + * An Activity target for Outstrumentation that starts the specified Instrumentation test.
|
| + */
|
| +public class OutstrumentationSlaveActivity extends Activity {
|
| +
|
| + public static final String EXTRA_INSTRUMENTATION_PACKAGE =
|
| + "org.chromium.test.outstrumentation.slave.OutstrumentationSlaveActivity."
|
| + + "InstrumentationPackage";
|
| + public static final String EXTRA_INSTRUMENTATION_CLASS =
|
| + "org.chromium.test.outstrumentation.slave.OutstrumentationSlaveActivity."
|
| + + "InstrumentationClass";
|
| + public static final String EXTRA_TARGET_ARGS =
|
| + "org.chromium.test.outstrumentation.slave.OutstrumentationSlaveActivity.TargetArgs";
|
| + public static final String EXTRA_TEST =
|
| + "org.chromium.test.outstrumentation.slave.OutstrumentationSlaveActivity.Test";
|
| +
|
| + private static final String TAG = "OutstrumentationSlaveActivity";
|
| +
|
| + @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();
|
| + }
|
| +}
|
| +
|
|
|