| Index: chrome/browser/geolocation/geolocation_permission_context_unittest.cc
|
| diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
|
| index 76b8701c68160c0862bf033d6ca31fec1033a95e..fe5760ed73a5ab45e9ece07a6855041b8108ead7 100644
|
| --- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
|
| +++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
|
| @@ -317,6 +317,7 @@ void GeolocationPermissionContextTests::SetUp() {
|
| ->SetLocationSettingsForTesting(
|
| std::unique_ptr<LocationSettings>(new MockLocationSettings()));
|
| MockLocationSettings::SetLocationStatus(true, true);
|
| + MockLocationSettings::SetCanPromptForAndroidPermission(true);
|
| #else
|
| SetupRequestManager(web_contents());
|
| #endif
|
| @@ -475,7 +476,8 @@ TEST_F(GeolocationPermissionContextTests, SinglePermissionInfobar) {
|
| TEST_F(GeolocationPermissionContextTests, GeolocationEnabledDisabled) {
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| NavigateAndCommit(requesting_frame);
|
| - MockLocationSettings::SetLocationStatus(true, true);
|
| + MockLocationSettings::SetLocationStatus(true /* android */,
|
| + true /* system */);
|
| EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| RequestGeolocationPermission(
|
| web_contents(), RequestID(0), requesting_frame, true);
|
| @@ -487,17 +489,20 @@ TEST_F(GeolocationPermissionContextTests, GeolocationEnabledDisabled) {
|
| ConfirmInfoBarDelegate::BUTTON_OK);
|
|
|
| Reload();
|
| - MockLocationSettings::SetLocationStatus(true, false);
|
| + MockLocationSettings::SetLocationStatus(false /* android */,
|
| + true /* system */);
|
| + MockLocationSettings::SetCanPromptForAndroidPermission(false);
|
| EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| RequestGeolocationPermission(
|
| web_contents(), RequestID(0), requesting_frame, true);
|
| EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| }
|
|
|
| -TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsEnabled) {
|
| +TEST_F(GeolocationPermissionContextTests, AndroidEnabledCanPrompt) {
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| NavigateAndCommit(requesting_frame);
|
| - MockLocationSettings::SetLocationStatus(true, true);
|
| + MockLocationSettings::SetLocationStatus(false /* android */,
|
| + true /* system */);
|
| EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| RequestGeolocationPermission(
|
| web_contents(), RequestID(0), requesting_frame, true);
|
| @@ -510,15 +515,75 @@ TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsEnabled) {
|
| CheckPermissionMessageSent(0, true);
|
| }
|
|
|
| -TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsDisabled) {
|
| +TEST_F(GeolocationPermissionContextTests, AndroidEnabledCantPrompt) {
|
| + GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
| + MockLocationSettings::SetLocationStatus(false /* android */,
|
| + true /* system */);
|
| + MockLocationSettings::SetCanPromptForAndroidPermission(false);
|
| + EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| + RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame,
|
| + true);
|
| + EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| +}
|
| +
|
| +TEST_F(GeolocationPermissionContextTests, SystemLocationOffLSDDisabled) {
|
| + base::test::ScopedFeatureList scoped_feature_list;
|
| + scoped_feature_list.InitAndEnableFeature(features::kLsdPermissionPrompt);
|
| +
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| NavigateAndCommit(requesting_frame);
|
| - MockLocationSettings::SetLocationStatus(true, false);
|
| + MockLocationSettings::SetLocationStatus(true /* android */,
|
| + false /* system */);
|
| EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| RequestGeolocationPermission(
|
| web_contents(), RequestID(0), requesting_frame, true);
|
| EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| }
|
| +
|
| +TEST_F(GeolocationPermissionContextTests, SystemLocationOffLSDAccept) {
|
| + base::test::ScopedFeatureList scoped_feature_list;
|
| + scoped_feature_list.InitAndEnableFeature(features::kLsdPermissionPrompt);
|
| +
|
| + GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
| + MockLocationSettings::SetLocationStatus(true /* android */,
|
| + false /* system */);
|
| + MockLocationSettings::SetLocationSettingsDialogStatus(
|
| + true, LocationSettings::GRANTED);
|
| + EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| + RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame,
|
| + true);
|
| + EXPECT_EQ(1U, infobar_service()->infobar_count());
|
| + ConfirmInfoBarDelegate* infobar_delegate =
|
| + infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
|
| + ASSERT_TRUE(infobar_delegate);
|
| + infobar_delegate->Accept();
|
| + CheckTabContentsState(requesting_frame, CONTENT_SETTING_ALLOW);
|
| + CheckPermissionMessageSent(0, true);
|
| +}
|
| +
|
| +TEST_F(GeolocationPermissionContextTests, SystemLocationOffLSDReject) {
|
| + base::test::ScopedFeatureList scoped_feature_list;
|
| + scoped_feature_list.InitAndEnableFeature(features::kLsdPermissionPrompt);
|
| +
|
| + GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
| + MockLocationSettings::SetLocationStatus(true /* android */,
|
| + false /* system */);
|
| + MockLocationSettings::SetLocationSettingsDialogStatus(
|
| + true, LocationSettings::DENIED);
|
| + EXPECT_EQ(0U, infobar_service()->infobar_count());
|
| + RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame,
|
| + true);
|
| + EXPECT_EQ(1U, infobar_service()->infobar_count());
|
| + ConfirmInfoBarDelegate* infobar_delegate =
|
| + infobar_service()->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
|
| + ASSERT_TRUE(infobar_delegate);
|
| + infobar_delegate->Accept();
|
| + CheckTabContentsState(requesting_frame, CONTENT_SETTING_BLOCK);
|
| + CheckPermissionMessageSent(0, false);
|
| +}
|
| #endif
|
|
|
| TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
|
|
|