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

Unified Diff: components/domain_reliability/monitor_unittest.cc

Issue 238863005: Domain Reliability: Remove browsing data when requested. (Closed) Base URL: http://git.chromium.org/chromium/src.git@domrel_bakedin
Patch Set: ...and fix BrowsingDataRemoverTet Created 6 years, 7 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 | « components/domain_reliability/monitor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/domain_reliability/monitor_unittest.cc
diff --git a/components/domain_reliability/monitor_unittest.cc b/components/domain_reliability/monitor_unittest.cc
index b0b9e9d8f7ca27ed560b425b23c64732744f84df..84f3067d2fd12f2a5df5cbdb85dba3180dfb8609 100644
--- a/components/domain_reliability/monitor_unittest.cc
+++ b/components/domain_reliability/monitor_unittest.cc
@@ -288,6 +288,44 @@ TEST_F(DomainReliabilityMonitorTest, AddBakedInConfigs) {
EXPECT_EQ(num_baked_in_configs + 1, monitor_.contexts_size_for_testing());
}
+TEST_F(DomainReliabilityMonitorTest, ClearBeacons) {
+ // Initially the monitor should have just the test context, with no beacons.
+ EXPECT_EQ(1u, monitor_.contexts_size_for_testing());
+ EXPECT_EQ(0u, CountPendingBeacons(kAlwaysReportIndex));
+ EXPECT_TRUE(CheckRequestCounts(kAlwaysReportIndex, 0u, 0u));
+ EXPECT_EQ(0u, CountPendingBeacons(kNeverReportIndex));
+ EXPECT_TRUE(CheckRequestCounts(kNeverReportIndex, 0u, 0u));
+
+ // Add a beacon.
+ RequestInfo request = MakeRequestInfo();
+ request.url = GURL("http://example/always_report");
+ OnRequestLegComplete(request);
+
+ // Make sure it was added.
+ EXPECT_EQ(1u, CountPendingBeacons(kAlwaysReportIndex));
+ EXPECT_TRUE(CheckRequestCounts(kAlwaysReportIndex, 1u, 0u));
+
+ monitor_.ClearBrowsingData(CLEAR_BEACONS);
+
+ // Make sure the beacon was cleared, but not the contexts.
+ EXPECT_EQ(1u, monitor_.contexts_size_for_testing());
+ EXPECT_EQ(0u, CountPendingBeacons(kAlwaysReportIndex));
+ EXPECT_TRUE(CheckRequestCounts(kAlwaysReportIndex, 0u, 0u));
+ EXPECT_EQ(0u, CountPendingBeacons(kNeverReportIndex));
+ EXPECT_TRUE(CheckRequestCounts(kNeverReportIndex, 0u, 0u));
+}
+
+
+TEST_F(DomainReliabilityMonitorTest, ClearContexts) {
+ // Initially the monitor should have just the test context.
+ EXPECT_EQ(1u, monitor_.contexts_size_for_testing());
+
+ monitor_.ClearBrowsingData(CLEAR_CONTEXTS);
+
+ // Clearing contexts should leave the monitor with none.
+ EXPECT_EQ(0u, monitor_.contexts_size_for_testing());
+}
+
} // namespace
} // namespace domain_reliability
« no previous file with comments | « components/domain_reliability/monitor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698