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

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

Issue 966813003: [content]: Ensure TaskQueueManager AFTER_WAKEUP autopump policy wakes only on newer tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review Comments Created 5 years, 9 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
« no previous file with comments | « no previous file | content/renderer/scheduler/task_queue_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 EnableIdleTasks(); // Must start a new idle period before idle task runs. 307 EnableIdleTasks(); // Must start a new idle period before idle task runs.
308 RunUntilIdle(); 308 RunUntilIdle();
309 // Execution of default task queue task should trigger execution of idle task. 309 // Execution of default task queue task should trigger execution of idle task.
310 EXPECT_EQ(2, run_count); 310 EXPECT_EQ(2, run_count);
311 } 311 }
312 312
313 TEST_F(RendererSchedulerImplTest, TestPostIdleTaskAfterWakeupWhileAwake) { 313 TEST_F(RendererSchedulerImplTest, TestPostIdleTaskAfterWakeupWhileAwake) {
314 base::TimeTicks deadline_in_task; 314 base::TimeTicks deadline_in_task;
315 int run_count = 0; 315 int run_count = 0;
316 316
317 default_task_runner_->PostTask(FROM_HERE, base::Bind(&NullTask));
318 idle_task_runner_->PostIdleTaskAfterWakeup( 317 idle_task_runner_->PostIdleTaskAfterWakeup(
319 FROM_HERE, base::Bind(&IdleTestTask, &run_count, &deadline_in_task)); 318 FROM_HERE, base::Bind(&IdleTestTask, &run_count, &deadline_in_task));
319 default_task_runner_->PostTask(FROM_HERE, base::Bind(&NullTask));
320 320
321 RunUntilIdle(); 321 RunUntilIdle();
322 EnableIdleTasks(); // Must start a new idle period before idle task runs. 322 EnableIdleTasks(); // Must start a new idle period before idle task runs.
323 RunUntilIdle(); 323 RunUntilIdle();
324 // Should run as the scheduler was already awakened by the normal task. 324 // Should run as the scheduler was already awakened by the normal task.
325 EXPECT_EQ(1, run_count); 325 EXPECT_EQ(1, run_count);
326 } 326 }
327 327
328 TEST_F(RendererSchedulerImplTest, TestPostIdleTaskWakesAfterWakeupIdleTask) { 328 TEST_F(RendererSchedulerImplTest, TestPostIdleTaskWakesAfterWakeupIdleTask) {
329 base::TimeTicks deadline_in_task; 329 base::TimeTicks deadline_in_task;
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 EXPECT_EQ(Policy::COMPOSITOR_PRIORITY, CurrentPolicy()); 1000 EXPECT_EQ(Policy::COMPOSITOR_PRIORITY, CurrentPolicy());
1001 1001
1002 // Process the input event with a new BeginMainFrame. 1002 // Process the input event with a new BeginMainFrame.
1003 DoMainFrame(); 1003 DoMainFrame();
1004 clock_->AdvanceNow(2 * priority_escalation_after_input_duration()); 1004 clock_->AdvanceNow(2 * priority_escalation_after_input_duration());
1005 RunUntilIdle(); 1005 RunUntilIdle();
1006 EXPECT_EQ(Policy::NORMAL, CurrentPolicy()); 1006 EXPECT_EQ(Policy::NORMAL, CurrentPolicy());
1007 } 1007 }
1008 1008
1009 } // namespace content 1009 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/scheduler/task_queue_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698