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

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: 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..7450e0b6dc32fa7bc57206e93e2740ad937695fd 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,31 @@ 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);
+ EXPECT_EQ(auto_blocker
dominickn 2017/06/15 00:34:53 It might be more robust to check the embargo state
benwells 2017/06/15 04:00:40 As discussed it makes the tests not work, as the s
+ ->GetEmbargoResult(GURL(kGoogleAusURL),
+ CONTENT_SETTINGS_TYPE_GEOLOCATION)
+ .source,
+ PermissionStatusSource::MULTIPLE_DISMISSALS);
dominickn 2017/06/15 00:34:53 You should explicitly check the PermissionResult::
benwells 2017/06/15 04:00:40 Checked as well.
+
+ // Now change the DSE to this origin and make sure the embargo is cleared.
+ test_delegate()->SetDSEOrigin(kGoogleAusURL);
+ EXPECT_EQ(auto_blocker
+ ->GetEmbargoResult(GURL(kGoogleAusURL),
+ CONTENT_SETTINGS_TYPE_GEOLOCATION)
+ .source,
dominickn 2017/06/15 00:34:53 You should explicitly check the PermissionResult::
benwells 2017/06/15 04:00:40 Checked as well.
+ PermissionStatusSource::UNSPECIFIED);
+}
« 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