summaryrefslogtreecommitdiffstats
path: root/testing/android
diff options
context:
space:
mode:
authorqinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 22:03:39 +0000
committerqinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 22:03:39 +0000
commit59f543f3ddff088442666fce77baf4e1ca0bdaa1 (patch)
tree6904d34fa5e5552ca75b89e5fdf473019e8125c3 /testing/android
parenta5e97e2b8623e66712abca17945f940c0f2c6591 (diff)
downloadchromium_src-59f543f3ddff088442666fce77baf4e1ca0bdaa1.zip
chromium_src-59f543f3ddff088442666fce77baf4e1ca0bdaa1.tar.gz
chromium_src-59f543f3ddff088442666fce77baf4e1ca0bdaa1.tar.bz2
Allow unit tests to run in a sub thread for chrome on android
Some of the tests, such as layout tests, need to run on a seperate thread. Adding an extra to the intent to achieve this. When invoking the test, users can use 'adb shell am start -e RunInSubThread -n testName' BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10696172 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146220 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing/android')
-rw-r--r--testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java b/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java
index ec978c4..3046eb7 100644
--- a/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java
+++ b/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java
@@ -15,6 +15,7 @@ import android.util.Log;
// the native activity class loader.
public class ChromeNativeTestActivity extends Activity {
private final String TAG = "ChromeNativeTestActivity";
+ private final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread";
// We post a delayed task to run tests so that we do not block onCreate().
private static long RUN_TESTS_DELAY_IN_MS = 300;
@@ -33,14 +34,25 @@ public class ChromeNativeTestActivity extends Activity {
try {
loadLibrary();
- // Post a task to run the tests. This allows us to not block onCreate and
- // still run tests on the main thread.
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- runTests();
- }
- }, RUN_TESTS_DELAY_IN_MS);
+ Bundle extras = this.getIntent().getExtras();
+ if (extras != null && extras.containsKey(EXTRA_RUN_IN_SUB_THREAD)) {
+ // Create a new thread and run tests on it.
+ new Thread() {
+ @Override
+ public void run() {
+ runTests();
+ }
+ }.start();
+ } else {
+ // Post a task to run the tests. This allows us to not block
+ // onCreate and still run tests on the main thread.
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ runTests();
+ }
+ }, RUN_TESTS_DELAY_IN_MS);
+ }
} catch (UnsatisfiedLinkError e) {
Log.e(TAG, "Unable to load lib" + mLibrary + ".so: " + e);
nativeTestFailed();