| 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 331aa7eec623c66884af63caae09dad8d6b71ec1..e1c2a11ce8881776b1666b7c0de88fcc5c991a86 100644
|
| --- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
|
| +++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
|
| @@ -838,6 +838,7 @@ TEST_P(GeolocationPermissionContextTests, LSDBackOffPermissionStatus) {
|
| EnableFeature(&scoped_feature_list, features::kLsdPermissionPrompt);
|
|
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_ALLOW);
|
|
|
| @@ -848,18 +849,18 @@ TEST_P(GeolocationPermissionContextTests, LSDBackOffPermissionStatus) {
|
| DENIED);
|
|
|
| // The permission status should reflect that the LSD will be shown.
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::ASK,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::ASK,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
| EXPECT_TRUE(RequestPermissionIsLSDShown(requesting_frame));
|
|
|
| // Now that the LSD is in backoff, the permission status should reflect it.
|
| EXPECT_FALSE(RequestPermissionIsLSDShown(requesting_frame));
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::DENIED,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::DENIED,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
| }
|
|
|
| TEST_P(GeolocationPermissionContextTests, LSDBackOffAskPromptsDespiteBackOff) {
|
| @@ -867,6 +868,7 @@ TEST_P(GeolocationPermissionContextTests, LSDBackOffAskPromptsDespiteBackOff) {
|
| EnableFeature(&scoped_feature_list, features::kLsdPermissionPrompt);
|
|
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_ALLOW);
|
|
|
| @@ -884,10 +886,10 @@ TEST_P(GeolocationPermissionContextTests, LSDBackOffAskPromptsDespiteBackOff) {
|
| // prompt, and the LSD prompt should now be shown.
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_ASK);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::ASK,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::ASK,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
| EXPECT_TRUE(
|
| RequestPermissionIsLSDShownWithPermissionPrompt(requesting_frame));
|
| }
|
| @@ -898,6 +900,7 @@ TEST_P(GeolocationPermissionContextTests,
|
| EnableFeature(&scoped_feature_list, features::kLsdPermissionPrompt);
|
|
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_ALLOW);
|
|
|
| @@ -1260,6 +1263,7 @@ TEST_P(GeolocationPermissionContextTests, SearchGeolocationInIncognito) {
|
| EnableFeature(&scoped_feature_list, features::kConsistentOmniboxGeolocation);
|
|
|
| GURL requesting_frame(TestSearchEngineDelegate::kDSETestUrl);
|
| + NavigateAndCommit(requesting_frame);
|
| // The DSE Geolocation setting should be used in incognito if it is BLOCK,
|
| // but not if it is ALLOW.
|
| SearchGeolocationService* geo_service =
|
| @@ -1273,22 +1277,23 @@ TEST_P(GeolocationPermissionContextTests, SearchGeolocationInIncognito) {
|
| geo_service->SetDSEGeolocationSetting(true);
|
| ASSERT_EQ(CONTENT_SETTING_ASK,
|
| PermissionManager::Get(otr_profile)
|
| - ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
| - requesting_frame, requesting_frame)
|
| + ->GetPermissionStatusForFrame(CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
| + main_rfh(), requesting_frame)
|
| .content_setting);
|
|
|
| // Changing the setting to BLOCK should flow through to incognito.
|
| geo_service->SetDSEGeolocationSetting(false);
|
| ASSERT_EQ(CONTENT_SETTING_BLOCK,
|
| PermissionManager::Get(otr_profile)
|
| - ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
| - requesting_frame, requesting_frame)
|
| + ->GetPermissionStatusForFrame(CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
| + main_rfh(), requesting_frame)
|
| .content_setting);
|
| }
|
|
|
| TEST_P(GeolocationPermissionContextTests,
|
| GeolocationStatusAndroidDisabledLegacy) {
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
|
|
| // In these tests the Android permission status should not be taken into
|
| // account, only the content setting.
|
| @@ -1296,24 +1301,24 @@ TEST_P(GeolocationPermissionContextTests,
|
| CONTENT_SETTING_ALLOW);
|
| MockLocationSettings::SetLocationStatus(false /* android */,
|
| true /* system */);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::GRANTED,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::GRANTED,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_ASK);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::ASK,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::ASK,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_BLOCK);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::DENIED,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::DENIED,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
| }
|
|
|
| TEST_P(GeolocationPermissionContextTests, GeolocationStatusAndroidDisabled) {
|
| @@ -1321,6 +1326,7 @@ TEST_P(GeolocationPermissionContextTests, GeolocationStatusAndroidDisabled) {
|
| EnableFeature(&scoped_feature_list, features::kLsdPermissionPrompt);
|
|
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
|
|
| // With the Android permission off, but location allowed for a domain, the
|
| // permission status should be ASK.
|
| @@ -1328,33 +1334,34 @@ TEST_P(GeolocationPermissionContextTests, GeolocationStatusAndroidDisabled) {
|
| CONTENT_SETTING_ALLOW);
|
| MockLocationSettings::SetLocationStatus(false /* android */,
|
| true /* system */);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::ASK,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::ASK,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| // With the Android permission off, and location blocked for a domain, the
|
| // permission status should still be BLOCK.
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_BLOCK);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::DENIED,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::DENIED,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| // With the Android permission off, and location prompt for a domain, the
|
| // permission status should still be ASK.
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_ASK);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::ASK,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::ASK,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
| }
|
|
|
| TEST_P(GeolocationPermissionContextTests,
|
| GeolocationStatusSystemDisabledLegacy) {
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
|
|
| // In these tests the system permission status should not be taken into
|
| // account, only the content setting.
|
| @@ -1362,24 +1369,24 @@ TEST_P(GeolocationPermissionContextTests,
|
| CONTENT_SETTING_ALLOW);
|
| MockLocationSettings::SetLocationStatus(true /* android */,
|
| false /* system */);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::GRANTED,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::GRANTED,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_ASK);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::ASK,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::ASK,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_BLOCK);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::DENIED,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::DENIED,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
| }
|
|
|
| TEST_P(GeolocationPermissionContextTests, GeolocationStatusSystemDisabled) {
|
| @@ -1387,6 +1394,7 @@ TEST_P(GeolocationPermissionContextTests, GeolocationStatusSystemDisabled) {
|
| EnableFeature(&scoped_feature_list, features::kLsdPermissionPrompt);
|
|
|
| GURL requesting_frame("https://www.example.com/geolocation");
|
| + NavigateAndCommit(requesting_frame);
|
|
|
| // With the system permission off, but location allowed for a domain, the
|
| // permission status should be reflect whether the LSD can be shown.
|
| @@ -1396,34 +1404,34 @@ TEST_P(GeolocationPermissionContextTests, GeolocationStatusSystemDisabled) {
|
| false /* system */);
|
| MockLocationSettings::SetLocationSettingsDialogStatus(true /* enabled */,
|
| DENIED);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::ASK,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::ASK,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| MockLocationSettings::SetLocationSettingsDialogStatus(false /* enabled */,
|
| GRANTED);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::DENIED,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::DENIED,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| // The result should be the same if the location permission is ASK.
|
| SetGeolocationContentSetting(requesting_frame, requesting_frame,
|
| CONTENT_SETTING_ASK);
|
| MockLocationSettings::SetLocationSettingsDialogStatus(true /* enabled */,
|
| GRANTED);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::ASK,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::ASK,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| MockLocationSettings::SetLocationSettingsDialogStatus(false /* enabled */,
|
| GRANTED);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::DENIED,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::DENIED,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
|
|
| // With the Android permission off, and location blocked for a domain, the
|
| // permission status should still be BLOCK.
|
| @@ -1431,10 +1439,10 @@ TEST_P(GeolocationPermissionContextTests, GeolocationStatusSystemDisabled) {
|
| CONTENT_SETTING_BLOCK);
|
| MockLocationSettings::SetLocationSettingsDialogStatus(true /* enabled */,
|
| GRANTED);
|
| - ASSERT_EQ(blink::mojom::PermissionStatus::DENIED,
|
| - PermissionManager::Get(profile())->GetPermissionStatus(
|
| - content::PermissionType::GEOLOCATION, requesting_frame,
|
| - requesting_frame));
|
| + ASSERT_EQ(
|
| + blink::mojom::PermissionStatus::DENIED,
|
| + PermissionManager::Get(profile())->GetPermissionStatusForFrame(
|
| + content::PermissionType::GEOLOCATION, main_rfh(), requesting_frame));
|
| }
|
| #endif // defined(OS_ANDROID)
|
|
|
|
|