| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.native_test; | 5 package org.chromium.native_test; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.os.Bundle; | 10 import android.os.Bundle; |
| 11 import android.os.Environment; | 11 import android.os.Environment; |
| 12 import android.os.Handler; | 12 import android.os.Handler; |
| 13 import android.os.Process; | 13 import android.os.Process; |
| 14 | 14 |
| 15 import org.chromium.base.CommandLine; | 15 import org.chromium.base.CommandLine; |
| 16 import org.chromium.base.Log; | 16 import org.chromium.base.Log; |
| 17 import org.chromium.base.annotations.JNINamespace; | 17 import org.chromium.base.annotations.JNINamespace; |
| 18 import org.chromium.base.multidex.ChromiumMultiDexInstaller; | |
| 19 import org.chromium.test.reporter.TestStatusReporter; | 18 import org.chromium.test.reporter.TestStatusReporter; |
| 20 | 19 |
| 21 import java.io.File; | 20 import java.io.File; |
| 22 import java.util.ArrayList; | 21 import java.util.ArrayList; |
| 23 import java.util.Iterator; | 22 import java.util.Iterator; |
| 24 | 23 |
| 25 /** | 24 /** |
| 26 * Android's NativeActivity is mostly useful for pure-native code. | 25 * Android's NativeActivity is mostly useful for pure-native code. |
| 27 * Our tests need to go up to our own java classes, which is not possible using | 26 * Our tests need to go up to our own java classes, which is not possible using |
| 28 * the native activity class loader. | 27 * the native activity class loader. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 | 43 |
| 45 private String mCommandLineFilePath; | 44 private String mCommandLineFilePath; |
| 46 private StringBuilder mCommandLineFlags = new StringBuilder(); | 45 private StringBuilder mCommandLineFlags = new StringBuilder(); |
| 47 private TestStatusReporter mReporter; | 46 private TestStatusReporter mReporter; |
| 48 private boolean mRunInSubThread = false; | 47 private boolean mRunInSubThread = false; |
| 49 private boolean mStdoutFifo = false; | 48 private boolean mStdoutFifo = false; |
| 50 private String mStdoutFilePath; | 49 private String mStdoutFilePath; |
| 51 | 50 |
| 52 @Override | 51 @Override |
| 53 public void onCreate(Bundle savedInstanceState) { | 52 public void onCreate(Bundle savedInstanceState) { |
| 54 ChromiumMultiDexInstaller.install(this); | |
| 55 super.onCreate(savedInstanceState); | 53 super.onCreate(savedInstanceState); |
| 56 | |
| 57 CommandLine.init(new String[]{}); | 54 CommandLine.init(new String[]{}); |
| 58 | 55 |
| 59 parseArgumentsFromIntent(getIntent()); | 56 parseArgumentsFromIntent(getIntent()); |
| 60 mReporter = new TestStatusReporter(this); | 57 mReporter = new TestStatusReporter(this); |
| 61 } | 58 } |
| 62 | 59 |
| 63 private void parseArgumentsFromIntent(Intent intent) { | 60 private void parseArgumentsFromIntent(Intent intent) { |
| 64 Log.i(TAG, "Extras:"); | 61 Log.i(TAG, "Extras:"); |
| 65 Bundle extras = intent.getExtras(); | 62 Bundle extras = intent.getExtras(); |
| 66 if (extras != null) { | 63 if (extras != null) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Signal a failure of the native test loader to python scripts | 142 // Signal a failure of the native test loader to python scripts |
| 146 // which run tests. For example, we look for | 143 // which run tests. For example, we look for |
| 147 // RUNNER_FAILED build/android/test_package.py. | 144 // RUNNER_FAILED build/android/test_package.py. |
| 148 private void nativeTestFailed() { | 145 private void nativeTestFailed() { |
| 149 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); | 146 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); |
| 150 } | 147 } |
| 151 | 148 |
| 152 private native void nativeRunTests(String commandLineFlags, String commandLi
neFilePath, | 149 private native void nativeRunTests(String commandLineFlags, String commandLi
neFilePath, |
| 153 String stdoutFilePath, boolean stdoutFifo, Context appContext); | 150 String stdoutFilePath, boolean stdoutFifo, Context appContext); |
| 154 } | 151 } |
| OLD | NEW |