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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « components/safe_browsing_db/safe_browsing_prefs.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/test/scoped_feature_list.h" 10 #include "base/test/scoped_feature_list.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 EXPECT_EQ(kSberResource, 190 EXPECT_EQ(kSberResource,
191 ChooseOptInTextResource(prefs_, kSberResource, kScoutResource)); 191 ChooseOptInTextResource(prefs_, kSberResource, kScoutResource));
192 192
193 // Enabling Scout switches to the Scout opt-in text. 193 // Enabling Scout switches to the Scout opt-in text.
194 ResetExperiments(/*can_show_scout=*/false, /*only_show_scout=*/true); 194 ResetExperiments(/*can_show_scout=*/false, /*only_show_scout=*/true);
195 ResetPrefs(/*sber=*/false, /*scout=*/false, /*scout_group=*/true); 195 ResetPrefs(/*sber=*/false, /*scout=*/false, /*scout_group=*/true);
196 EXPECT_EQ(kScoutResource, 196 EXPECT_EQ(kScoutResource,
197 ChooseOptInTextResource(prefs_, kSberResource, kScoutResource)); 197 ChooseOptInTextResource(prefs_, kSberResource, kScoutResource));
198 } 198 }
199 199
200 TEST_F(SafeBrowsingPrefsTest, GetSafeBrowsingExtendedReportingLevel) {
201 // By Default, SBER is off
202 EXPECT_EQ(SBER_LEVEL_OFF, GetExtendedReportingLevel(prefs_));
203
204 // Opt-in to Legacy SBER gives Legacy reporting leve.
205 ResetPrefs(/*sber=*/true, /*scout_reporting=*/false, /*scout_group=*/false);
206 EXPECT_EQ(SBER_LEVEL_LEGACY, GetExtendedReportingLevel(prefs_));
207
208 // The value of the Scout pref doesn't change the reporting level if the user
209 // is outside of the Scout Group and/or no experiment is running.
210 // No scout group.
211 ResetPrefs(/*sber=*/true, /*scout_reporting=*/true, /*scout_group=*/false);
212 EXPECT_EQ(SBER_LEVEL_LEGACY, GetExtendedReportingLevel(prefs_));
213 // Scout group but no experiment.
214 ResetPrefs(/*sber=*/true, /*scout_reporting=*/true, /*scout_group=*/true);
215 EXPECT_EQ(SBER_LEVEL_LEGACY, GetExtendedReportingLevel(prefs_));
216
217 // Remaining in the Scout Group and adding an experiment will switch to the
218 // Scout pref to determine reporting level.
219 ResetExperiments(/*can_show_scout=*/false, /*only_show_scout=*/true);
220 // Both reporting prefs off, so reporting is off.
221 ResetPrefs(/*sber=*/false, /*scout_reporting=*/false, /*scout_group=*/true);
222 EXPECT_EQ(SBER_LEVEL_OFF, GetExtendedReportingLevel(prefs_));
223 // Legacy pref on when we're using Scout - reporting remains off.
224 ResetPrefs(/*sber=*/true, /*scout_reporting=*/false, /*scout_group=*/true);
225 EXPECT_EQ(SBER_LEVEL_OFF, GetExtendedReportingLevel(prefs_));
226 // Turning on Scout gives us Scout level reporting
227 ResetPrefs(/*sber=*/false, /*scout_reporting=*/true, /*scout_group=*/true);
228 EXPECT_EQ(SBER_LEVEL_SCOUT, GetExtendedReportingLevel(prefs_));
229 // .. and the legacy pref doesn't affect this.
230 ResetPrefs(/*sber=*/true, /*scout_reporting=*/true, /*scout_group=*/true);
231 EXPECT_EQ(SBER_LEVEL_SCOUT, GetExtendedReportingLevel(prefs_));
232 }
233
200 } // namespace safe_browsing 234 } // namespace safe_browsing
OLDNEW
« 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