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; | |
11 import android.os.Handler; | 10 import android.os.Handler; |
12 import android.util.Log; | 11 import android.util.Log; |
13 | 12 |
14 import org.chromium.base.ChromiumActivity; | |
15 import org.chromium.base.PathUtils; | 13 import org.chromium.base.PathUtils; |
16 import org.chromium.base.PowerMonitor; | 14 import org.chromium.base.PowerMonitor; |
17 | |
18 // TODO(cjhopman): This should not refer to content. NativeLibraries should be m
oved to base. | 15 // TODO(cjhopman): This should not refer to content. NativeLibraries should be m
oved to base. |
19 import org.chromium.content.app.NativeLibraries; | 16 import org.chromium.content.app.NativeLibraries; |
20 | 17 |
21 import java.io.File; | |
22 | |
23 // Android's NativeActivity is mostly useful for pure-native code. | 18 // Android's NativeActivity is mostly useful for pure-native code. |
24 // Our tests need to go up to our own java classes, which is not possible using | 19 // Our tests need to go up to our own java classes, which is not possible using |
25 // the native activity class loader. | 20 // the native activity class loader. |
26 public class ChromeNativeTestActivity extends ChromiumActivity { | 21 public class ChromeNativeTestActivity extends Activity { |
27 private static final String TAG = "ChromeNativeTestActivity"; | 22 private static final String TAG = "ChromeNativeTestActivity"; |
28 private static final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread"; | 23 private static final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread"; |
29 // We post a delayed task to run tests so that we do not block onCreate(). | 24 // We post a delayed task to run tests so that we do not block onCreate(). |
30 private static final long RUN_TESTS_DELAY_IN_MS = 300; | 25 private static final long RUN_TESTS_DELAY_IN_MS = 300; |
31 | 26 |
32 @Override | 27 @Override |
33 public void onCreate(Bundle savedInstanceState) { | 28 public void onCreate(Bundle savedInstanceState) { |
34 super.onCreate(savedInstanceState); | 29 super.onCreate(savedInstanceState); |
35 // Needed by path_utils_unittest.cc | 30 // Needed by path_utils_unittest.cc |
36 PathUtils.setPrivateDataDirectorySuffix("chrome"); | 31 PathUtils.setPrivateDataDirectorySuffix("chrome"); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 private void loadLibraries() { | 70 private void loadLibraries() { |
76 for (String library: NativeLibraries.libraries) { | 71 for (String library: NativeLibraries.libraries) { |
77 Log.i(TAG, "loading: " + library); | 72 Log.i(TAG, "loading: " + library); |
78 System.loadLibrary(library); | 73 System.loadLibrary(library); |
79 Log.i(TAG, "loaded: " + library); | 74 Log.i(TAG, "loaded: " + library); |
80 } | 75 } |
81 } | 76 } |
82 | 77 |
83 private native void nativeRunTests(String filesDir, Context appContext); | 78 private native void nativeRunTests(String filesDir, Context appContext); |
84 } | 79 } |
OLD | NEW |