| 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
|
|
|