| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.os.Bundle; | 9 import android.os.Bundle; |
| 10 import android.os.Environment; | 10 import android.os.Environment; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }, RUN_TESTS_DELAY_IN_MS); | 62 }, RUN_TESTS_DELAY_IN_MS); |
| 63 } | 63 } |
| 64 } catch (UnsatisfiedLinkError e) { | 64 } catch (UnsatisfiedLinkError e) { |
| 65 Log.e(TAG, "Unable to load lib" + mLibrary + ".so: " + e); | 65 Log.e(TAG, "Unable to load lib" + mLibrary + ".so: " + e); |
| 66 nativeTestFailed(); | 66 nativeTestFailed(); |
| 67 throw e; | 67 throw e; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 private void runTests() { | 71 private void runTests() { |
| 72 Log.e(TAG, ">>nativeRunTests"); | |
| 73 // This directory is used by build/android/pylib/test_package_apk.py. | 72 // This directory is used by build/android/pylib/test_package_apk.py. |
| 74 File filesDir = new File(Environment.getExternalStorageDirectory(), | 73 File filesDir = new File(Environment.getExternalStorageDirectory(), |
| 75 "native_tests/"); | 74 "native_tests/"); |
| 76 filesDir.mkdirs(); | 75 filesDir.mkdirs(); |
| 77 nativeRunTests(filesDir.getAbsolutePath(), getApplicationContext()); | 76 nativeRunTests(filesDir.getAbsolutePath(), getApplicationContext()); |
| 78 Log.e(TAG, "<<nativeRunTests"); | |
| 79 } | 77 } |
| 80 | 78 |
| 81 // Signal a failure of the native test loader to python scripts | 79 // Signal a failure of the native test loader to python scripts |
| 82 // which run tests. For example, we look for | 80 // which run tests. For example, we look for |
| 83 // RUNNER_FAILED build/android/test_package.py. | 81 // RUNNER_FAILED build/android/test_package.py. |
| 84 private void nativeTestFailed() { | 82 private void nativeTestFailed() { |
| 85 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); | 83 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); |
| 86 } | 84 } |
| 87 | 85 |
| 88 private void loadLibrary() throws UnsatisfiedLinkError { | 86 private void loadLibrary() throws UnsatisfiedLinkError { |
| 89 Log.i(TAG, "loading: " + mLibrary); | 87 Log.i(TAG, "loading: " + mLibrary); |
| 90 System.loadLibrary(mLibrary); | 88 System.loadLibrary(mLibrary); |
| 91 Log.i(TAG, "loaded: " + mLibrary); | 89 Log.i(TAG, "loaded: " + mLibrary); |
| 92 } | 90 } |
| 93 | 91 |
| 94 private native void nativeRunTests(String filesDir, Context appContext); | 92 private native void nativeRunTests(String filesDir, Context appContext); |
| 95 } | 93 } |
| OLD | NEW |