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

Side by Side Diff: content/child/scheduler/scheduler_helper_unittest.cc

Issue 1033643004: Add a WorkerScheduler and a WebThreadImplForWorker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bug where tasks posted to a worker thread did not always run when the thread was shutdown Created 5 years, 8 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 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 "content/child/scheduler/scheduler_helper.h" 5 #include "content/child/scheduler/scheduler_helper.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "cc/test/ordered_simple_task_runner.h" 8 #include "cc/test/ordered_simple_task_runner.h"
9 #include "content/child/scheduler/nestable_task_runner_for_test.h" 9 #include "content/child/scheduler/nestable_task_runner_for_test.h"
10 #include "content/child/scheduler/scheduler_message_loop_delegate.h" 10 #include "content/child/scheduler/scheduler_message_loop_delegate.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 using SchedulerHelper::CanExceedIdleDeadlineIfRequired; 127 using SchedulerHelper::CanExceedIdleDeadlineIfRequired;
128 using SchedulerHelper::EndIdlePeriod; 128 using SchedulerHelper::EndIdlePeriod;
129 using SchedulerHelper::StartIdlePeriod; 129 using SchedulerHelper::StartIdlePeriod;
130 using SchedulerHelper::EnableLongIdlePeriod; 130 using SchedulerHelper::EnableLongIdlePeriod;
131 131
132 // SchedulerHelperDelegate implementation: 132 // SchedulerHelperDelegate implementation:
133 MOCK_METHOD2(CanEnterLongIdlePeriod, 133 MOCK_METHOD2(CanEnterLongIdlePeriod,
134 bool(base::TimeTicks now, 134 bool(base::TimeTicks now,
135 base::TimeDelta* next_long_idle_period_delay_out)); 135 base::TimeDelta* next_long_idle_period_delay_out));
136
137 MOCK_METHOD0(IsNotQuiescent, void());
136 }; 138 };
137 139
138 class BaseSchedulerHelperTest : public testing::Test { 140 class BaseSchedulerHelperTest : public testing::Test {
139 public: 141 public:
140 BaseSchedulerHelperTest( 142 BaseSchedulerHelperTest(
141 base::MessageLoop* message_loop, 143 base::MessageLoop* message_loop,
142 base::TimeDelta required_quiescence_duration_before_long_idle_period) 144 base::TimeDelta required_quiescence_duration_before_long_idle_period)
143 : clock_(cc::TestNowSource::Create(5000)), 145 : clock_(cc::TestNowSource::Create(5000)),
144 mock_task_runner_(message_loop 146 mock_task_runner_(message_loop
145 ? nullptr 147 ? nullptr
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 clock_->Now() + 937 clock_->Now() +
936 base::TimeDelta::FromMilliseconds(kQuiescenceDelayMs + kLongIdlePeriodMs); 938 base::TimeDelta::FromMilliseconds(kQuiescenceDelayMs + kLongIdlePeriodMs);
937 default_task_runner_->PostTask(FROM_HERE, base::Bind(NullTask)); 939 default_task_runner_->PostTask(FROM_HERE, base::Bind(NullTask));
938 RunUntilIdle(); 940 RunUntilIdle();
939 941
940 EXPECT_EQ(1, run_count); 942 EXPECT_EQ(1, run_count);
941 EXPECT_EQ(expected_deadline, deadline_in_task); 943 EXPECT_EQ(expected_deadline, deadline_in_task);
942 } 944 }
943 945
944 } // namespace content 946 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698