Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_ANDROID_MOCK_LOCATION_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_MOCK_LOCATION_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_ANDROID_MOCK_LOCATION_SETTINGS_H_ | 6 #define CHROME_BROWSER_ANDROID_MOCK_LOCATION_SETTINGS_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/android/location_settings.h" | 9 #include "chrome/browser/android/location_settings.h" |
| 10 | 10 |
| 11 // Mock implementation of LocationSettings for unit tests. | 11 // Mock implementation of LocationSettings for unit tests. |
| 12 class MockLocationSettings : public LocationSettings { | 12 class MockLocationSettings : public LocationSettings { |
| 13 public: | 13 public: |
| 14 MockLocationSettings(); | 14 MockLocationSettings(); |
| 15 ~MockLocationSettings() override; | 15 ~MockLocationSettings() override; |
| 16 | 16 |
| 17 static void SetLocationStatus(bool master, bool google_apps); | 17 static void SetLocationStatus(bool android, bool system); |
|
dominickn
2017/03/03 00:08:23
Nit: can this be has_android_permission and system
benwells
2017/03/03 01:43:09
Done.
| |
| 18 static void SetCanPromptForAndroidPermission(bool can_prompt); | |
| 19 static void SetLocationSettingsDialogStatus( | |
| 20 bool enabled, | |
| 21 LocationSettingsDialogOutcome outcome); | |
| 22 static bool HasShownLocationSettingsDialog(); | |
| 18 | 23 |
| 19 bool CanSitesRequestLocationPermission( | 24 // LocationSettings implementation: |
| 25 bool HasAndroidLocationPermission() override; | |
| 26 bool CanPromptForAndroidLocationPermission( | |
| 20 content::WebContents* web_contents) override; | 27 content::WebContents* web_contents) override; |
| 21 | 28 bool IsSystemLocationSettingEnabled() override; |
| 22 bool CanPromptToEnableSystemLocationSetting() override; | 29 bool CanPromptToEnableSystemLocationSetting() override; |
| 23 | |
| 24 void PromptToEnableSystemLocationSetting( | 30 void PromptToEnableSystemLocationSetting( |
| 25 const LocationSettingsDialogContext prompt_context, | 31 const LocationSettingsDialogContext prompt_context, |
| 26 content::WebContents* web_contents, | 32 content::WebContents* web_contents, |
| 27 LocationSettingsDialogOutcomeCallback callback) | 33 LocationSettingsDialogOutcomeCallback callback) |
| 28 override; | 34 override; |
| 29 | 35 |
| 30 bool IsMasterLocationSettingEnabled(); | |
| 31 bool IsGoogleAppsLocationSettingEnabled(); | |
| 32 | |
| 33 private: | 36 private: |
| 34 static bool master_location_enabled; | 37 static bool has_android_location_permission; |
| 35 static bool google_apps_location_enabled; | 38 static bool can_prompt_for_android_location_permission; |
| 39 static bool is_system_location_setting_enabled; | |
| 40 static bool location_settings_dialog_enabled; | |
| 41 static bool has_shown_location_settings_dialog; | |
| 42 static LocationSettingsDialogOutcome location_settings_dialog_outcome; | |
| 36 | 43 |
| 37 DISALLOW_COPY_AND_ASSIGN(MockLocationSettings); | 44 DISALLOW_COPY_AND_ASSIGN(MockLocationSettings); |
| 38 }; | 45 }; |
| 39 | 46 |
| 40 #endif // CHROME_BROWSER_ANDROID_MOCK_LOCATION_SETTINGS_H_ | 47 #endif // CHROME_BROWSER_ANDROID_MOCK_LOCATION_SETTINGS_H_ |
| OLD | NEW |