| 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/scheduler.h" | 5 #include "components/domain_reliability/scheduler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "components/domain_reliability/config.h" | 9 #include "components/domain_reliability/config.h" |
| 10 #include "components/domain_reliability/test_util.h" | 10 #include "components/domain_reliability/test_util.h" |
| 11 #include "components/domain_reliability/util.h" | 11 #include "components/domain_reliability/util.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace domain_reliability { |
| 15 namespace { |
| 16 |
| 14 using base::TimeDelta; | 17 using base::TimeDelta; |
| 15 using base::TimeTicks; | 18 using base::TimeTicks; |
| 16 | 19 |
| 17 namespace domain_reliability { | |
| 18 | |
| 19 class DomainReliabilitySchedulerTest : public testing::Test { | 20 class DomainReliabilitySchedulerTest : public testing::Test { |
| 20 public: | 21 public: |
| 21 DomainReliabilitySchedulerTest() | 22 DomainReliabilitySchedulerTest() |
| 22 : num_collectors_(0), | 23 : num_collectors_(0), |
| 23 params_(CreateDefaultParams()), | 24 params_(CreateDefaultParams()), |
| 24 callback_called_(false) {} | 25 callback_called_(false) {} |
| 25 | 26 |
| 26 void CreateScheduler(int num_collectors) { | 27 void CreateScheduler(int num_collectors) { |
| 27 DCHECK_LT(0, num_collectors); | 28 DCHECK_LT(0, num_collectors); |
| 28 DCHECK(!scheduler_); | 29 DCHECK(!scheduler_); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 scheduler_->OnUploadComplete(false); | 204 scheduler_->OnUploadComplete(false); |
| 204 | 205 |
| 205 ASSERT_TRUE(CheckPendingUpload(zero_delta(), max_delay() - min_delay())); | 206 ASSERT_TRUE(CheckPendingUpload(zero_delta(), max_delay() - min_delay())); |
| 206 time_.Advance(retry_interval()); | 207 time_.Advance(retry_interval()); |
| 207 | 208 |
| 208 // T = min_delay + retry_interval; collector 0 should be active again. | 209 // T = min_delay + retry_interval; collector 0 should be active again. |
| 209 ASSERT_TRUE(CheckStartingUpload(0)); | 210 ASSERT_TRUE(CheckStartingUpload(0)); |
| 210 scheduler_->OnUploadComplete(true); | 211 scheduler_->OnUploadComplete(true); |
| 211 } | 212 } |
| 212 | 213 |
| 214 } // namespace |
| 213 } // namespace domain_reliability | 215 } // namespace domain_reliability |
| OLD | NEW |