OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/domain_reliability/monitor.h" | 5 #include "components/domain_reliability/monitor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 // Count the number of baked-in configs. | 266 // Count the number of baked-in configs. |
267 size_t num_baked_in_configs = 0; | 267 size_t num_baked_in_configs = 0; |
268 for (const char* const* p = kBakedInJsonConfigs; *p; ++p) | 268 for (const char* const* p = kBakedInJsonConfigs; *p; ++p) |
269 ++num_baked_in_configs; | 269 ++num_baked_in_configs; |
270 | 270 |
271 // Also count the Google configs stored in abbreviated form. | 271 // Also count the Google configs stored in abbreviated form. |
272 std::vector<DomainReliabilityConfig*> google_configs; | 272 std::vector<DomainReliabilityConfig*> google_configs; |
273 GetAllGoogleConfigs(&google_configs); | 273 GetAllGoogleConfigs(&google_configs); |
274 size_t num_google_configs = google_configs.size(); | 274 size_t num_google_configs = google_configs.size(); |
275 STLDeleteElements(&google_configs); | 275 base::STLDeleteElements(&google_configs); |
276 | 276 |
277 // The monitor should have contexts for all of the baked-in configs. | 277 // The monitor should have contexts for all of the baked-in configs. |
278 EXPECT_EQ(num_baked_in_configs + num_google_configs, | 278 EXPECT_EQ(num_baked_in_configs + num_google_configs, |
279 monitor_.contexts_size_for_testing()); | 279 monitor_.contexts_size_for_testing()); |
280 } | 280 } |
281 | 281 |
282 TEST_F(DomainReliabilityMonitorTest, ClearBeacons) { | 282 TEST_F(DomainReliabilityMonitorTest, ClearBeacons) { |
283 DomainReliabilityContext* context = CreateAndAddContext(); | 283 DomainReliabilityContext* context = CreateAndAddContext(); |
284 | 284 |
285 // Initially the monitor should have just the test context, with no beacons. | 285 // Initially the monitor should have just the test context, with no beacons. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET); | 430 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET); |
431 OnRequestLegComplete(request); | 431 OnRequestLegComplete(request); |
432 | 432 |
433 EXPECT_EQ(1u, CountQueuedBeacons(context1)); | 433 EXPECT_EQ(1u, CountQueuedBeacons(context1)); |
434 EXPECT_EQ(0u, CountQueuedBeacons(context2)); | 434 EXPECT_EQ(0u, CountQueuedBeacons(context2)); |
435 } | 435 } |
436 | 436 |
437 } // namespace | 437 } // namespace |
438 | 438 |
439 } // namespace domain_reliability | 439 } // namespace domain_reliability |
OLD | NEW |