| 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.base.multidex.ChromiumMultiDexInstaller; |
| 19 import org.chromium.base.test.util.UrlUtils; |
| 19 import org.chromium.test.reporter.TestStatusReporter; | 20 import org.chromium.test.reporter.TestStatusReporter; |
| 20 | 21 |
| 21 import java.io.File; | 22 import java.io.File; |
| 22 import java.util.ArrayList; | 23 import java.util.ArrayList; |
| 23 import java.util.Iterator; | 24 import java.util.Iterator; |
| 24 | 25 |
| 25 /** | 26 /** |
| 26 * Helper to run tests inside Activity or NativeActivity. | 27 * Helper to run tests inside Activity or NativeActivity. |
| 27 */ | 28 */ |
| 28 @JNINamespace("testing::android") | 29 @JNINamespace("testing::android") |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 @Override | 148 @Override |
| 148 public void run() { | 149 public void run() { |
| 149 runTests(activity); | 150 runTests(activity); |
| 150 } | 151 } |
| 151 }); | 152 }); |
| 152 } | 153 } |
| 153 } | 154 } |
| 154 | 155 |
| 155 private void runTests(Activity activity) { | 156 private void runTests(Activity activity) { |
| 156 nativeRunTests(mCommandLineFlags.toString(), mCommandLineFilePath, mStdo
utFilePath, | 157 nativeRunTests(mCommandLineFlags.toString(), mCommandLineFilePath, mStdo
utFilePath, |
| 157 mStdoutFifo, activity.getApplicationContext()); | 158 mStdoutFifo, activity.getApplicationContext(), UrlUtils.getIsola
tedTestRoot()); |
| 158 activity.finish(); | 159 activity.finish(); |
| 159 mReporter.testRunFinished(Process.myPid()); | 160 mReporter.testRunFinished(Process.myPid()); |
| 160 } | 161 } |
| 161 | 162 |
| 162 // Signal a failure of the native test loader to python scripts | 163 // Signal a failure of the native test loader to python scripts |
| 163 // which run tests. For example, we look for | 164 // which run tests. For example, we look for |
| 164 // RUNNER_FAILED build/android/test_package.py. | 165 // RUNNER_FAILED build/android/test_package.py. |
| 165 private void nativeTestFailed() { | 166 private void nativeTestFailed() { |
| 166 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); | 167 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); |
| 167 } | 168 } |
| 168 | 169 |
| 169 private native void nativeRunTests(String commandLineFlags, String commandLi
neFilePath, | 170 private native void nativeRunTests(String commandLineFlags, String commandLi
neFilePath, |
| 170 String stdoutFilePath, boolean stdoutFifo, Context appContext); | 171 String stdoutFilePath, boolean stdoutFifo, Context appContext, Strin
g testDataDir); |
| 171 } | 172 } |
| OLD | NEW |