| Index: components/domain_reliability/scheduler_unittest.cc
|
| diff --git a/components/domain_reliability/scheduler_unittest.cc b/components/domain_reliability/scheduler_unittest.cc
|
| index 9eb96a39debf7eec51ef6d3efd93eaf5fa1803c3..f141cfb48c40c0f94a44f77db601f1a4c4554210 100644
|
| --- a/components/domain_reliability/scheduler_unittest.cc
|
| +++ b/components/domain_reliability/scheduler_unittest.cc
|
| @@ -63,6 +63,7 @@ class DomainReliabilitySchedulerTest : public testing::Test {
|
|
|
| if (callback_called_ && expected_min == callback_min_
|
| && expected_max == callback_max_) {
|
| + callback_called_ = false;
|
| return ::testing::AssertionSuccess();
|
| }
|
|
|
| @@ -210,4 +211,40 @@ TEST_F(DomainReliabilitySchedulerTest, DetermineCollectorAtUpload) {
|
| scheduler_->OnUploadComplete(true);
|
| }
|
|
|
| +TEST_F(DomainReliabilitySchedulerTest, BeaconWhilePending) {
|
| + CreateScheduler(1);
|
| +
|
| + scheduler_->OnBeaconAdded();
|
| + ASSERT_TRUE(CheckPendingUpload(min_delay(), max_delay()));
|
| +
|
| + // Second beacon should not call callback again.
|
| + scheduler_->OnBeaconAdded();
|
| + ASSERT_TRUE(CheckNoPendingUpload());
|
| + time_.Advance(min_delay());
|
| +
|
| + // No pending upload after beacon.
|
| + ASSERT_TRUE(CheckStartingUpload(0));
|
| + scheduler_->OnUploadComplete(true);
|
| + ASSERT_TRUE(CheckNoPendingUpload());
|
| +}
|
| +
|
| +TEST_F(DomainReliabilitySchedulerTest, BeaconWhileUploading) {
|
| + CreateScheduler(1);
|
| +
|
| + scheduler_->OnBeaconAdded();
|
| + ASSERT_TRUE(CheckPendingUpload(min_delay(), max_delay()));
|
| + time_.Advance(min_delay());
|
| +
|
| + // If a beacon arrives during the upload, a new upload should be pending.
|
| + ASSERT_TRUE(CheckStartingUpload(0));
|
| + scheduler_->OnBeaconAdded();
|
| + scheduler_->OnUploadComplete(true);
|
| + ASSERT_TRUE(CheckPendingUpload(min_delay(), max_delay()));
|
| +
|
| + time_.Advance(min_delay());
|
| + ASSERT_TRUE(CheckStartingUpload(0));
|
| + scheduler_->OnUploadComplete(true);
|
| + ASSERT_TRUE(CheckNoPendingUpload());
|
| +}
|
| +
|
| } // namespace domain_reliability
|
|
|