| Index: testing/android/native_test/java/src/org/chromium/native_test/NativeTestActivity.java
 | 
| diff --git a/testing/android/native_test/java/src/org/chromium/native_test/NativeTestActivity.java b/testing/android/native_test/java/src/org/chromium/native_test/NativeTestActivity.java
 | 
| index e8c4055722fb6f6fd4b9134ff38765ccd94c1d61..46a490b3c68da041290c5836f9aa1d1c1c902fb5 100644
 | 
| --- a/testing/android/native_test/java/src/org/chromium/native_test/NativeTestActivity.java
 | 
| +++ b/testing/android/native_test/java/src/org/chromium/native_test/NativeTestActivity.java
 | 
| @@ -6,16 +6,14 @@ package org.chromium.native_test;
 | 
|  
 | 
|  import android.app.Activity;
 | 
|  import android.content.Context;
 | 
| +import android.content.Intent;
 | 
|  import android.os.Bundle;
 | 
|  import android.os.Environment;
 | 
|  import android.os.Handler;
 | 
|  
 | 
|  import org.chromium.base.CommandLine;
 | 
| +import org.chromium.base.JNINamespace;
 | 
|  import org.chromium.base.Log;
 | 
| -import org.chromium.base.PathUtils;
 | 
| -import org.chromium.base.PowerMonitor;
 | 
| -import org.chromium.base.ResourceExtractor;
 | 
| -import org.chromium.base.library_loader.NativeLibraries;
 | 
|  
 | 
|  import java.io.File;
 | 
|  
 | 
| @@ -24,6 +22,7 @@ import java.io.File;
 | 
|   *  Our tests need to go up to our own java classes, which is not possible using
 | 
|   *  the native activity class loader.
 | 
|   */
 | 
| +@JNINamespace("testing::android")
 | 
