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

Unified Diff: chrome/browser/permissions/permission_util_unittest.cc

Issue 2165733003: Add revocation reporter to permission util (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-source-ui-to-permission-report
Patch Set: Add missing return Created 4 years, 5 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
Index: chrome/browser/permissions/permission_util_unittest.cc
diff --git a/chrome/browser/permissions/permission_util_unittest.cc b/chrome/browser/permissions/permission_util_unittest.cc
index def5eb91764dbbe6b4bcf1c1fedef2e8b0818ef3..41ef9699b7aa323cbfb20bfb5b51e1642b11a534 100644
--- a/chrome/browser/permissions/permission_util_unittest.cc
+++ b/chrome/browser/permissions/permission_util_unittest.cc
@@ -27,28 +27,48 @@ TEST_F(PermissionUtilTest, SetContentSettingRecordRevocation) {
// Allow->Block triggers a revocation.
map->SetContentSettingDefaultScope(host, host, type, std::string(),
CONTENT_SETTING_ALLOW);
- PermissionUtil::SetContentSettingAndRecordRevocation(
- &profile, host, host, type, std::string(), CONTENT_SETTING_BLOCK);
+ {
+ PermissionUtil::RevocationReporter scoped_revocation_reporter(
+ &profile, host, host, type, std::string(),
+ PermissionSourceUI::SITE_SETTINGS);
+ map->SetContentSettingDefaultScope(host, host, type, std::string(),
+ CONTENT_SETTING_BLOCK);
+ }
histograms.ExpectBucketCount("Permissions.Action.Geolocation",
PermissionAction::REVOKED, 1);
// Block->Allow does not trigger a revocation.
- PermissionUtil::SetContentSettingAndRecordRevocation(
- &profile, host, host, type, std::string(), CONTENT_SETTING_ALLOW);
+ {
+ PermissionUtil::RevocationReporter scoped_revocation_reporter(
raymes 2016/07/21 23:08:01 Calling the class ScopedRevocationReporter is actu
stefanocs 2016/07/22 00:44:28 Done.
+ &profile, host, host, type, std::string(),
+ PermissionSourceUI::SITE_SETTINGS);
+ map->SetContentSettingDefaultScope(host, host, type, std::string(),
+ CONTENT_SETTING_ALLOW);
+ }
histograms.ExpectBucketCount("Permissions.Action.Geolocation",
PermissionAction::REVOKED, 1);
// Allow->Default triggers a revocation when default is 'ask'.
map->SetDefaultContentSetting(type, CONTENT_SETTING_ASK);
- PermissionUtil::SetContentSettingAndRecordRevocation(
- &profile, host, host, type, std::string(), CONTENT_SETTING_DEFAULT);
+ {
+ PermissionUtil::RevocationReporter scoped_revocation_reporter(
+ &profile, host, host, type, std::string(),
+ PermissionSourceUI::SITE_SETTINGS);
+ map->SetContentSettingDefaultScope(host, host, type, std::string(),
+ CONTENT_SETTING_DEFAULT);
+ }
histograms.ExpectBucketCount("Permissions.Action.Geolocation",
PermissionAction::REVOKED, 2);
// Allow->Default does not trigger a revocation when default is 'allow'.
map->SetDefaultContentSetting(type, CONTENT_SETTING_ALLOW);
- PermissionUtil::SetContentSettingAndRecordRevocation(
- &profile, host, host, type, std::string(), CONTENT_SETTING_DEFAULT);
+ {
+ PermissionUtil::RevocationReporter scoped_revocation_reporter(
+ &profile, host, host, type, std::string(),
+ PermissionSourceUI::SITE_SETTINGS);
+ map->SetContentSettingDefaultScope(host, host, type, std::string(),
+ CONTENT_SETTING_DEFAULT);
raymes 2016/07/21 23:08:01 These tests don't exercise the new constructor. Bu
stefanocs 2016/07/22 00:44:28 Acknowledged.
+ }
histograms.ExpectBucketCount("Permissions.Action.Geolocation",
PermissionAction::REVOKED, 2);
}

Powered by Google App Engine
This is Rietveld 408576698