| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.Handler; | 10 import android.os.Handler; |
| 11 import android.util.Log; | 11 import android.util.Log; |
| 12 | 12 |
| 13 import org.chromium.base.PathUtils; | 13 import org.chromium.base.PathUtils; |
| 14 import org.chromium.base.PowerMonitor; | 14 import org.chromium.base.PowerMonitor; |
| 15 // TODO(cjhopman): This should not refer to content. NativeLibraries should be m
oved to base. | 15 import org.chromium.base.library_loader.NativeLibraries; |
| 16 import org.chromium.content.app.NativeLibraries; | |
| 17 | 16 |
| 18 // Android's NativeActivity is mostly useful for pure-native code. | 17 /** |
| 19 // Our tests need to go up to our own java classes, which is not possible using | 18 * Android's NativeActivity is mostly useful for pure-native code. |
| 20 // the native activity class loader. | 19 * Our tests need to go up to our own java classes, which is not possible using |
| 20 * the native activity class loader. |
| 21 */ |
| 21 public class ChromeNativeTestActivity extends Activity { | 22 public class ChromeNativeTestActivity extends Activity { |
| 22 private static final String TAG = "ChromeNativeTestActivity"; | 23 private static final String TAG = "ChromeNativeTestActivity"; |
| 23 private static final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread"; | 24 private static final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread"; |
| 24 // We post a delayed task to run tests so that we do not block onCreate(). | 25 // We post a delayed task to run tests so that we do not block onCreate(). |
| 25 private static final long RUN_TESTS_DELAY_IN_MS = 300; | 26 private static final long RUN_TESTS_DELAY_IN_MS = 300; |
| 26 | 27 |
| 27 @Override | 28 @Override |
| 28 public void onCreate(Bundle savedInstanceState) { | 29 public void onCreate(Bundle savedInstanceState) { |
| 29 super.onCreate(savedInstanceState); | 30 super.onCreate(savedInstanceState); |
| 30 // Needed by path_utils_unittest.cc | 31 // Needed by path_utils_unittest.cc |
| (...skipping 30 matching lines...) Expand all Loading... |
| 61 } | 62 } |
| 62 | 63 |
| 63 // Signal a failure of the native test loader to python scripts | 64 // Signal a failure of the native test loader to python scripts |
| 64 // which run tests. For example, we look for | 65 // which run tests. For example, we look for |
| 65 // RUNNER_FAILED build/android/test_package.py. | 66 // RUNNER_FAILED build/android/test_package.py. |
| 66 private void nativeTestFailed() { | 67 private void nativeTestFailed() { |
| 67 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); | 68 Log.e(TAG, "[ RUNNER_FAILED ] could not load native library"); |
| 68 } | 69 } |
| 69 | 70 |
| 70 private void loadLibraries() { | 71 private void loadLibraries() { |
| 71 for (String library: NativeLibraries.LIBRARIES) { | 72 for (String library : NativeLibraries.LIBRARIES) { |
| 72 Log.i(TAG, "loading: " + library); | 73 Log.i(TAG, "loading: " + library); |
| 73 System.loadLibrary(library); | 74 System.loadLibrary(library); |
| 74 Log.i(TAG, "loaded: " + library); | 75 Log.i(TAG, "loaded: " + library); |
| 75 } | 76 } |
| 76 } | 77 } |
| 77 | 78 |
| 78 private native void nativeRunTests(String filesDir, Context appContext); | 79 private native void nativeRunTests(String filesDir, Context appContext); |
| 79 } | 80 } |
| OLD | NEW |