| 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/context.h" | 5 #include "components/domain_reliability/context.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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 EXPECT_EQ(0u, beacons.size()); | 531 EXPECT_EQ(0u, beacons.size()); |
| 532 | 532 |
| 533 std::unique_ptr<DomainReliabilityBeacon> beacon(MakeBeacon(&time_)); | 533 std::unique_ptr<DomainReliabilityBeacon> beacon(MakeBeacon(&time_)); |
| 534 beacon->status = "ok"; | 534 beacon->status = "ok"; |
| 535 beacon->chrome_error = net::OK; | 535 beacon->chrome_error = net::OK; |
| 536 context_->OnBeacon(std::move(beacon)); | 536 context_->OnBeacon(std::move(beacon)); |
| 537 context_->GetQueuedBeaconsForTesting(&beacons); | 537 context_->GetQueuedBeaconsForTesting(&beacons); |
| 538 EXPECT_EQ(0u, beacons.size()); | 538 EXPECT_EQ(0u, beacons.size()); |
| 539 } | 539 } |
| 540 | 540 |
| 541 TEST_F(DomainReliabilityContextTest, ExpiredBeaconDoesNotUpload) { |
| 542 InitContext(MakeTestConfig()); |
| 543 std::unique_ptr<DomainReliabilityBeacon> beacon = MakeBeacon(&time_); |
| 544 time_.Advance(base::TimeDelta::FromHours(2)); |
| 545 context_->OnBeacon(std::move(beacon)); |
| 546 |
| 547 time_.Advance(max_delay()); |
| 548 EXPECT_FALSE(upload_pending()); |
| 549 BeaconVector beacons; |
| 550 context_->GetQueuedBeaconsForTesting(&beacons); |
| 551 EXPECT_TRUE(beacons.empty()); |
| 552 } |
| 553 |
| 541 // TODO(juliatuttle): Add beacon_unittest.cc to test serialization. | 554 // TODO(juliatuttle): Add beacon_unittest.cc to test serialization. |
| 542 | 555 |
| 543 } // namespace | 556 } // namespace |
| 544 } // namespace domain_reliability | 557 } // namespace domain_reliability |
| OLD | NEW |