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

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

Issue 709333003: Revert of Domain Reliability: Switch to BackoffEntry in Scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@parse_retry_after_header
Patch Set: Created 6 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
« no previous file with comments | « components/domain_reliability/scheduler.cc ('k') | components/domain_reliability/util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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"
(...skipping 17 matching lines...) Expand all
28 DCHECK_LT(0, num_collectors); 28 DCHECK_LT(0, num_collectors);
29 DCHECK(!scheduler_); 29 DCHECK(!scheduler_);
30 30
31 num_collectors_ = num_collectors; 31 num_collectors_ = num_collectors;
32 scheduler_.reset(new DomainReliabilityScheduler( 32 scheduler_.reset(new DomainReliabilityScheduler(
33 &time_, 33 &time_,
34 num_collectors_, 34 num_collectors_,
35 params_, 35 params_,
36 base::Bind(&DomainReliabilitySchedulerTest::ScheduleUploadCallback, 36 base::Bind(&DomainReliabilitySchedulerTest::ScheduleUploadCallback,
37 base::Unretained(this)))); 37 base::Unretained(this))));
38 scheduler_->MakeDeterministicForTesting();
39 } 38 }
40 39
41 ::testing::AssertionResult CheckNoPendingUpload() { 40 ::testing::AssertionResult CheckNoPendingUpload() {
42 DCHECK(scheduler_); 41 DCHECK(scheduler_);
43 42
44 if (!callback_called_) 43 if (!callback_called_)
45 return ::testing::AssertionSuccess(); 44 return ::testing::AssertionSuccess();
46 45
47 return ::testing::AssertionFailure() 46 return ::testing::AssertionFailure()
48 << "expected no upload, got upload between " 47 << "expected no upload, got upload between "
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 ASSERT_TRUE(CheckPendingUpload(min_delay(), max_delay())); 235 ASSERT_TRUE(CheckPendingUpload(min_delay(), max_delay()));
237 236
238 time_.Advance(min_delay()); 237 time_.Advance(min_delay());
239 ASSERT_TRUE(CheckStartingUpload(0)); 238 ASSERT_TRUE(CheckStartingUpload(0));
240 scheduler_->OnUploadComplete(true); 239 scheduler_->OnUploadComplete(true);
241 ASSERT_TRUE(CheckNoPendingUpload()); 240 ASSERT_TRUE(CheckNoPendingUpload());
242 } 241 }
243 242
244 } // namespace 243 } // namespace
245 } // namespace domain_reliability 244 } // namespace domain_reliability
OLDNEW
« no previous file with comments | « components/domain_reliability/scheduler.cc ('k') | components/domain_reliability/util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698