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

Side by Side Diff: chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/LocationSettingsTestUtil.java

Issue 2105573002: Revert of Add a LocationUtils class to give all Chromium Android code access to location helpers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 4 years, 5 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 | « chrome/test/android/BUILD.gn ('k') | components/location/OWNERS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.chrome.test.util.browser; 5 package org.chromium.chrome.test.util.browser;
6 6
7 import android.content.Context;
8
9 import org.chromium.base.ThreadUtils; 7 import org.chromium.base.ThreadUtils;
10 import org.chromium.components.location.LocationUtils; 8 import org.chromium.chrome.browser.preferences.LocationSettings;
11 9
12 /** 10 /**
13 * Methods for testing location-related features. 11 * Methods for testing location-related features.
14 */ 12 */
15 public class LocationSettingsTestUtil { 13 public class LocationSettingsTestUtil {
16 14
17 /** 15 /**
18 * Mocks the system location setting as either enabled or disabled. Can be c alled on any thread. 16 * Mocks the system location setting as either enabled or disabled. Can be c alled on any thread.
19 */ 17 */
20 public static void setSystemLocationSettingEnabled(final boolean enabled) { 18 public static void setSystemLocationSettingEnabled(final boolean enabled) {
21 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 19 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
22 @Override 20 @Override
23 public void run() { 21 public void run() {
24 LocationUtils.setFactory(new LocationUtils.Factory() { 22 LocationSettings.setInstanceForTesting(new LocationSettings(null ) {
25 @Override 23 @Override
26 public LocationUtils create() { 24 public boolean isSystemLocationSettingEnabled() {
27 return new LocationUtils() { 25 return enabled;
28 @Override
29 public boolean isSystemLocationSettingEnabled(Contex t context) {
30 return enabled;
31 }
32 };
33 } 26 }
34 }); 27 });
35 } 28 }
36 }); 29 });
37 } 30 }
38 } 31 }
OLDNEW
« no previous file with comments | « chrome/test/android/BUILD.gn ('k') | components/location/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698