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

Side by Side Diff: cc/scheduler/scheduler_unittest.cc

Issue 1050833002: cc: Remove background ticking from LTHI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another attempt at rebasing. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/scheduler/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // Consume any previous deadline first, if no deadline is currently 353 // Consume any previous deadline first, if no deadline is currently
354 // pending, ImplFrameDeadlinePending will return false straight away and we 354 // pending, ImplFrameDeadlinePending will return false straight away and we
355 // will run no tasks. 355 // will run no tasks.
356 task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true)); 356 task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
357 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); 357 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
358 358
359 // Send the next BeginFrame message if using an external source, otherwise 359 // Send the next BeginFrame message if using an external source, otherwise
360 // it will be already in the task queue. 360 // it will be already in the task queue.
361 if (scheduler_->settings().use_external_begin_frame_source && 361 if (scheduler_->settings().use_external_begin_frame_source &&
362 scheduler_->FrameProductionThrottled()) { 362 scheduler_->FrameProductionThrottled()) {
363 EXPECT_TRUE(client_->needs_begin_frames());
363 SendNextBeginFrame(); 364 SendNextBeginFrame();
364 } 365 }
365 366
366 if (!scheduler_->settings().using_synchronous_renderer_compositor) { 367 if (!scheduler_->settings().using_synchronous_renderer_compositor) {
367 // Then run tasks until new deadline is scheduled. 368 // Then run tasks until new deadline is scheduled.
368 EXPECT_TRUE(task_runner_->RunTasksWhile( 369 EXPECT_TRUE(task_runner_->RunTasksWhile(
369 client_->ImplFrameDeadlinePending(false))); 370 client_->ImplFrameDeadlinePending(false)));
370 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); 371 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
371 } 372 }
372 } 373 }
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 client_->Reset(); 2117 client_->Reset();
2117 EXPECT_SCOPED(AdvanceFrame()); 2118 EXPECT_SCOPED(AdvanceFrame());
2118 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); 2119 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2119 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); 2120 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
2120 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); 2121 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
2121 2122
2122 client_->Reset(); 2123 client_->Reset();
2123 scheduler_->NotifyBeginMainFrameStarted(); 2124 scheduler_->NotifyBeginMainFrameStarted();
2124 scheduler_->NotifyReadyToCommit(); 2125 scheduler_->NotifyReadyToCommit();
2125 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); 2126 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
2127 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
2126 2128
2127 client_->Reset(); 2129 client_->Reset();
2128 scheduler_->SetVisible(false); 2130 scheduler_->SetVisible(false);
2131 task_runner().RunPendingTasks(); // Run posted deadline.
2132
2129 // Sync tree should be forced to activate. 2133 // Sync tree should be forced to activate.
2130 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); 2134 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 0, 3);
2131 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2); 2135 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3);
2136 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
2132 } 2137 }
2133 2138
2134 // Tests to ensure frame sources can be successfully changed while drawing. 2139 // Tests to ensure frame sources can be successfully changed while drawing.
2135 TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) { 2140 TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) {
2136 scheduler_settings_.use_external_begin_frame_source = true; 2141 scheduler_settings_.use_external_begin_frame_source = true;
2137 SetUpScheduler(true); 2142 SetUpScheduler(true);
2138 2143
2139 // SetNeedsRedraw should begin the frame on the next BeginImplFrame. 2144 // SetNeedsRedraw should begin the frame on the next BeginImplFrame.
2140 scheduler_->SetNeedsRedraw(); 2145 scheduler_->SetNeedsRedraw();
2141 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); 2146 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 2437
2433 // At the next BeginFrame, authoritative interval is used instead of previous 2438 // At the next BeginFrame, authoritative interval is used instead of previous
2434 // interval. 2439 // interval.
2435 EXPECT_NE(initial_interval, scheduler_->begin_impl_frame_args().interval); 2440 EXPECT_NE(initial_interval, scheduler_->begin_impl_frame_args().interval);
2436 EXPECT_EQ(authoritative_interval, 2441 EXPECT_EQ(authoritative_interval,
2437 scheduler_->begin_impl_frame_args().interval); 2442 scheduler_->begin_impl_frame_args().interval);
2438 } 2443 }
2439 2444
2440 } // namespace 2445 } // namespace
2441 } // namespace cc 2446 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698