Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Unified Diff: chrome/browser/android/search_geolocation/search_geolocation_service_unittest.cc

Issue 2941753002: Reset geolocation permission embargo for an origin when it becomes DSE (Closed)
Patch Set: Feedback Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/search_geolocation/search_geolocation_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/search_geolocation/search_geolocation_service_unittest.cc
diff --git a/chrome/browser/android/search_geolocation/search_geolocation_service_unittest.cc b/chrome/browser/android/search_geolocation/search_geolocation_service_unittest.cc
index 1458315d9a2d189055568942a5fcdceece3d0a7f..f1a2005bfb057e942e21b1ca40609a62f2c1a0be 100644
--- a/chrome/browser/android/search_geolocation/search_geolocation_service_unittest.cc
+++ b/chrome/browser/android/search_geolocation/search_geolocation_service_unittest.cc
@@ -13,6 +13,8 @@
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
+#include "chrome/browser/permissions/permission_decision_auto_blocker.h"
+#include "chrome/browser/permissions/permission_result.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
@@ -374,3 +376,29 @@ TEST_F(SearchGeolocationServiceTest, DSEChangesAndDisclosure) {
EXPECT_TRUE(SearchGeolocationDisclosureTabHelper::IsDisclosureResetForTests(
profile()));
}
+
+TEST_F(SearchGeolocationServiceTest, Embargo) {
+ test_delegate()->SetDSEOrigin(kGoogleURL);
+
+ // Place another origin under embargo.
+ GURL google_aus_url(kGoogleAusURL);
+ PermissionDecisionAutoBlocker* auto_blocker =
+ PermissionDecisionAutoBlocker::GetForProfile(profile());
+ auto_blocker->RecordDismissAndEmbargo(google_aus_url,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION);
+ auto_blocker->RecordDismissAndEmbargo(google_aus_url,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION);
+ auto_blocker->RecordDismissAndEmbargo(google_aus_url,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION);
+ PermissionResult result = auto_blocker->GetEmbargoResult(
+ GURL(kGoogleAusURL), CONTENT_SETTINGS_TYPE_GEOLOCATION);
+ EXPECT_EQ(result.source, PermissionStatusSource::MULTIPLE_DISMISSALS);
+ EXPECT_EQ(result.content_setting, CONTENT_SETTING_BLOCK);
+
+ // Now change the DSE to this origin and make sure the embargo is cleared.
+ test_delegate()->SetDSEOrigin(kGoogleAusURL);
+ result = auto_blocker->GetEmbargoResult(GURL(kGoogleAusURL),
+ CONTENT_SETTINGS_TYPE_GEOLOCATION);
+ EXPECT_EQ(result.source, PermissionStatusSource::UNSPECIFIED);
+ EXPECT_EQ(result.content_setting, CONTENT_SETTING_ASK);
+}
« no previous file with comments | « chrome/browser/android/search_geolocation/search_geolocation_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698