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

Side by Side Diff: components/scheduler/renderer/throttling_helper_unittest.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 11 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/scheduler/renderer/throttling_helper.h" 5 #include "components/scheduler/renderer/throttling_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 11 matching lines...) Expand all
22 using testing::ElementsAre; 22 using testing::ElementsAre;
23 23
24 namespace scheduler { 24 namespace scheduler {
25 25
26 class ThrottlingHelperTest : public testing::Test { 26 class ThrottlingHelperTest : public testing::Test {
27 public: 27 public:
28 ThrottlingHelperTest() {} 28 ThrottlingHelperTest() {}
29 ~ThrottlingHelperTest() override {} 29 ~ThrottlingHelperTest() override {}
30 30
31 void SetUp() override { 31 void SetUp() override {
32 clock_.reset(new base::SimpleTestTickClock()); 32 clock_.reset(new base::SimpleTestTickClock(
33 clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); 33 base::TimeTicks() + base::TimeDelta::FromMicroseconds(5000)));
34 mock_task_runner_ = 34 mock_task_runner_ =
35 make_scoped_refptr(new cc::OrderedSimpleTaskRunner(clock_.get(), true)); 35 make_scoped_refptr(new cc::OrderedSimpleTaskRunner(clock_.get(), true));
36 delegate_ = SchedulerTqmDelegateForTest::Create( 36 delegate_ = SchedulerTqmDelegateForTest::Create(
37 mock_task_runner_, make_scoped_ptr(new TestTimeSource(clock_.get()))); 37 mock_task_runner_, make_scoped_ptr(new TestTimeSource(clock_.get())));
38 scheduler_.reset(new RendererSchedulerImpl(delegate_)); 38 scheduler_.reset(new RendererSchedulerImpl(delegate_));
39 throttling_helper_ = scheduler_->throttling_helper(); 39 throttling_helper_ = scheduler_->throttling_helper();
40 timer_queue_ = scheduler_->NewTimerTaskRunner("test_queue"); 40 timer_queue_ = scheduler_->NewTimerTaskRunner("test_queue");
41 } 41 }
42 42
43 void TearDown() override { 43 void TearDown() override {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 size_t task_count = 0; 223 size_t task_count = 0;
224 mock_task_runner_->RunTasksWhile( 224 mock_task_runner_->RunTasksWhile(
225 base::Bind(&MessageLoopTaskCounter, &task_count)); 225 base::Bind(&MessageLoopTaskCounter, &task_count));
226 226
227 // NOTE PumpThrottledTasks will always run at least twice because we can only 227 // NOTE PumpThrottledTasks will always run at least twice because we can only
228 // detect if the queues have become empty before pumping. 228 // detect if the queues have become empty before pumping.
229 EXPECT_EQ(2u, task_count); 229 EXPECT_EQ(2u, task_count);
230 } 230 }
231 231
232 } // namespace scheduler 232 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/renderer/task_cost_estimator_unittest.cc ('k') | components/scheduler/renderer/user_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698