Index: testing/android/native_test/java/src/org/chromium/native_test/NativeUnitTestActivity.java |
diff --git a/testing/android/native_test/java/src/org/chromium/native_test/NativeUnitTestActivity.java b/testing/android/native_test/java/src/org/chromium/native_test/NativeUnitTestActivity.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ae6672755b038e9073ec9f70f8dcd47a571307bc |
--- /dev/null |
+++ b/testing/android/native_test/java/src/org/chromium/native_test/NativeUnitTestActivity.java |
@@ -0,0 +1,48 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.native_test; |
+ |
+import android.os.Bundle; |
+ |
+import org.chromium.base.Log; |
+import org.chromium.base.PathUtils; |
+import org.chromium.base.PowerMonitor; |
+import org.chromium.base.ResourceExtractor; |
+import org.chromium.base.library_loader.NativeLibraries; |
+ |
+/** |
+ * An {@link android.app.Activity} for running native unit tests. |
+ * (i.e., not browser tests) |
+ */ |
+public class NativeUnitTestActivity extends NativeTestActivity { |
+ |
+ private static final String TAG = Log.makeTag("native_test"); |
+ |
+ @Override |
+ public void onCreate(Bundle savedInstanceState) { |
+ super.onCreate(savedInstanceState); |
+ |
+ // Needed by path_utils_unittest.cc |
+ PathUtils.setPrivateDataDirectorySuffix("chrome", getApplicationContext()); |
+ |
+ ResourceExtractor resourceExtractor = ResourceExtractor.get(getApplicationContext()); |
+ resourceExtractor.setExtractAllPaksAndV8SnapshotForTesting(); |
+ resourceExtractor.startExtractingResources(); |
+ resourceExtractor.waitForCompletion(); |
+ |
+ // Needed by system_monitor_unittest.cc |
+ PowerMonitor.createForTests(this); |
+ |
+ loadLibraries(); |
+ } |
+ |
+ private void loadLibraries() { |
+ for (String library : NativeLibraries.LIBRARIES) { |
+ Log.i(TAG, "loading: %s", library); |
+ System.loadLibrary(library); |
+ Log.i(TAG, "loaded: %s", library); |
+ } |
+ } |
+} |