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

Side by Side Diff: components/domain_reliability/context_unittest.cc

Issue 2464163003: Domain Reliability: Expire queued beacons after 1 hour. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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
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
OLDNEW
« components/domain_reliability/context.cc ('K') | « components/domain_reliability/context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698