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

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

Issue 692483002: Hook up DidReceiveInputEvent to the blink scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unintended clang format change. Updated a comment 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
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/renderer/scheduler/renderer_scheduler_impl.h" 5 #include "content/renderer/scheduler/renderer_scheduler_impl.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "cc/output/begin_frame_args.h" 8 #include "cc/output/begin_frame_args.h"
9 #include "cc/test/ordered_simple_task_runner.h" 9 #include "cc/test/ordered_simple_task_runner.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 base::Bind(&AppendToVectorTestTask, &order, std::string("C2"))); 299 base::Bind(&AppendToVectorTestTask, &order, std::string("C2")));
300 300
301 scheduler_->DidReceiveInputEventOnCompositorThread(); 301 scheduler_->DidReceiveInputEventOnCompositorThread();
302 EnableIdleTasks(); 302 EnableIdleTasks();
303 RunUntilIdle(); 303 RunUntilIdle();
304 EXPECT_THAT(order, testing::ElementsAre(std::string("C1"), std::string("C2"), 304 EXPECT_THAT(order, testing::ElementsAre(std::string("C1"), std::string("C2"),
305 std::string("D1"), std::string("D2"), 305 std::string("D1"), std::string("D2"),
306 std::string("I1"))); 306 std::string("I1")));
307 } 307 }
308 308
309 TEST_F(RendererSchedulerImplTest, TestCompositorPolicy_DidAnimateForInput) {
310 std::vector<std::string> order;
311
312 idle_task_runner_->PostIdleTask(
313 FROM_HERE,
314 base::Bind(&AppendToVectorIdleTestTask, &order, std::string("I1")));
315 default_task_runner_->PostTask(
316 FROM_HERE,
317 base::Bind(&AppendToVectorTestTask, &order, std::string("D1")));
318 compositor_task_runner_->PostTask(
319 FROM_HERE,
320 base::Bind(&AppendToVectorTestTask, &order, std::string("C1")));
321 default_task_runner_->PostTask(
322 FROM_HERE,
323 base::Bind(&AppendToVectorTestTask, &order, std::string("D2")));
324 compositor_task_runner_->PostTask(
325 FROM_HERE,
326 base::Bind(&AppendToVectorTestTask, &order, std::string("C2")));
327
328 scheduler_->DidAnimateForInputOnCompositorThread();
329 EnableIdleTasks();
330 RunUntilIdle();
331 EXPECT_THAT(order, testing::ElementsAre(std::string("C1"), std::string("C2"),
332 std::string("D1"), std::string("D2"),
333 std::string("I1")));
334 }
335
309 TEST_F(RendererSchedulerImplTest, 336 TEST_F(RendererSchedulerImplTest,
310 TestCompositorPolicyDoesNotStarveDefaultTasks) { 337 TestCompositorPolicyDoesNotStarveDefaultTasks) {
311 std::vector<std::string> order; 338 std::vector<std::string> order;
312 339
313 default_task_runner_->PostTask( 340 default_task_runner_->PostTask(
314 FROM_HERE, 341 FROM_HERE,
315 base::Bind(&AppendToVectorTestTask, &order, std::string("D1"))); 342 base::Bind(&AppendToVectorTestTask, &order, std::string("D1")));
316 compositor_task_runner_->PostTask( 343 compositor_task_runner_->PostTask(
317 FROM_HERE, 344 FROM_HERE,
318 base::Bind(&AppendToVectorTestTask, &order, std::string("C1"))); 345 base::Bind(&AppendToVectorTestTask, &order, std::string("C1")));
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(), 429 FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(),
403 compositor_task_runner_, true, &should_yield_before, 430 compositor_task_runner_, true, &should_yield_before,
404 &should_yield_after)); 431 &should_yield_after));
405 RunUntilIdle(); 432 RunUntilIdle();
406 // We should be able to switch to compositor priority mid-task. 433 // We should be able to switch to compositor priority mid-task.
407 EXPECT_FALSE(should_yield_before); 434 EXPECT_FALSE(should_yield_before);
408 EXPECT_TRUE(should_yield_after); 435 EXPECT_TRUE(should_yield_after);
409 } 436 }
410 437
411 } // namespace content 438 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698