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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // 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. |
73 File filesDir = new File(Environment.getExternalStorageDirectory(), | 73 nativeRunTests(getFilesDir().getAbsolutePath(), getApplicationContext())
; |
74 "native_tests/"); | |
75 filesDir.mkdirs(); | |
76 nativeRunTests(filesDir.getAbsolutePath(), getApplicationContext()); | |
77 } | 74 } |
78 | 75 |
79 // Signal a failure of the native test loader to python scripts | 76 // Signal a failure of the native test loader to python scripts |
80 // which run tests. For example, we look for | 77 // which run tests. For example, we look for |
81 // RUNNER_FAILED build/android/test_package.py. | 78 // RUNNER_FAILED build/android/test_package.py. |
82 private void nativeTestFailed() { | 79 private void nativeTestFailed() { |
83 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); | 80 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); |
84 } | 81 } |
85 | 82 |
86 private void loadLibrary() throws UnsatisfiedLinkError { | 83 private void loadLibrary() throws UnsatisfiedLinkError { |
87 Log.i(TAG, "loading: " + mLibrary); | 84 Log.i(TAG, "loading: " + mLibrary); |
88 System.loadLibrary(mLibrary); | 85 System.loadLibrary(mLibrary); |
89 Log.i(TAG, "loaded: " + mLibrary); | 86 Log.i(TAG, "loaded: " + mLibrary); |
90 } | 87 } |
91 | 88 |
92 private native void nativeRunTests(String filesDir, Context appContext); | 89 private native void nativeRunTests(String filesDir, Context appContext); |
93 } | 90 } |
OLD | NEW |