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

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

Issue 2038753004: 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: Use LOCATION_MODE instead of isProviderEnabled. Created 4 years, 6 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 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
7 import org.chromium.base.ThreadUtils; 9 import org.chromium.base.ThreadUtils;
8 import org.chromium.chrome.browser.preferences.LocationSettings; 10 import org.chromium.components.location.LocationUtils;
9 11
10 /** 12 /**
11 * Methods for testing location-related features. 13 * Methods for testing location-related features.
12 */ 14 */
13 public class LocationSettingsTestUtil { 15 public class LocationSettingsTestUtil {
14 16
15 /** 17 /**
16 * Mocks the system location setting as either enabled or disabled. Can be c alled on any thread. 18 * Mocks the system location setting as either enabled or disabled. Can be c alled on any thread.
17 */ 19 */
18 public static void setSystemLocationSettingEnabled(final boolean enabled) { 20 public static void setSystemLocationSettingEnabled(final boolean enabled) {
19 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 21 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
20 @Override 22 @Override
21 public void run() { 23 public void run() {
22 LocationSettings.setInstanceForTesting(new LocationSettings(null ) { 24 LocationUtils.setInstanceForTesting(new LocationUtils() {
23 @Override 25 @Override
24 public boolean isSystemLocationSettingEnabled() { 26 public boolean isSystemLocationSettingEnabled(Context contex t) {
25 return enabled; 27 return enabled;
26 } 28 }
27 }); 29 });
28 } 30 }
29 }); 31 });
30 } 32 }
31 } 33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698