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

Unified Diff: components/safe_browsing_db/safe_browsing_prefs_unittest.cc

Issue 2505153002: Add support for scout to 'ext' param when creating SafeBrowsing ping URLs. (Closed)
Patch Set: Go back to IsExtendedReportingEnabled where level doesn't matter Created 4 years, 1 month 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 | « components/safe_browsing_db/safe_browsing_prefs.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/safe_browsing_db/safe_browsing_prefs_unittest.cc
diff --git a/components/safe_browsing_db/safe_browsing_prefs_unittest.cc b/components/safe_browsing_db/safe_browsing_prefs_unittest.cc
index a06708f3c698816ec07e77367ddfcf20d4dbc3fd..b5b86f7a3d5ac2b71053f1c6532078f8f453a673 100644
--- a/components/safe_browsing_db/safe_browsing_prefs_unittest.cc
+++ b/components/safe_browsing_db/safe_browsing_prefs_unittest.cc
@@ -197,4 +197,38 @@ TEST_F(SafeBrowsingPrefsTest, ChooseOptInText) {
ChooseOptInTextResource(prefs_, kSberResource, kScoutResource));
}
+TEST_F(SafeBrowsingPrefsTest, GetSafeBrowsingExtendedReportingLevel) {
+ // By Default, SBER is off
+ EXPECT_EQ(SBER_LEVEL_OFF, GetExtendedReportingLevel(prefs_));
+
+ // Opt-in to Legacy SBER gives Legacy reporting leve.
+ ResetPrefs(/*sber=*/true, /*scout_reporting=*/false, /*scout_group=*/false);
+ EXPECT_EQ(SBER_LEVEL_LEGACY, GetExtendedReportingLevel(prefs_));
+
+ // The value of the Scout pref doesn't change the reporting level if the user
+ // is outside of the Scout Group and/or no experiment is running.
+ // No scout group.
+ ResetPrefs(/*sber=*/true, /*scout_reporting=*/true, /*scout_group=*/false);
+ EXPECT_EQ(SBER_LEVEL_LEGACY, GetExtendedReportingLevel(prefs_));
+ // Scout group but no experiment.
+ ResetPrefs(/*sber=*/true, /*scout_reporting=*/true, /*scout_group=*/true);
+ EXPECT_EQ(SBER_LEVEL_LEGACY, GetExtendedReportingLevel(prefs_));
+
+ // Remaining in the Scout Group and adding an experiment will switch to the
+ // Scout pref to determine reporting level.
+ ResetExperiments(/*can_show_scout=*/false, /*only_show_scout=*/true);
+ // Both reporting prefs off, so reporting is off.
+ ResetPrefs(/*sber=*/false, /*scout_reporting=*/false, /*scout_group=*/true);
+ EXPECT_EQ(SBER_LEVEL_OFF, GetExtendedReportingLevel(prefs_));
+ // Legacy pref on when we're using Scout - reporting remains off.
+ ResetPrefs(/*sber=*/true, /*scout_reporting=*/false, /*scout_group=*/true);
+ EXPECT_EQ(SBER_LEVEL_OFF, GetExtendedReportingLevel(prefs_));
+ // Turning on Scout gives us Scout level reporting
+ ResetPrefs(/*sber=*/false, /*scout_reporting=*/true, /*scout_group=*/true);
+ EXPECT_EQ(SBER_LEVEL_SCOUT, GetExtendedReportingLevel(prefs_));
+ // .. and the legacy pref doesn't affect this.
+ ResetPrefs(/*sber=*/true, /*scout_reporting=*/true, /*scout_group=*/true);
+ EXPECT_EQ(SBER_LEVEL_SCOUT, GetExtendedReportingLevel(prefs_));
+}
+
} // namespace safe_browsing
« no previous file with comments | « components/safe_browsing_db/safe_browsing_prefs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698