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; |
11 import android.os.Handler; | 11 import android.os.Handler; |
12 import android.util.Log; | 12 import android.util.Log; |
13 | 13 |
| 14 import org.chromium.base.ChromiumActivity; |
14 import org.chromium.base.PathUtils; | 15 import org.chromium.base.PathUtils; |
15 import org.chromium.base.SystemMonitor; | 16 import org.chromium.base.SystemMonitor; |
16 | 17 |
17 import java.io.File; | 18 import java.io.File; |
18 | 19 |
19 // Android's NativeActivity is mostly useful for pure-native code. | 20 // Android's NativeActivity is mostly useful for pure-native code. |
20 // Our tests need to go up to our own java classes, which is not possible using | 21 // Our tests need to go up to our own java classes, which is not possible using |
21 // the native activity class loader. | 22 // the native activity class loader. |
22 public class ChromeNativeTestActivity extends Activity { | 23 public class ChromeNativeTestActivity extends ChromiumActivity { |
23 private final String TAG = "ChromeNativeTestActivity"; | 24 private final String TAG = "ChromeNativeTestActivity"; |
24 private final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread"; | 25 private final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread"; |
25 // We post a delayed task to run tests so that we do not block onCreate(). | 26 // We post a delayed task to run tests so that we do not block onCreate(). |
26 private static long RUN_TESTS_DELAY_IN_MS = 300; | 27 private static long RUN_TESTS_DELAY_IN_MS = 300; |
27 | 28 |
28 // Name of our shlib as obtained from a string resource. | 29 // Name of our shlib as obtained from a string resource. |
29 private String mLibrary; | 30 private String mLibrary; |
30 | 31 |
31 @Override | 32 @Override |
32 public void onCreate(Bundle savedInstanceState) { | 33 public void onCreate(Bundle savedInstanceState) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 86 } |
86 | 87 |
87 private void loadLibrary() throws UnsatisfiedLinkError { | 88 private void loadLibrary() throws UnsatisfiedLinkError { |
88 Log.i(TAG, "loading: " + mLibrary); | 89 Log.i(TAG, "loading: " + mLibrary); |
89 System.loadLibrary(mLibrary); | 90 System.loadLibrary(mLibrary); |
90 Log.i(TAG, "loaded: " + mLibrary); | 91 Log.i(TAG, "loaded: " + mLibrary); |
91 } | 92 } |
92 | 93 |
93 private native void nativeRunTests(String filesDir, Context appContext); | 94 private native void nativeRunTests(String filesDir, Context appContext); |
94 } | 95 } |
OLD | NEW |