diff options
author | michaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-15 21:43:18 +0000 |
---|---|---|
committer | michaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-15 21:43:18 +0000 |
commit | 86ebc8f3731a84fea14e8688da4eb55aba87008a (patch) | |
tree | 2639dccb20377423690fa69468c1df9a0e6de31d /testing/android | |
parent | f5411e2e50d20ad0c54336fd552a86f36f2b9e63 (diff) | |
download | chromium_src-86ebc8f3731a84fea14e8688da4eb55aba87008a.zip chromium_src-86ebc8f3731a84fea14e8688da4eb55aba87008a.tar.gz chromium_src-86ebc8f3731a84fea14e8688da4eb55aba87008a.tar.bz2 |
Throw exception when initialization failed.
Previously the initialization return code was ignored, it will lead us
crash later. We need a way to exit and maybe show error message if something
wrong during initialization.
Using exception might better than returning the result code since the
initialization code could be called from constructor and initialization
error is an exception at most of time.
In activity, the exception is caught, then call finish() to exit.
In tests, the exception is wrapped with Error and threw out.
BUG=b/7705055
Review URL: https://chromiumcodereview.appspot.com/11567061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176975 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing/android')
-rw-r--r-- | testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java | 47 |
1 files changed, 21 insertions, 26 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 490ed14..21b0f85 100644 --- a/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java +++ b/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java @@ -45,31 +45,26 @@ public class ChromeNativeTestActivity extends ChromiumActivity { // Needed by system_monitor_unittest.cc SystemMonitor.createForTests(this); - try { - loadLibrary(); - 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(); - throw e; + + loadLibrary(); + 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); } } @@ -85,7 +80,7 @@ public class ChromeNativeTestActivity extends ChromiumActivity { Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); } - private void loadLibrary() throws UnsatisfiedLinkError { + private void loadLibrary() { Log.i(TAG, "loading: " + mLibrary); System.loadLibrary(mLibrary); Log.i(TAG, "loaded: " + mLibrary); |