OLD | NEW |
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 } |
OLD | NEW |