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

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: Add unittest 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
Index: components/domain_reliability/monitor_unittest.cc
diff --git a/components/domain_reliability/monitor_unittest.cc b/components/domain_reliability/monitor_unittest.cc
index b04755f3cfed20bd3d135f3aff2d7a1dff37d370..aced7bab2ae2b841fdfea02a5d96095bc87f7d5f 100644
--- a/components/domain_reliability/monitor_unittest.cc
+++ b/components/domain_reliability/monitor_unittest.cc
@@ -165,4 +165,40 @@ 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_TRUE(CheckNoBeacons(0));
+ EXPECT_TRUE(CheckNoBeacons(1));
+
+ // Add a beacon.
+ RequestInfo request = MakeRequestInfo();
+ request.url = GURL("http://example/always_report");
+ OnRequestLegComplete(request);
+
+ // Make sure it was added.
+ BeaconVector beacons;
+ context_->GetQueuedDataForTesting(0, &beacons, NULL, NULL);
+ EXPECT_EQ(1u, beacons.size());
+ EXPECT_TRUE(CheckNoBeacons(1));
+
+ monitor_.ClearBrowsingData(CLEAR_BEACONS);
+
+ // Make sure the beacon was cleared, but not the contexts.
+ EXPECT_EQ(1u, monitor_.contexts_size_for_testing());
+ EXPECT_TRUE(CheckNoBeacons(0));
+ EXPECT_TRUE(CheckNoBeacons(1));
+}
+
+
+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 domain_reliability
« components/domain_reliability/monitor.cc ('K') | « components/domain_reliability/monitor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698