| Index: testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java
|
| diff --git a/testing/android/native_test/java/src/org/chromium/native_test/ChromeNativeTestInstrumentationTestRunner.java b/testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java
|
| similarity index 78%
|
| rename from testing/android/native_test/java/src/org/chromium/native_test/ChromeNativeTestInstrumentationTestRunner.java
|
| rename to testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java
|
| index 25b65700b82538d534919b0a9fbc8d003b928b74..c5a4443e1a4c1c6122638dc793aab6691397f92d 100644
|
| --- a/testing/android/native_test/java/src/org/chromium/native_test/ChromeNativeTestInstrumentationTestRunner.java
|
| +++ b/testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java
|
| @@ -10,8 +10,8 @@ import android.content.ComponentName;
|
| import android.content.Intent;
|
| import android.os.Bundle;
|
| import android.os.Environment;
|
| -import android.util.Log;
|
|
|
| +import org.chromium.base.Log;
|
| import org.chromium.test.support.ResultsBundleGenerator;
|
| import org.chromium.test.support.RobotiumBundleGenerator;
|
|
|
| @@ -28,15 +28,15 @@ import java.util.regex.Matcher;
|
| import java.util.regex.Pattern;
|
|
|
| /**
|
| - * An Instrumentation that runs tests based on ChromeNativeTestActivity.
|
| + * An Instrumentation that runs tests based on NativeTestActivity.
|
| */
|
| -public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation {
|
| +public class NativeTestInstrumentationTestRunner extends Instrumentation {
|
| // TODO(jbudorick): Remove this extra when b/18981674 is fixed.
|
| public static final String EXTRA_ONLY_OUTPUT_FAILURES =
|
| - "org.chromium.native_test.ChromeNativeTestInstrumentationTestRunner."
|
| + "org.chromium.native_test.NativeTestInstrumentationTestRunner."
|
| + "OnlyOutputFailures";
|
|
|
| - private static final String TAG = "ChromeNativeTestInstrumentationTestRunner";
|
| + private static final String TAG = Log.makeTag("native_test");
|
|
|
| private static final int ACCEPT_TIMEOUT_MS = 5000;
|
| private static final Pattern RE_TEST_OUTPUT = Pattern.compile("\\[ *([^ ]*) *\\] ?([^ ]+) .*");
|
| @@ -50,14 +50,14 @@ public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation {
|
|
|
| @Override
|
| public void onCreate(Bundle arguments) {
|
| - mCommandLineFile = arguments.getString(ChromeNativeTestActivity.EXTRA_COMMAND_LINE_FILE);
|
| - mCommandLineFlags = arguments.getString(ChromeNativeTestActivity.EXTRA_COMMAND_LINE_FLAGS);
|
| + mCommandLineFile = arguments.getString(NativeTestActivity.EXTRA_COMMAND_LINE_FILE);
|
| + mCommandLineFlags = arguments.getString(NativeTestActivity.EXTRA_COMMAND_LINE_FLAGS);
|
| try {
|
| mStdoutFile = File.createTempFile(
|
| ".temp_stdout_", ".txt", Environment.getExternalStorageDirectory());
|
| - Log.i(TAG, "stdout file created: " + mStdoutFile.getAbsolutePath());
|
| + Log.i(TAG, "stdout file created: %s", mStdoutFile.getAbsolutePath());
|
| } catch (IOException e) {
|
| - Log.e(TAG, "Unable to create temporary stdout file." + e.toString());
|
| + Log.e(TAG, "Unable to create temporary stdout file.", e);
|
| finish(Activity.RESULT_CANCELED, new Bundle());
|
| return;
|
| }
|
| @@ -74,7 +74,7 @@ public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation {
|
| finish(Activity.RESULT_OK, results);
|
| }
|
|
|
| - /** Runs the tests in the ChromeNativeTestActivity and returns a Bundle containing the results.
|
| + /** Runs the tests in the NativeTestActivity and returns a Bundle containing the results.
|
| */
|
| private Bundle runTests() {
|
| Log.i(TAG, "Creating activity.");
|
| @@ -86,7 +86,7 @@ public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation {
|
| Thread.sleep(100);
|
| }
|
| } catch (InterruptedException e) {
|
| - Log.e(TAG, "Interrupted while waiting for activity to be destroyed: " + e.toString());
|
| + Log.e(TAG, "Interrupted while waiting for activity to be destroyed: ", e);
|
| }
|
|
|
| Log.i(TAG, "Getting results.");
|
| @@ -96,23 +96,23 @@ public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation {
|
| return mBundleGenerator.generate(results);
|
| }
|
|
|
| - /** Starts the ChromeNativeTestActivty.
|
| + /** Starts the NativeTestActivty.
|
| */
|
| private Activity startNativeTestActivity() {
|
| Intent i = new Intent(Intent.ACTION_MAIN);
|
| i.setComponent(new ComponentName(
|
| "org.chromium.native_test",
|
| - "org.chromium.native_test.ChromeNativeTestActivity"));
|
| + "org.chromium.native_test.NativeTestActivity"));
|
| i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
| if (mCommandLineFile != null) {
|
| - Log.i(TAG, "Passing command line file extra: " + mCommandLineFile);
|
| - i.putExtra(ChromeNativeTestActivity.EXTRA_COMMAND_LINE_FILE, mCommandLineFile);
|
| + Log.i(TAG, "Passing command line file extra: %s", mCommandLineFile);
|
| + i.putExtra(NativeTestActivity.EXTRA_COMMAND_LINE_FILE, mCommandLineFile);
|
| }
|
| if (mCommandLineFlags != null) {
|
| - Log.i(TAG, "Passing command line flag extra: " + mCommandLineFlags);
|
| - i.putExtra(ChromeNativeTestActivity.EXTRA_COMMAND_LINE_FLAGS, mCommandLineFlags);
|
| + Log.i(TAG, "Passing command line flag extra: %s", mCommandLineFlags);
|
| + i.putExtra(NativeTestActivity.EXTRA_COMMAND_LINE_FLAGS, mCommandLineFlags);
|
| }
|
| - i.putExtra(ChromeNativeTestActivity.EXTRA_STDOUT_FILE, mStdoutFile.getAbsolutePath());
|
| + i.putExtra(NativeTestActivity.EXTRA_STDOUT_FILE, mStdoutFile.getAbsolutePath());
|
| return startActivitySync(i);
|
| }
|
|
|
| @@ -162,20 +162,20 @@ public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation {
|
| Log.i(TAG, l);
|
| }
|
| } catch (FileNotFoundException e) {
|
| - Log.e(TAG, "Couldn't find stdout file file: " + e.toString());
|
| + Log.e(TAG, "Couldn't find stdout file file: ", e);
|
| } catch (IOException e) {
|
| - Log.e(TAG, "Error handling stdout file: " + e.toString());
|
| + Log.e(TAG, "Error handling stdout file: ", e);
|
| } finally {
|
| if (r != null) {
|
| try {
|
| r.close();
|
| } catch (IOException e) {
|
| - Log.e(TAG, "Error while closing stdout reader.");
|
| + Log.e(TAG, "Error while closing stdout reader.", e);
|
| }
|
| }
|
| if (mStdoutFile != null) {
|
| if (!mStdoutFile.delete()) {
|
| - Log.e(TAG, "Unable to delete " + mStdoutFile.getAbsolutePath());
|
| + Log.e(TAG, "Unable to delete %s", mStdoutFile.getAbsolutePath());
|
| }
|
| }
|
| }
|
|
|