Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java

Issue 456413002: Move the user agent styles sheets to blink_resources.grd (Part 2) with Unit test support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Generic logic to handle any paks packaged! Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/test/test_webkit_platform_support.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 import org.chromium.base.ResourceExtractor;
15 import org.chromium.base.library_loader.NativeLibraries; 16 import org.chromium.base.library_loader.NativeLibraries;
16 17
17 /** 18 /**
18 * Android's NativeActivity is mostly useful for pure-native code. 19 * Android's NativeActivity is mostly useful for pure-native code.
19 * Our tests need to go up to our own java classes, which is not possible using 20 * Our tests need to go up to our own java classes, which is not possible using
20 * the native activity class loader. 21 * the native activity class loader.
21 */ 22 */
22 public class ChromeNativeTestActivity extends Activity { 23 public class ChromeNativeTestActivity extends Activity {
23 private static final String TAG = "ChromeNativeTestActivity"; 24 private static final String TAG = "ChromeNativeTestActivity";
24 private static final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread"; 25 private static 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 final long RUN_TESTS_DELAY_IN_MS = 300; 27 private static final long RUN_TESTS_DELAY_IN_MS = 300;
27 28
28 @Override 29 @Override
29 public void onCreate(Bundle savedInstanceState) { 30 public void onCreate(Bundle savedInstanceState) {
30 super.onCreate(savedInstanceState); 31 super.onCreate(savedInstanceState);
32
31 // Needed by path_utils_unittest.cc 33 // Needed by path_utils_unittest.cc
32 PathUtils.setPrivateDataDirectorySuffix("chrome"); 34 PathUtils.setPrivateDataDirectorySuffix("chrome");
33 35
36 ResourceExtractor resourceExtractor = ResourceExtractor.get(getApplicati onContext());
37 resourceExtractor.collectAllPackagedPakAssets();
38 resourceExtractor.startExtractingResources();
39 resourceExtractor.waitForCompletion();
40
34 // Needed by system_monitor_unittest.cc 41 // Needed by system_monitor_unittest.cc
35 PowerMonitor.createForTests(this); 42 PowerMonitor.createForTests(this);
36 43
37 loadLibraries(); 44 loadLibraries();
38 Bundle extras = this.getIntent().getExtras(); 45 Bundle extras = this.getIntent().getExtras();
39 if (extras != null && extras.containsKey(EXTRA_RUN_IN_SUB_THREAD)) { 46 if (extras != null && extras.containsKey(EXTRA_RUN_IN_SUB_THREAD)) {
40 // Create a new thread and run tests on it. 47 // Create a new thread and run tests on it.
41 new Thread() { 48 new Thread() {
42 @Override 49 @Override
43 public void run() { 50 public void run() {
(...skipping 27 matching lines...) Expand all
71 private void loadLibraries() { 78 private void loadLibraries() {
72 for (String library : NativeLibraries.LIBRARIES) { 79 for (String library : NativeLibraries.LIBRARIES) {
73 Log.i(TAG, "loading: " + library); 80 Log.i(TAG, "loading: " + library);
74 System.loadLibrary(library); 81 System.loadLibrary(library);
75 Log.i(TAG, "loaded: " + library); 82 Log.i(TAG, "loaded: " + library);
76 } 83 }
77 } 84 }
78 85
79 private native void nativeRunTests(String filesDir, Context appContext); 86 private native void nativeRunTests(String filesDir, Context appContext);
80 } 87 }
OLDNEW
« no previous file with comments | « content/test/test_webkit_platform_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698