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

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

Issue 1320633002: Optimize for TouchStart responsiveness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + remove some unwanted changes Created 5 years, 3 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 "components/scheduler/renderer/renderer_scheduler_impl.h" 5 #include "components/scheduler/renderer/renderer_scheduler_impl.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/test/simple_test_tick_clock.h" 8 #include "base/test/simple_test_tick_clock.h"
9 #include "cc/output/begin_frame_args.h" 9 #include "cc/output/begin_frame_args.h"
10 #include "cc/test/ordered_simple_task_runner.h" 10 #include "cc/test/ordered_simple_task_runner.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 *should_yield_before = scheduler->ShouldYieldForHighPriorityWork(); 119 *should_yield_before = scheduler->ShouldYieldForHighPriorityWork();
120 task_runner->PostTask(FROM_HERE, base::Bind(NullTask)); 120 task_runner->PostTask(FROM_HERE, base::Bind(NullTask));
121 if (simulate_input) { 121 if (simulate_input) {
122 scheduler->DidHandleInputEventOnCompositorThread( 122 scheduler->DidHandleInputEventOnCompositorThread(
123 FakeInputEvent(blink::WebInputEvent::GestureFlingStart), 123 FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
124 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); 124 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
125 } 125 }
126 *should_yield_after = scheduler->ShouldYieldForHighPriorityWork(); 126 *should_yield_after = scheduler->ShouldYieldForHighPriorityWork();
127 } 127 }
128 128
129 enum class SimulateInputType { None, TouchStart, TouchEnd };
130
129 void AnticipationTestTask(RendererSchedulerImpl* scheduler, 131 void AnticipationTestTask(RendererSchedulerImpl* scheduler,
130 bool simulate_input, 132 SimulateInputType simulate_input,
131 bool* is_anticipated_before, 133 bool* is_anticipated_before,
132 bool* is_anticipated_after) { 134 bool* is_anticipated_after) {
133 *is_anticipated_before = scheduler->IsHighPriorityWorkAnticipated(); 135 *is_anticipated_before = scheduler->IsHighPriorityWorkAnticipated();
134 if (simulate_input) { 136 switch (simulate_input) {
135 scheduler->DidHandleInputEventOnCompositorThread( 137 case SimulateInputType::None:
136 FakeInputEvent(blink::WebInputEvent::GestureFlingStart), 138 break;
137 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); 139
140 case SimulateInputType::TouchStart:
141 scheduler->DidHandleInputEventOnCompositorThread(
142 FakeInputEvent(blink::WebInputEvent::TouchStart),
143 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
144 break;
145
146 case SimulateInputType::TouchEnd:
147 scheduler->DidHandleInputEventOnCompositorThread(
148 FakeInputEvent(blink::WebInputEvent::TouchEnd),
149 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
150 break;
138 } 151 }
139 *is_anticipated_after = scheduler->IsHighPriorityWorkAnticipated(); 152 *is_anticipated_after = scheduler->IsHighPriorityWorkAnticipated();
140 } 153 }
141 154
142 }; // namespace 155 }; // namespace
143 156
144 class RendererSchedulerImplForTest : public RendererSchedulerImpl { 157 class RendererSchedulerImplForTest : public RendererSchedulerImpl {
145 public: 158 public:
146 using RendererSchedulerImpl::OnIdlePeriodEnded; 159 using RendererSchedulerImpl::OnIdlePeriodEnded;
147 using RendererSchedulerImpl::OnIdlePeriodStarted; 160 using RendererSchedulerImpl::OnIdlePeriodStarted;
148 using RendererSchedulerImpl::Policy; 161 using RendererSchedulerImpl::UseCase;
149 using RendererSchedulerImpl::PolicyToString; 162 using RendererSchedulerImpl::UseCaseToString;
150 163
151 RendererSchedulerImplForTest( 164 RendererSchedulerImplForTest(
152 scoped_refptr<SchedulerTaskRunnerDelegate> main_task_runner) 165 scoped_refptr<SchedulerTaskRunnerDelegate> main_task_runner)
153 : RendererSchedulerImpl(main_task_runner), update_policy_count_(0) {} 166 : RendererSchedulerImpl(main_task_runner), update_policy_count_(0) {}
154 167
155 void UpdatePolicyLocked(UpdateType update_type) override { 168 void UpdatePolicyLocked(UpdateType update_type) override {
156 update_policy_count_++; 169 update_policy_count_++;
157 RendererSchedulerImpl::UpdatePolicyLocked(update_type); 170 RendererSchedulerImpl::UpdatePolicyLocked(update_type);
171
172 std::string use_case = RendererSchedulerImplForTest::UseCaseToString(
173 MainThreadOnly().current_use_case_);
174 if (MainThreadOnly().scroll_expected_soon_) {
175 use_cases_.push_back(use_case + " scroll expected");
176 } else {
177 use_cases_.push_back(use_case);
178 }
158 } 179 }
159 180
160 void EnsureUrgentPolicyUpdatePostedOnMainThread() { 181 void EnsureUrgentPolicyUpdatePostedOnMainThread() {
161 base::AutoLock lock(any_thread_lock_); 182 base::AutoLock lock(any_thread_lock_);
162 RendererSchedulerImpl::EnsureUrgentPolicyUpdatePostedOnMainThread( 183 RendererSchedulerImpl::EnsureUrgentPolicyUpdatePostedOnMainThread(
163 FROM_HERE); 184 FROM_HERE);
164 } 185 }
165 186
166 void ScheduleDelayedPolicyUpdate(base::TimeTicks now, base::TimeDelta delay) { 187 void ScheduleDelayedPolicyUpdate(base::TimeTicks now, base::TimeDelta delay) {
167 delayed_update_policy_runner_.SetDeadline(FROM_HERE, delay, now); 188 delayed_update_policy_runner_.SetDeadline(FROM_HERE, delay, now);
168 } 189 }
169 190
170 bool BeginMainFrameOnCriticalPath() { 191 bool BeginMainFrameOnCriticalPath() {
171 base::AutoLock lock(any_thread_lock_); 192 base::AutoLock lock(any_thread_lock_);
172 return AnyThread().begin_main_frame_on_critical_path_; 193 return AnyThread().begin_main_frame_on_critical_path_;
173 } 194 }
174 195
175 int update_policy_count_; 196 int update_policy_count_;
197 std::vector<std::string> use_cases_;
176 }; 198 };
177 199
178 // Lets gtest print human readable Policy values. 200 // Lets gtest print human readable Policy values.
179 ::std::ostream& operator<<(::std::ostream& os, 201 ::std::ostream& operator<<(
180 const RendererSchedulerImplForTest::Policy& policy) { 202 ::std::ostream& os,
181 return os << RendererSchedulerImplForTest::PolicyToString(policy); 203 const RendererSchedulerImplForTest::UseCase& use_case) {
204 return os << RendererSchedulerImplForTest::UseCaseToString(use_case);
182 } 205 }
183 206
184 class RendererSchedulerImplTest : public testing::Test { 207 class RendererSchedulerImplTest : public testing::Test {
185 public: 208 public:
186 using Policy = RendererSchedulerImpl::Policy; 209 using UseCase = RendererSchedulerImpl::UseCase;
187 210
188 RendererSchedulerImplTest() : clock_(new base::SimpleTestTickClock()) { 211 RendererSchedulerImplTest() : clock_(new base::SimpleTestTickClock()) {
189 clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); 212 clock_->Advance(base::TimeDelta::FromMicroseconds(5000));
190 } 213 }
191 214
192 RendererSchedulerImplTest(base::MessageLoop* message_loop) 215 RendererSchedulerImplTest(base::MessageLoop* message_loop)
193 : clock_(new base::SimpleTestTickClock()), message_loop_(message_loop) { 216 : clock_(new base::SimpleTestTickClock()), message_loop_(message_loop) {
194 clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); 217 clock_->Advance(base::TimeDelta::FromMicroseconds(5000));
195 } 218 }
196 219
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 message_loop_->RunUntilIdle(); 271 message_loop_->RunUntilIdle();
249 } 272 }
250 273
251 void DoMainFrame() { 274 void DoMainFrame() {
252 scheduler_->WillBeginFrame(cc::BeginFrameArgs::Create( 275 scheduler_->WillBeginFrame(cc::BeginFrameArgs::Create(
253 BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(), 276 BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
254 base::TimeDelta::FromMilliseconds(1000), cc::BeginFrameArgs::NORMAL)); 277 base::TimeDelta::FromMilliseconds(1000), cc::BeginFrameArgs::NORMAL));
255 scheduler_->DidCommitFrameToCompositor(); 278 scheduler_->DidCommitFrameToCompositor();
256 } 279 }
257 280
281 void ForceMainthreadScrollingUseCase() {
282 cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create(
283 BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
284 base::TimeDelta::FromMilliseconds(1000), cc::BeginFrameArgs::NORMAL);
285 begin_frame_args.on_critical_path = true;
286 scheduler_->WillBeginFrame(begin_frame_args);
287 }
288
258 void EnableIdleTasks() { DoMainFrame(); } 289 void EnableIdleTasks() { DoMainFrame(); }
259 290
260 Policy CurrentPolicy() { 291 UseCase CurrentUseCase() {
261 return scheduler_->MainThreadOnly().current_policy_; 292 return scheduler_->MainThreadOnly().current_use_case_;
293 }
294
295 UseCase ForceUpdatePolicyAndGetCurrentUseCase() {
296 scheduler_->ForceUpdatePolicy();
297 return scheduler_->MainThreadOnly().current_use_case_;
298 }
299
300 bool ScrollExpectedSoon() {
301 return scheduler_->MainThreadOnly().scroll_expected_soon_;
262 } 302 }
263 303
264 // Helper for posting several tasks of specific types. |task_descriptor| is a 304 // Helper for posting several tasks of specific types. |task_descriptor| is a
265 // string with space delimited task identifiers. The first letter of each 305 // string with space delimited task identifiers. The first letter of each
266 // task identifier specifies the task type: 306 // task identifier specifies the task type:
267 // - 'D': Default task 307 // - 'D': Default task
268 // - 'C': Compositor task 308 // - 'C': Compositor task
269 // - 'L': Loading task 309 // - 'L': Loading task
270 // - 'I': Idle task 310 // - 'I': Idle task
271 // - 'T': Timer task 311 // - 'T': Timer task
(...skipping 30 matching lines...) Expand all
302 } 342 }
303 } 343 }
304 } 344 }
305 345
306 protected: 346 protected:
307 static base::TimeDelta priority_escalation_after_input_duration() { 347 static base::TimeDelta priority_escalation_after_input_duration() {
308 return base::TimeDelta::FromMilliseconds( 348 return base::TimeDelta::FromMilliseconds(
309 RendererSchedulerImpl::kPriorityEscalationAfterInputMillis); 349 RendererSchedulerImpl::kPriorityEscalationAfterInputMillis);
310 } 350 }
311 351
352 static base::TimeDelta subsequent_input_expected_after_input_duration() {
353 return base::TimeDelta::FromMilliseconds(
354 RendererSchedulerImpl::kExpectSubsequentInputMillis);
355 }
356
312 static base::TimeDelta maximum_idle_period_duration() { 357 static base::TimeDelta maximum_idle_period_duration() {
313 return base::TimeDelta::FromMilliseconds( 358 return base::TimeDelta::FromMilliseconds(
314 IdleHelper::kMaximumIdlePeriodMillis); 359 IdleHelper::kMaximumIdlePeriodMillis);
315 } 360 }
316 361
317 static base::TimeDelta end_idle_when_hidden_delay() { 362 static base::TimeDelta end_idle_when_hidden_delay() {
318 return base::TimeDelta::FromMilliseconds( 363 return base::TimeDelta::FromMilliseconds(
319 RendererSchedulerImpl::kEndIdleWhenHiddenDelayMillis); 364 RendererSchedulerImpl::kEndIdleWhenHiddenDelayMillis);
320 } 365 }
321 366
322 static base::TimeDelta idle_period_starvation_threshold() { 367 static base::TimeDelta idle_period_starvation_threshold() {
323 return base::TimeDelta::FromMilliseconds( 368 return base::TimeDelta::FromMilliseconds(
324 RendererSchedulerImpl::kIdlePeriodStarvationThresholdMillis); 369 RendererSchedulerImpl::kIdlePeriodStarvationThresholdMillis);
325 } 370 }
326 371
327 template <typename E> 372 template <typename E>
328 static void CallForEachEnumValue(E first, 373 static void CallForEachEnumValue(E first,
329 E last, 374 E last,
330 const char* (*function)(E)) { 375 const char* (*function)(E)) {
331 for (E val = first; val < last; 376 for (E val = first; val < last;
332 val = static_cast<E>(static_cast<int>(val) + 1)) { 377 val = static_cast<E>(static_cast<int>(val) + 1)) {
333 (*function)(val); 378 (*function)(val);
334 } 379 }
335 } 380 }
336 381
337 static void CheckAllPolicyToString() { 382 static void CheckAllUseCaseToString() {
338 CallForEachEnumValue<RendererSchedulerImpl::Policy>( 383 CallForEachEnumValue<RendererSchedulerImpl::UseCase>(
339 RendererSchedulerImpl::Policy::FIRST_POLICY, 384 RendererSchedulerImpl::UseCase::FIRST_USE_CASE,
340 RendererSchedulerImpl::Policy::POLICY_COUNT, 385 RendererSchedulerImpl::UseCase::USE_CASE_COUNT,
341 &RendererSchedulerImpl::PolicyToString); 386 &RendererSchedulerImpl::UseCaseToString);
342 } 387 }
343 388
344 scoped_ptr<base::SimpleTestTickClock> clock_; 389 scoped_ptr<base::SimpleTestTickClock> clock_;
345 // Only one of mock_task_runner_ or message_loop_ will be set. 390 // Only one of mock_task_runner_ or message_loop_ will be set.
346 scoped_refptr<cc::OrderedSimpleTaskRunner> mock_task_runner_; 391 scoped_refptr<cc::OrderedSimpleTaskRunner> mock_task_runner_;
347 scoped_ptr<base::MessageLoop> message_loop_; 392 scoped_ptr<base::MessageLoop> message_loop_;
348 393
349 scoped_refptr<SchedulerTaskRunnerDelegate> main_task_runner_; 394 scoped_refptr<SchedulerTaskRunnerDelegate> main_task_runner_;
350 scoped_ptr<RendererSchedulerImplForTest> scheduler_; 395 scoped_ptr<RendererSchedulerImplForTest> scheduler_;
351 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_; 396 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 FROM_HERE, base::Bind(&base::SimpleTestTickClock::Advance, 675 FROM_HERE, base::Bind(&base::SimpleTestTickClock::Advance,
631 base::Unretained(clock_.get()), 676 base::Unretained(clock_.get()),
632 base::TimeDelta::FromMilliseconds(500))); 677 base::TimeDelta::FromMilliseconds(500)));
633 } 678 }
634 RunUntilIdle(); 679 RunUntilIdle();
635 680
636 // Timers should now be disabled during main thread user userinteractions. 681 // Timers should now be disabled during main thread user userinteractions.
637 PostTestTasks(&run_order, "C1 T1"); 682 PostTestTasks(&run_order, "C1 T1");
638 683
639 scheduler_->DidAnimateForInputOnCompositorThread(); 684 scheduler_->DidAnimateForInputOnCompositorThread();
640 scheduler_->WillBeginFrame(cc::BeginFrameArgs::Create( 685 cc::BeginFrameArgs begin_frame_args1 = cc::BeginFrameArgs::Create(
641 BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(), 686 BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
642 base::TimeDelta::FromMilliseconds(16), cc::BeginFrameArgs::NORMAL)); 687 base::TimeDelta::FromMilliseconds(1000), cc::BeginFrameArgs::NORMAL);
688 begin_frame_args1.on_critical_path = true;
689 scheduler_->WillBeginFrame(begin_frame_args1);
690 scheduler_->DidCommitFrameToCompositor(); // Starts Idle Period
643 RunUntilIdle(); 691 RunUntilIdle();
644 692
645 EXPECT_THAT(run_order, testing::ElementsAre(std::string("C1"))); 693 EXPECT_THAT(run_order, testing::ElementsAre(std::string("C1")));
646 clock_->Advance(priority_escalation_after_input_duration() * 2); 694 clock_->Advance(priority_escalation_after_input_duration() * 2);
647 695
648 run_order.clear(); 696 run_order.clear();
649 RunUntilIdle(); 697 RunUntilIdle();
650 EXPECT_THAT(run_order, testing::ElementsAre(std::string("T1"))); 698 EXPECT_THAT(run_order, testing::ElementsAre(std::string("T1")));
651 } 699 }
652 700
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 FakeInputEvent(blink::WebInputEvent::GestureScrollBegin)); 834 FakeInputEvent(blink::WebInputEvent::GestureScrollBegin));
787 RunUntilIdle(); 835 RunUntilIdle();
788 836
789 EXPECT_THAT(run_order, 837 EXPECT_THAT(run_order,
790 testing::ElementsAre(std::string("L1"), std::string("T1"), 838 testing::ElementsAre(std::string("L1"), std::string("T1"),
791 std::string("T2"))); 839 std::string("T2")));
792 } 840 }
793 841
794 TEST_F(RendererSchedulerImplTest, LoadingPriorityPolicy) { 842 TEST_F(RendererSchedulerImplTest, LoadingPriorityPolicy) {
795 std::vector<std::string> run_order; 843 std::vector<std::string> run_order;
796 PostTestTasks(&run_order, "L1 I1 D1 C1 D2 C2"); 844 PostTestTasks(&run_order, "I1 D1 C1 T1 L1 D2 C2 T2 L2");
797 845
798 scheduler_->OnPageLoadStarted(); 846 scheduler_->OnPageLoadStarted();
799 EnableIdleTasks(); 847 EnableIdleTasks();
800 RunUntilIdle(); 848 RunUntilIdle();
801 // In loading policy compositor tasks are best effort and should be run last. 849
802 EXPECT_THAT(run_order, 850 // In loading policy, loading and timer tasks are prioritized other others.
803 testing::ElementsAre(std::string("L1"), std::string("D1"), 851 std::string loading_policy_expected[] = {
804 std::string("D2"), std::string("I1"), 852 std::string("T1"), std::string("L1"), std::string("T2"),
805 std::string("C1"), std::string("C2"))); 853 std::string("L2"), std::string("D1"), std::string("C1"),
854 std::string("D2"), std::string("C2"), std::string("I1")};
855 EXPECT_THAT(run_order, testing::ElementsAreArray(loading_policy_expected));
806 856
807 // Advance 1.5s and try again, the loading policy should have ended and the 857 // Advance 1.5s and try again, the loading policy should have ended and the
808 // task order should return to normal. 858 // task order should return to the NOT_SCROLLING use case where loading tasks
859 // are prioritized.
809 clock_->Advance(base::TimeDelta::FromMilliseconds(1500)); 860 clock_->Advance(base::TimeDelta::FromMilliseconds(1500));
810 run_order.clear(); 861 run_order.clear();
811 PostTestTasks(&run_order, "L1 I1 D1 C1 D2 C2"); 862 PostTestTasks(&run_order, "I1 D1 C1 T1 L1 D2 C2 T2 L2");
812 EnableIdleTasks(); 863 EnableIdleTasks();
813 RunUntilIdle(); 864 RunUntilIdle();
814 EXPECT_THAT(run_order, 865 std::string default_order_expected[] = {
815 testing::ElementsAre(std::string("L1"), std::string("D1"), 866 std::string("L1"), std::string("L2"), std::string("D1"),
816 std::string("C1"), std::string("D2"), 867 std::string("C1"), std::string("T1"), std::string("D2"),
817 std::string("C2"), std::string("I1"))); 868 std::string("C2"), std::string("T2"), std::string("I1")};
869 EXPECT_THAT(run_order, testing::ElementsAreArray(default_order_expected));
818 } 870 }
819 871
820 TEST_F(RendererSchedulerImplTest, 872 TEST_F(RendererSchedulerImplTest,
821 EventConsumedOnCompositorThread_IgnoresMouseMove_WhenMouseUp) { 873 EventConsumedOnCompositorThread_IgnoresMouseMove_WhenMouseUp) {
822 std::vector<std::string> run_order; 874 std::vector<std::string> run_order;
823 PostTestTasks(&run_order, "I1 D1 C1 D2 C2"); 875 PostTestTasks(&run_order, "I1 D1 C1 D2 C2");
824 876
825 scheduler_->DidHandleInputEventOnCompositorThread( 877 scheduler_->DidHandleInputEventOnCompositorThread(
826 FakeInputEvent(blink::WebInputEvent::MouseMove), 878 FakeInputEvent(blink::WebInputEvent::MouseMove),
827 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); 879 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 // Note compositor tasks are not prioritized. 1007 // Note compositor tasks are not prioritized.
956 EXPECT_THAT(run_order, 1008 EXPECT_THAT(run_order,
957 testing::ElementsAre(std::string("D1"), std::string("C1"), 1009 testing::ElementsAre(std::string("D1"), std::string("C1"),
958 std::string("D2"), std::string("C2"), 1010 std::string("D2"), std::string("C2"),
959 std::string("I1"))); 1011 std::string("I1")));
960 scheduler_->DidHandleInputEventOnMainThread( 1012 scheduler_->DidHandleInputEventOnMainThread(
961 FakeInputEvent(blink::WebInputEvent::KeyDown)); 1013 FakeInputEvent(blink::WebInputEvent::KeyDown));
962 } 1014 }
963 1015
964 TEST_F(RendererSchedulerImplTest, 1016 TEST_F(RendererSchedulerImplTest,
965 TestCompositorPolicyDoesNotStarveDefaultTasks) { 1017 TestMainthreadScrollingUseCaseDoesNotStarveDefaultTasks) {
1018 ForceMainthreadScrollingUseCase();
1019
966 std::vector<std::string> run_order; 1020 std::vector<std::string> run_order;
967 PostTestTasks(&run_order, "D1 C1"); 1021 PostTestTasks(&run_order, "D1 C1");
968 1022
969 for (int i = 0; i < 20; i++) { 1023 for (int i = 0; i < 20; i++) {
970 compositor_task_runner_->PostTask(FROM_HERE, base::Bind(&NullTask)); 1024 compositor_task_runner_->PostTask(FROM_HERE, base::Bind(&NullTask));
971 } 1025 }
972 PostTestTasks(&run_order, "C2"); 1026 PostTestTasks(&run_order, "C2");
973 1027
974 scheduler_->DidHandleInputEventOnCompositorThread( 1028 scheduler_->DidHandleInputEventOnCompositorThread(
975 FakeInputEvent(blink::WebInputEvent::GestureFlingStart), 1029 FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
976 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); 1030 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
977 RunUntilIdle(); 1031 RunUntilIdle();
978 // Ensure that the default D1 task gets to run at some point before the final 1032 // Ensure that the default D1 task gets to run at some point before the final
979 // C2 compositor task. 1033 // C2 compositor task.
980 EXPECT_THAT(run_order, 1034 EXPECT_THAT(run_order,
981 testing::ElementsAre(std::string("C1"), std::string("D1"), 1035 testing::ElementsAre(std::string("C1"), std::string("D1"),
982 std::string("C2"))); 1036 std::string("C2")));
983 } 1037 }
984 1038
985 TEST_F(RendererSchedulerImplTest, 1039 TEST_F(RendererSchedulerImplTest,
986 TestCompositorPolicyEnds_CompositorHandlesInput) { 1040 TestCompositorPolicyEnds_CompositorHandlesInput) {
987 std::vector<std::string> run_order;
988 PostTestTasks(&run_order, "D1 C1 D2 C2");
989
990 scheduler_->DidHandleInputEventOnCompositorThread( 1041 scheduler_->DidHandleInputEventOnCompositorThread(
991 FakeInputEvent(blink::WebInputEvent::GestureFlingStart), 1042 FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
992 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); 1043 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
993 RunUntilIdle(); 1044 EXPECT_EQ(UseCase::COMPOSITOR_SCROLLING,
994 EXPECT_THAT(run_order, 1045 ForceUpdatePolicyAndGetCurrentUseCase());
995 testing::ElementsAre(std::string("C1"), std::string("C2"),
996 std::string("D1"), std::string("D2")));
997 1046
998 run_order.clear();
999 clock_->Advance(base::TimeDelta::FromMilliseconds(1000)); 1047 clock_->Advance(base::TimeDelta::FromMilliseconds(1000));
1000 PostTestTasks(&run_order, "D1 C1 D2 C2"); 1048 EXPECT_EQ(UseCase::NOT_SCROLLING, ForceUpdatePolicyAndGetCurrentUseCase());
1001
1002 // Compositor policy mode should have ended now that the clock has advanced.
1003 RunUntilIdle();
1004 EXPECT_THAT(run_order,
1005 testing::ElementsAre(std::string("D1"), std::string("C1"),
1006 std::string("D2"), std::string("C2")));
1007 } 1049 }
1008 1050
1009 TEST_F(RendererSchedulerImplTest, 1051 TEST_F(RendererSchedulerImplTest,
1010 TestCompositorPolicyEnds_MainThreadHandlesInput) { 1052 TestCompositorPolicyEnds_MainThreadHandlesInput) {
1011 std::vector<std::string> run_order;
1012 PostTestTasks(&run_order, "D1 C1 D2 C2");
1013
1014 scheduler_->DidHandleInputEventOnCompositorThread( 1053 scheduler_->DidHandleInputEventOnCompositorThread(
1015 FakeInputEvent(blink::WebInputEvent::GestureFlingStart), 1054 FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
1016 RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD); 1055 RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
1017 scheduler_->DidHandleInputEventOnMainThread( 1056 scheduler_->DidHandleInputEventOnMainThread(
1018 FakeInputEvent(blink::WebInputEvent::GestureFlingStart)); 1057 FakeInputEvent(blink::WebInputEvent::GestureFlingStart));
1019 RunUntilIdle(); 1058 EXPECT_EQ(UseCase::COMPOSITOR_SCROLLING,
1020 EXPECT_THAT(run_order, 1059 ForceUpdatePolicyAndGetCurrentUseCase());
1021 testing::ElementsAre(std::string("C1"), std::string("C2"),
1022 std::string("D1"), std::string("D2")));
1023 1060
1024 run_order.clear();
1025 clock_->Advance(base::TimeDelta::FromMilliseconds(1000)); 1061 clock_->Advance(base::TimeDelta::FromMilliseconds(1000));
1026 PostTestTasks(&run_order, "D1 C1 D2 C2"); 1062 EXPECT_EQ(UseCase::NOT_SCROLLING, ForceUpdatePolicyAndGetCurrentUseCase());
1027
1028 // Compositor policy mode should have ended now that the clock has advanced.
1029 RunUntilIdle();
1030 EXPECT_THAT(run_order,
1031 testing::ElementsAre(std::string("D1"), std::string("C1"),
1032 std::string("D2"), std::string("C2")));
1033 } 1063 }
1034 1064
1035 TEST_F(RendererSchedulerImplTest, TestTouchstartPolicyEndsAfterTimeout) { 1065 TEST_F(RendererSchedulerImplTest, TestTouchstartPolicyEndsAfterTimeout) {
1036 std::vector<std::string> run_order; 1066 std::vector<std::string> run_order;
1037 PostTestTasks(&run_order, "L1 D1 C1 D2 C2"); 1067 PostTestTasks(&run_order, "L1 D1 C1 D2 C2");
1038 1068
1039 scheduler_->DidHandleInputEventOnCompositorThread( 1069 scheduler_->DidHandleInputEventOnCompositorThread(
1040 FakeInputEvent(blink::WebInputEvent::TouchStart), 1070 FakeInputEvent(blink::WebInputEvent::TouchStart),
1041 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); 1071 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
1042 RunUntilIdle(); 1072 RunUntilIdle();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 FakeInputEvent(blink::WebInputEvent::TouchMove), 1116 FakeInputEvent(blink::WebInputEvent::TouchMove),
1087 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); 1117 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
1088 RunUntilIdle(); 1118 RunUntilIdle();
1089 EXPECT_THAT(run_order, testing::ElementsAre(std::string("L1"))); 1119 EXPECT_THAT(run_order, testing::ElementsAre(std::string("L1")));
1090 } 1120 }
1091 1121
1092 TEST_F(RendererSchedulerImplTest, TestIsHighPriorityWorkAnticipated) { 1122 TEST_F(RendererSchedulerImplTest, TestIsHighPriorityWorkAnticipated) {
1093 bool is_anticipated_before = false; 1123 bool is_anticipated_before = false;
1094 bool is_anticipated_after = false; 1124 bool is_anticipated_after = false;
1095 1125
1096 bool simulate_input = false;
1097 default_task_runner_->PostTask( 1126 default_task_runner_->PostTask(
1098 FROM_HERE, 1127 FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
1099 base::Bind(&AnticipationTestTask, scheduler_.get(), simulate_input, 1128 SimulateInputType::None, &is_anticipated_before,
1100 &is_anticipated_before, &is_anticipated_after)); 1129 &is_anticipated_after));
1101 RunUntilIdle(); 1130 RunUntilIdle();
1102 // In its default state, without input receipt, the scheduler should indicate 1131 // In its default state, without input receipt, the scheduler should indicate
1103 // that no high-priority is anticipated. 1132 // that no high-priority is anticipated.
1104 EXPECT_FALSE(is_anticipated_before); 1133 EXPECT_FALSE(is_anticipated_before);
1105 EXPECT_FALSE(is_anticipated_after); 1134 EXPECT_FALSE(is_anticipated_after);
1106 1135
1107 simulate_input = true;
1108 default_task_runner_->PostTask( 1136 default_task_runner_->PostTask(
1109 FROM_HERE, 1137 FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
1110 base::Bind(&AnticipationTestTask, scheduler_.get(), simulate_input, 1138 SimulateInputType::TouchStart,
1111 &is_anticipated_before, &is_anticipated_after)); 1139 &is_anticipated_before, &is_anticipated_after));
1140 bool dummy;
1141 default_task_runner_->PostTask(
1142 FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
1143 SimulateInputType::TouchEnd, &dummy, &dummy));
1144
1112 RunUntilIdle(); 1145 RunUntilIdle();
1113 // When input is received, the scheduler should indicate that high-priority 1146 // When input is received, the scheduler should indicate that high-priority
1114 // work is anticipated. 1147 // work is anticipated.
1115 EXPECT_FALSE(is_anticipated_before); 1148 EXPECT_FALSE(is_anticipated_before);
1116 EXPECT_TRUE(is_anticipated_after); 1149 EXPECT_TRUE(is_anticipated_after);
1117 1150
1118 clock_->Advance(priority_escalation_after_input_duration() * 2); 1151 clock_->Advance(priority_escalation_after_input_duration() * 2);
1119 simulate_input = false;
1120 default_task_runner_->PostTask( 1152 default_task_runner_->PostTask(
1121 FROM_HERE, 1153 FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
1122 base::Bind(&AnticipationTestTask, scheduler_.get(), simulate_input, 1154 SimulateInputType::None, &is_anticipated_before,
1123 &is_anticipated_before, &is_anticipated_after)); 1155 &is_anticipated_after));
1124 RunUntilIdle(); 1156 RunUntilIdle();
1125 // Without additional input, the scheduler should indicate that high-priority 1157 // Without additional input, the scheduler should go into NOT_SCROLLING
1126 // work is no longer anticipated. 1158 // use case but with scrolling expected where high-priority work is still
1159 // anticipated.
1160 EXPECT_EQ(UseCase::NOT_SCROLLING, CurrentUseCase());
1161 EXPECT_TRUE(ScrollExpectedSoon());
1162 EXPECT_TRUE(is_anticipated_before);
1163 EXPECT_TRUE(is_anticipated_after);
1164
1165 clock_->Advance(subsequent_input_expected_after_input_duration() * 2);
1166 default_task_runner_->PostTask(
1167 FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
1168 SimulateInputType::None, &is_anticipated_before,
1169 &is_anticipated_after));
1170 RunUntilIdle();
1171 // Eventually the scheduler should go into the default use case where
1172 // high-priority work is no longer anticipated.
1173 EXPECT_EQ(UseCase::NOT_SCROLLING, CurrentUseCase());
1174 EXPECT_FALSE(ScrollExpectedSoon());
1127 EXPECT_FALSE(is_anticipated_before); 1175 EXPECT_FALSE(is_anticipated_before);
1128 EXPECT_FALSE(is_anticipated_after); 1176 EXPECT_FALSE(is_anticipated_after);
1129 } 1177 }
1130 1178
1131 TEST_F(RendererSchedulerImplTest, TestShouldYield) { 1179 TEST_F(RendererSchedulerImplTest, TestShouldYield) {
1132 bool should_yield_before = false; 1180 bool should_yield_before = false;
1133 bool should_yield_after = false; 1181 bool should_yield_after = false;
1134 1182
1183 ForceMainthreadScrollingUseCase();
1184
1135 default_task_runner_->PostTask( 1185 default_task_runner_->PostTask(
1136 FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(), 1186 FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(),
1137 default_task_runner_, false, &should_yield_before, 1187 default_task_runner_, false, &should_yield_before,
1138 &should_yield_after)); 1188 &should_yield_after));
1139 RunUntilIdle(); 1189 RunUntilIdle();
1140 // Posting to default runner shouldn't cause yielding. 1190 // Posting to default runner shouldn't cause yielding.
1141 EXPECT_FALSE(should_yield_before); 1191 EXPECT_FALSE(should_yield_before);
1142 EXPECT_FALSE(should_yield_after); 1192 EXPECT_FALSE(should_yield_after);
1143 1193
1144 default_task_runner_->PostTask( 1194 default_task_runner_->PostTask(
1145 FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(), 1195 FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(),
1146 compositor_task_runner_, false, 1196 compositor_task_runner_, false,
1147 &should_yield_before, &should_yield_after)); 1197 &should_yield_before, &should_yield_after));
1148 RunUntilIdle(); 1198 RunUntilIdle();
1149 // Posting while not in compositor priority shouldn't cause yielding. 1199 // Posting while not mainthread scrolling shouldn't cause yielding.
1150 EXPECT_FALSE(should_yield_before); 1200 EXPECT_FALSE(should_yield_before);
1151 EXPECT_FALSE(should_yield_after); 1201 EXPECT_FALSE(should_yield_after);
1152 1202
1153 default_task_runner_->PostTask( 1203 default_task_runner_->PostTask(
1154 FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(), 1204 FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(),
1155 compositor_task_runner_, true, &should_yield_before, 1205 compositor_task_runner_, true, &should_yield_before,
1156 &should_yield_after)); 1206 &should_yield_after));
1157 RunUntilIdle(); 1207 RunUntilIdle();
1158 // We should be able to switch to compositor priority mid-task. 1208 // We should be able to switch to compositor priority mid-task.
1159 EXPECT_FALSE(should_yield_before); 1209 EXPECT_FALSE(should_yield_before);
1160 EXPECT_TRUE(should_yield_after); 1210 EXPECT_TRUE(should_yield_after);
1161 1211
1162 // Receiving a touchstart should immediately trigger yielding, even if 1212 // Receiving a touchstart should immediately trigger yielding, even if
1163 // there's no immediately pending work in the compositor queue. 1213 // there's no immediately pending work in the compositor queue.
1164 EXPECT_FALSE(scheduler_->ShouldYieldForHighPriorityWork()); 1214 EXPECT_FALSE(scheduler_->ShouldYieldForHighPriorityWork());
1165 scheduler_->DidHandleInputEventOnCompositorThread( 1215 scheduler_->DidHandleInputEventOnCompositorThread(
1166 FakeInputEvent(blink::WebInputEvent::TouchStart), 1216 FakeInputEvent(blink::WebInputEvent::TouchStart),
1167 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); 1217 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
1168 EXPECT_TRUE(scheduler_->ShouldYieldForHighPriorityWork()); 1218 EXPECT_TRUE(scheduler_->ShouldYieldForHighPriorityWork());
1169 RunUntilIdle(); 1219 RunUntilIdle();
1170 } 1220 }
1171 1221
1172 TEST_F(RendererSchedulerImplTest, SlowMainThreadInputEvent) { 1222 TEST_F(RendererSchedulerImplTest, SlowMainThreadInputEvent) {
1173 EXPECT_EQ(Policy::NORMAL, CurrentPolicy()); 1223 EXPECT_EQ(UseCase::NOT_SCROLLING, CurrentUseCase());
1174 1224
1175 // An input event should bump us into input priority. 1225 // An input event should bump us into input priority.
1176 scheduler_->DidHandleInputEventOnCompositorThread( 1226 scheduler_->DidHandleInputEventOnCompositorThread(
1177 FakeInputEvent(blink::WebInputEvent::GestureFlingStart), 1227 FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
1178 RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD); 1228 RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
1179 RunUntilIdle(); 1229 RunUntilIdle();
1180 EXPECT_EQ(Policy::COMPOSITOR_PRIORITY, CurrentPolicy()); 1230 EXPECT_EQ(UseCase::COMPOSITOR_SCROLLING, CurrentUseCase());
1181 1231
1182 // Simulate the input event being queued for a very long time. The compositor 1232 // Simulate the input event being queued for a very long time. The compositor
1183 // task we post here represents the enqueued input task. 1233 // task we post here represents the enqueued input task.
1184 clock_->Advance(priority_escalation_after_input_duration() * 2); 1234 clock_->Advance(priority_escalation_after_input_duration() * 2);
1185 scheduler_->DidHandleInputEventOnMainThread( 1235 scheduler_->DidHandleInputEventOnMainThread(
1186 FakeInputEvent(blink::WebInputEvent::GestureFlingStart)); 1236 FakeInputEvent(blink::WebInputEvent::GestureFlingStart));
1187 RunUntilIdle(); 1237 RunUntilIdle();
1188 1238
1189 // Even though we exceeded the input priority escalation period, we should 1239 // Even though we exceeded the input priority escalation period, we should
1190 // still be in compositor priority since the input remains queued. 1240 // still be in compositor priority since the input remains queued.
1191 EXPECT_EQ(Policy::COMPOSITOR_PRIORITY, CurrentPolicy()); 1241 EXPECT_EQ(UseCase::COMPOSITOR_SCROLLING, CurrentUseCase());
1192 1242
1193 // After the escalation period ends we should go back into normal mode. 1243 // After the escalation period ends we should go back into normal mode.
1194 clock_->Advance(priority_escalation_after_input_duration() * 2); 1244 clock_->Advance(priority_escalation_after_input_duration() * 2);
1195 RunUntilIdle(); 1245 RunUntilIdle();
1196 EXPECT_EQ(Policy::NORMAL, CurrentPolicy()); 1246 EXPECT_EQ(UseCase::NOT_SCROLLING, CurrentUseCase());
1197 } 1247 }
1198 1248
1199 class RendererSchedulerImplWithMockSchedulerTest 1249 class RendererSchedulerImplWithMockSchedulerTest
1200 : public RendererSchedulerImplTest { 1250 : public RendererSchedulerImplTest {
1201 public: 1251 public:
1202 void SetUp() override { 1252 void SetUp() override {
1203 mock_task_runner_ = make_scoped_refptr( 1253 mock_task_runner_ = make_scoped_refptr(
1204 new cc::OrderedSimpleTaskRunner(clock_.get(), false)); 1254 new cc::OrderedSimpleTaskRunner(clock_.get(), false));
1205 main_task_runner_ = 1255 main_task_runner_ =
1206 SchedulerTaskRunnerDelegateForTest::Create(mock_task_runner_); 1256 SchedulerTaskRunnerDelegateForTest::Create(mock_task_runner_);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 scheduler_->ShouldYieldForHighPriorityWork(); 1439 scheduler_->ShouldYieldForHighPriorityWork();
1390 scheduler_->ShouldYieldForHighPriorityWork(); 1440 scheduler_->ShouldYieldForHighPriorityWork();
1391 1441
1392 scheduler_->DidHandleInputEventOnMainThread( 1442 scheduler_->DidHandleInputEventOnMainThread(
1393 FakeInputEvent(blink::WebInputEvent::TouchStart)); 1443 FakeInputEvent(blink::WebInputEvent::TouchStart));
1394 scheduler_->DidHandleInputEventOnMainThread( 1444 scheduler_->DidHandleInputEventOnMainThread(
1395 FakeInputEvent(blink::WebInputEvent::TouchMove)); 1445 FakeInputEvent(blink::WebInputEvent::TouchMove));
1396 1446
1397 EXPECT_EQ(1, mock_scheduler_->update_policy_count_); 1447 EXPECT_EQ(1, mock_scheduler_->update_policy_count_);
1398 1448
1449 // We expect both the urgent and the delayed updates to run in addition to the
1450 // earlier updated cause by IsHighPriorityWorkAnticipated, a final update
1451 // transitions from 'not_scrolling scroll expected' to 'not_scrolling'.
1399 RunUntilIdle(); 1452 RunUntilIdle();
1400 // We expect both the urgent and the delayed updates to run in addition to the 1453 EXPECT_THAT(
1401 // earlier updated cause by IsHighPriorityWorkAnticipated. 1454 mock_scheduler_->use_cases_,
1402 EXPECT_EQ(3, mock_scheduler_->update_policy_count_); 1455 testing::ElementsAre(std::string("touchstart"), std::string("touchstart"),
1456 std::string("not_scrolling scroll expected"),
1457 std::string("not_scrolling")));
1403 } 1458 }
1404 1459
1405 class RendererSchedulerImplWithMessageLoopTest 1460 class RendererSchedulerImplWithMessageLoopTest
1406 : public RendererSchedulerImplTest { 1461 : public RendererSchedulerImplTest {
1407 public: 1462 public:
1408 RendererSchedulerImplWithMessageLoopTest() 1463 RendererSchedulerImplWithMessageLoopTest()
1409 : RendererSchedulerImplTest(new base::MessageLoop()) {} 1464 : RendererSchedulerImplTest(new base::MessageLoop()) {}
1410 ~RendererSchedulerImplWithMessageLoopTest() override {} 1465 ~RendererSchedulerImplWithMessageLoopTest() override {}
1411 1466
1412 void PostFromNestedRunloop(std::vector< 1467 void PostFromNestedRunloop(std::vector<
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 scheduler_->ResumeTimerQueue(); 1802 scheduler_->ResumeTimerQueue();
1748 RunUntilIdle(); 1803 RunUntilIdle();
1749 EXPECT_TRUE(run_order.empty()); 1804 EXPECT_TRUE(run_order.empty());
1750 1805
1751 scheduler_->ResumeTimerQueue(); 1806 scheduler_->ResumeTimerQueue();
1752 RunUntilIdle(); 1807 RunUntilIdle();
1753 EXPECT_THAT(run_order, 1808 EXPECT_THAT(run_order,
1754 testing::ElementsAre(std::string("T1"), std::string("T2"))); 1809 testing::ElementsAre(std::string("T1"), std::string("T2")));
1755 } 1810 }
1756 1811
1757 TEST_F(RendererSchedulerImplTest, PolicyToString) { 1812 TEST_F(RendererSchedulerImplTest, UseCaseToString) {
1758 CheckAllPolicyToString(); 1813 CheckAllUseCaseToString();
1759 } 1814 }
1760 1815
1761 TEST_F(RendererSchedulerImplTest, MismatchedDidHandleInputEventOnMainThread) { 1816 TEST_F(RendererSchedulerImplTest, MismatchedDidHandleInputEventOnMainThread) {
1762 // This should not DCHECK because there was no corresponding compositor side 1817 // This should not DCHECK because there was no corresponding compositor side
1763 // call to DidHandleInputEventOnCompositorThread with 1818 // call to DidHandleInputEventOnCompositorThread with
1764 // INPUT_EVENT_ACK_STATE_NOT_CONSUMED. There are legitimate reasons for the 1819 // INPUT_EVENT_ACK_STATE_NOT_CONSUMED. There are legitimate reasons for the
1765 // compositor to not be there and we don't want to make debugging impossible. 1820 // compositor to not be there and we don't want to make debugging impossible.
1766 scheduler_->DidHandleInputEventOnMainThread( 1821 scheduler_->DidHandleInputEventOnMainThread(
1767 FakeInputEvent(blink::WebInputEvent::GestureFlingStart)); 1822 FakeInputEvent(blink::WebInputEvent::GestureFlingStart));
1768 } 1823 }
(...skipping 14 matching lines...) Expand all
1783 1838
1784 TEST_F(RendererSchedulerImplTest, ShutdownPreventsPostingOfNewTasks) { 1839 TEST_F(RendererSchedulerImplTest, ShutdownPreventsPostingOfNewTasks) {
1785 scheduler_->Shutdown(); 1840 scheduler_->Shutdown();
1786 std::vector<std::string> run_order; 1841 std::vector<std::string> run_order;
1787 PostTestTasks(&run_order, "D1 C1"); 1842 PostTestTasks(&run_order, "D1 C1");
1788 RunUntilIdle(); 1843 RunUntilIdle();
1789 EXPECT_TRUE(run_order.empty()); 1844 EXPECT_TRUE(run_order.empty());
1790 } 1845 }
1791 1846
1792 } // namespace scheduler 1847 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698