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

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

Powered by Google App Engine
This is Rietveld 408576698