| 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; |
| 18 import org.chromium.test.reporter.TestStatusReporter; | 19 import org.chromium.test.reporter.TestStatusReporter; |
| 19 | 20 |
| 20 import java.io.File; | 21 import java.io.File; |
| 21 import java.util.ArrayList; | 22 import java.util.ArrayList; |
| 22 import java.util.Iterator; | 23 import java.util.Iterator; |
| 23 | 24 |
| 24 /** | 25 /** |
| 25 * Android's NativeActivity is mostly useful for pure-native code. | 26 * Android's NativeActivity is mostly useful for pure-native code. |
| 26 * Our tests need to go up to our own java classes, which is not possible using | 27 * Our tests need to go up to our own java classes, which is not possible using |
| 27 * the native activity class loader. | 28 * the native activity class loader. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 private String mCommandLineFilePath; | 45 private String mCommandLineFilePath; |
| 45 private StringBuilder mCommandLineFlags = new StringBuilder(); | 46 private StringBuilder mCommandLineFlags = new StringBuilder(); |
| 46 private TestStatusReporter mReporter; | 47 private TestStatusReporter mReporter; |
| 47 private boolean mRunInSubThread = false; | 48 private boolean mRunInSubThread = false; |
| 48 private boolean mStdoutFifo = false; | 49 private boolean mStdoutFifo = false; |
| 49 private String mStdoutFilePath; | 50 private String mStdoutFilePath; |
| 50 | 51 |
| 51 @Override | 52 @Override |
| 52 public void onCreate(Bundle savedInstanceState) { | 53 public void onCreate(Bundle savedInstanceState) { |
| 54 ChromiumMultiDexInstaller.install(this); |
| 53 super.onCreate(savedInstanceState); | 55 super.onCreate(savedInstanceState); |
| 56 |
| 54 CommandLine.init(new String[]{}); | 57 CommandLine.init(new String[]{}); |
| 55 | 58 |
| 56 parseArgumentsFromIntent(getIntent()); | 59 parseArgumentsFromIntent(getIntent()); |
| 57 mReporter = new TestStatusReporter(this); | 60 mReporter = new TestStatusReporter(this); |
| 58 } | 61 } |
| 59 | 62 |
| 60 private void parseArgumentsFromIntent(Intent intent) { | 63 private void parseArgumentsFromIntent(Intent intent) { |
| 61 Log.i(TAG, "Extras:"); | 64 Log.i(TAG, "Extras:"); |
| 62 Bundle extras = intent.getExtras(); | 65 Bundle extras = intent.getExtras(); |
| 63 if (extras != null) { | 66 if (extras != null) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Signal a failure of the native test loader to python scripts | 145 // Signal a failure of the native test loader to python scripts |
| 143 // which run tests. For example, we look for | 146 // which run tests. For example, we look for |
| 144 // RUNNER_FAILED build/android/test_package.py. | 147 // RUNNER_FAILED build/android/test_package.py. |
| 145 private void nativeTestFailed() { | 148 private void nativeTestFailed() { |
| 146 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); | 149 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); |
| 147 } | 150 } |
| 148 | 151 |
| 149 private native void nativeRunTests(String commandLineFlags, String commandLi
neFilePath, | 152 private native void nativeRunTests(String commandLineFlags, String commandLi
neFilePath, |
| 150 String stdoutFilePath, boolean stdoutFifo, Context appContext); | 153 String stdoutFilePath, boolean stdoutFifo, Context appContext); |
| 151 } | 154 } |
| OLD | NEW |