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

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

Issue 628263004: [Android] Simplify logic for grabbing initial country-code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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.CommandLine;
13 import org.chromium.base.PathUtils; 14 import org.chromium.base.PathUtils;
14 import org.chromium.base.PowerMonitor; 15 import org.chromium.base.PowerMonitor;
15 import org.chromium.base.ResourceExtractor; 16 import org.chromium.base.ResourceExtractor;
16 import org.chromium.base.library_loader.NativeLibraries; 17 import org.chromium.base.library_loader.NativeLibraries;
17 18
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 */ 23 */
23 public class ChromeNativeTestActivity extends Activity { 24 public class ChromeNativeTestActivity extends Activity {
24 private static final String TAG = "ChromeNativeTestActivity"; 25 private static final String TAG = "ChromeNativeTestActivity";
25 private static final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread"; 26 private static final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread";
26 // We post a delayed task to run tests so that we do not block onCreate(). 27 // We post a delayed task to run tests so that we do not block onCreate().
27 private static final long RUN_TESTS_DELAY_IN_MS = 300; 28 private static final long RUN_TESTS_DELAY_IN_MS = 300;
28 29
29 @Override 30 @Override
30 public void onCreate(Bundle savedInstanceState) { 31 public void onCreate(Bundle savedInstanceState) {
31 super.onCreate(savedInstanceState); 32 super.onCreate(savedInstanceState);
33 CommandLine.init(new String[]{});
34
32 // Needed by path_utils_unittest.cc 35 // Needed by path_utils_unittest.cc
33 PathUtils.setPrivateDataDirectorySuffix("chrome"); 36 PathUtils.setPrivateDataDirectorySuffix("chrome");
34 37
35 ResourceExtractor resourceExtractor = ResourceExtractor.get(getApplicati onContext()); 38 ResourceExtractor resourceExtractor = ResourceExtractor.get(getApplicati onContext());
36 resourceExtractor.setExtractAllPaksForTesting(); 39 resourceExtractor.setExtractAllPaksForTesting();
37 resourceExtractor.startExtractingResources(); 40 resourceExtractor.startExtractingResources();
38 resourceExtractor.waitForCompletion(); 41 resourceExtractor.waitForCompletion();
39 42
40 // Needed by system_monitor_unittest.cc 43 // Needed by system_monitor_unittest.cc
41 PowerMonitor.createForTests(this); 44 PowerMonitor.createForTests(this);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 private void loadLibraries() { 80 private void loadLibraries() {
78 for (String library : NativeLibraries.LIBRARIES) { 81 for (String library : NativeLibraries.LIBRARIES) {
79 Log.i(TAG, "loading: " + library); 82 Log.i(TAG, "loading: " + library);
80 System.loadLibrary(library); 83 System.loadLibrary(library);
81 Log.i(TAG, "loaded: " + library); 84 Log.i(TAG, "loaded: " + library);
82 } 85 }
83 } 86 }
84 87
85 private native void nativeRunTests(String filesDir, Context appContext); 88 private native void nativeRunTests(String filesDir, Context appContext);
86 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698