|  public class NativeTestActivity extends Activity {
 | 
|      public static final String EXTRA_COMMAND_LINE_FILE =
 | 
|              "org.chromium.native_test.NativeTestActivity.CommandLineFile";
 | 
| @@ -37,25 +36,54 @@ public class NativeTestActivity extends Activity {
 | 
|      // We post a delayed task to run tests so that we do not block onCreate().
 | 
|      private static final long RUN_TESTS_DELAY_IN_MS = 300;
 | 
|  
 | 
| +    private String mCommandLineFilePath;
 | 
| +    private StringBuilder mCommandLineFlags = new StringBuilder();
 | 
| +    private boolean mRunInSubThread = false;
 | 
| +    private boolean mStdoutFifo = false;
 | 
| +    private String mStdoutFilePath;
 | 
| +
 | 
|      @Override
 | 
|      public void onCreate(Bundle savedInstanceState) {
 | 
|          super.onCreate(savedInstanceState);
 | 
|          CommandLine.init(new String[]{});
 | 
|  
 | 
| -        // Needed by path_utils_unittest.cc
 | 
| -        PathUtils.setPrivateDataDirectorySuffix("chrome", getApplicationContext());
 | 
| +        parseArgumentsFromIntent(getIntent());
 | 
| +    }
 | 
| +
 | 
| +    private void parseArgumentsFromIntent(Intent intent) {
 | 
| +        mCommandLineFilePath = intent.getStringExtra(EXTRA_COMMAND_LINE_FILE);
 | 
| +        if (mCommandLineFilePath == null) {
 | 
| +            mCommandLineFilePath = "";
 | 
| +        } else {
 | 
| +            File commandLineFile = new File(mCommandLineFilePath);
 | 
| +            if (!commandLineFile.isAbsolute()) {
 | 
| +                mCommandLineFilePath = Environment.getExternalStorageDirectory() + "/"
 | 
| +                        + mCommandLineFilePath;
 | 
| +            }
 | 
| +            Log.i(TAG, "command line file path: %s", mCommandLineFilePath);
 | 
| +        }
 | 
|  
 | 
| -        ResourceExtractor resourceExtractor = ResourceExtractor.get(getApplicationContext());
 | 
| -        resourceExtractor.setExtractAllPaksAndV8SnapshotForTesting();
 | 
| -        resourceExtractor.startExtractingResources();
 | 
| -        resourceExtractor.waitForCompletion();
 | 
| +        String commandLineFlags = intent.getStringExtra(EXTRA_COMMAND_LINE_FLAGS);
 | 
| +        if (commandLineFlags != null) mCommandLineFlags.append(commandLineFlags);
 | 
|  
 | 
| -        // Needed by system_monitor_unittest.cc
 | 
| -        PowerMonitor.createForTests(this);
 | 
| +        mRunInSubThread = intent.hasExtra(EXTRA_RUN_IN_SUB_THREAD);
 | 
|  
 | 
| -        loadLibraries();
 | 
| -        Bundle extras = this.getIntent().getExtras();
 | 
| -        if (extras != null && extras.containsKey(EXTRA_RUN_IN_SUB_THREAD)) {
 | 
| +        mStdoutFilePath = intent.getStringExtra(EXTRA_STDOUT_FILE);
 | 
| +        if (mStdoutFilePath == null) {
 | 
| +            mStdoutFilePath = new File(getFilesDir(), "test.fifo").getAbsolutePath();
 | 
| +            mStdoutFifo = true;
 | 
| +        }
 | 
| +    }
 | 
| +
 | 
| +    protected void appendCommandLineFlags(String flags) {
 | 
| +        mCommandLineFlags.append(" ").append(flags);
 | 
| +    }
 | 
| +
 | 
| +    @Override
 | 
| +    public void onStart() {
 | 
| +        super.onStart();
 | 
| +
 | 
| +        if (mRunInSubThread) {
 | 
|              // Create a new thread and run tests on it.
 | 
|              new Thread() {
 | 
|                  @Override
 | 
| @@ -76,31 +104,8 @@ public class NativeTestActivity extends Activity {
 | 
|      }
 | 
|  
 | 
|      private void runTests() {
 | 
| -        String commandLineFlags = getIntent().getStringExtra(EXTRA_COMMAND_LINE_FLAGS);
 | 
| -        if (commandLineFlags == null) commandLineFlags = "";
 | 
| -
 | 
| -        String commandLineFilePath = getIntent().getStringExtra(EXTRA_COMMAND_LINE_FILE);
 | 
| -        if (commandLineFilePath == null) {
 | 
| -            commandLineFilePath = "";
 | 
| -        } else {
 | 
| -            File commandLineFile = new File(commandLineFilePath);
 | 
| -            if (!commandLineFile.isAbsolute()) {
 | 
| -                commandLineFilePath = Environment.getExternalStorageDirectory() + "/"
 | 
| -                        + commandLineFilePath;
 | 
| -            }
 | 
| -            Log.i(TAG, "command line file path: %s", commandLineFilePath);
 | 
| -        }
 | 
| -
 | 
| -        String stdoutFilePath = getIntent().getStringExtra(EXTRA_STDOUT_FILE);
 | 
| -        boolean stdoutFifo = false;
 | 
| -        if (stdoutFilePath == null) {
 | 
| -            stdoutFilePath = new File(getFilesDir(), "test.fifo").getAbsolutePath();
 | 
| -            stdoutFifo = true;
 | 
| -        }
 | 
| -
 | 
| -        // This directory is used by build/android/pylib/test_package_apk.py.
 | 
| -        nativeRunTests(commandLineFlags, commandLineFilePath, stdoutFilePath, stdoutFifo,
 | 
| -                getApplicationContext());
 | 
| +        nativeRunTests(mCommandLineFlags.toString(), mCommandLineFilePath, mStdoutFilePath,
 | 
| +                mStdoutFifo, getApplicationContext());
 | 
|          finish();
 | 
|      }
 | 
|  
 | 
| @@ -111,14 +116,6 @@ public class NativeTestActivity extends Activity {
 | 
|          Log.e(TAG, "[ RUNNER_FAILED ] could not load native library");
 | 
|      }
 | 
|  
 | 
| -    private void loadLibraries() {
 | 
| -        for (String library : NativeLibraries.LIBRARIES) {
 | 
| -            Log.i(TAG, "loading: %s", library);
 | 
| -            System.loadLibrary(library);
 | 
| -            Log.i(TAG, "loaded: %s", library);
 | 
| -        }
 | 
| -    }
 | 
| -
 | 
|      private native void nativeRunTests(String commandLineFlags, String commandLineFilePath,
 | 
|              String stdoutFilePath, boolean stdoutFifo, Context appContext);
 | 
|  }
 | 
| 
 |