| 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 #include "components/location/android/location_settings_dialog_context.h" |
| 11 #include "components/location/android/location_settings_dialog_outcome.h" |
| 10 | 12 |
| 11 // Mock implementation of LocationSettings for unit tests. | 13 // Mock implementation of LocationSettings for unit tests. |
| 12 class MockLocationSettings : public LocationSettings { | 14 class MockLocationSettings : public LocationSettings { |
| 13 public: | 15 public: |
| 14 MockLocationSettings(); | 16 MockLocationSettings(); |
| 15 ~MockLocationSettings() override; | 17 ~MockLocationSettings() override; |
| 16 | 18 |
| 17 static void SetLocationStatus(bool master, bool google_apps); | 19 static void SetLocationStatus(bool has_android_location_permission, |
| 20 bool is_system_location_setting_enabled); |
| 21 static void SetCanPromptForAndroidPermission(bool can_prompt); |
| 22 static void SetLocationSettingsDialogStatus( |
| 23 bool enabled, |
| 24 LocationSettingsDialogOutcome outcome); |
| 25 static bool HasShownLocationSettingsDialog(); |
| 18 | 26 |
| 19 bool CanSitesRequestLocationPermission( | 27 // LocationSettings implementation: |
| 28 bool HasAndroidLocationPermission() override; |
| 29 bool CanPromptForAndroidLocationPermission( |
| 20 content::WebContents* web_contents) override; | 30 content::WebContents* web_contents) override; |
| 21 | 31 bool IsSystemLocationSettingEnabled() override; |
| 22 bool CanPromptToEnableSystemLocationSetting() override; | 32 bool CanPromptToEnableSystemLocationSetting() override; |
| 23 | |
| 24 void PromptToEnableSystemLocationSetting( | 33 void PromptToEnableSystemLocationSetting( |
| 25 const LocationSettingsDialogContext prompt_context, | 34 const LocationSettingsDialogContext prompt_context, |
| 26 content::WebContents* web_contents, | 35 content::WebContents* web_contents, |
| 27 LocationSettingsDialogOutcomeCallback callback) override; | 36 LocationSettingsDialogOutcomeCallback callback) override; |
| 28 | 37 |
| 29 bool IsMasterLocationSettingEnabled(); | |
| 30 bool IsGoogleAppsLocationSettingEnabled(); | |
| 31 | |
| 32 private: | 38 private: |
| 33 static bool master_location_enabled; | 39 static bool has_android_location_permission_; |
| 34 static bool google_apps_location_enabled; | 40 static bool can_prompt_for_android_location_permission_; |
| 41 static bool is_system_location_setting_enabled_; |
| 42 static bool location_settings_dialog_enabled_; |
| 43 static bool has_shown_location_settings_dialog_; |
| 44 static LocationSettingsDialogOutcome location_settings_dialog_outcome_; |
| 35 | 45 |
| 36 DISALLOW_COPY_AND_ASSIGN(MockLocationSettings); | 46 DISALLOW_COPY_AND_ASSIGN(MockLocationSettings); |
| 37 }; | 47 }; |
| 38 | 48 |
| 39 #endif // CHROME_BROWSER_ANDROID_MOCK_LOCATION_SETTINGS_H_ | 49 #endif // CHROME_BROWSER_ANDROID_MOCK_LOCATION_SETTINGS_H_ |
| OLD | NEW |