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