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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 1762823002: Remove runtime toggling of throttling frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/test/fake_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index 37fa8e0a6c9b56e3503b55ec3327822d5e37a8c0..d515648bdb476bfd0417e739a7e55ec769c517c1 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -3042,120 +3042,6 @@ TEST_F(SchedulerTest, ScheduledActionActivateAfterBeginFrameSourcePaused) {
EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
}
-// Tests to ensure frame sources can be successfully changed while drawing.
-TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
-
- // SetNeedsRedraw should begin the frame on the next BeginImplFrame.
- scheduler_->SetNeedsRedraw();
- EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
- client_->Reset();
-
- EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
- EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(scheduler_->begin_frames_expected());
- client_->Reset();
- task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
- scheduler_->SetNeedsRedraw();
-
- // Switch to an unthrottled frame source.
- scheduler_->SetThrottleFrameProduction(false);
- client_->Reset();
-
- // Unthrottled frame source will immediately begin a new frame.
- task_runner().RunPendingTasks(); // Run posted BeginFrame.
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
- EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
- client_->Reset();
-
- // If we don't swap on the deadline, we wait for the next BeginFrame.
- task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
- EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
- client_->Reset();
-}
-
-// Tests to ensure frame sources can be successfully changed while a frame
-// deadline is pending.
-TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
-
- // SetNeedsRedraw should begin the frame on the next BeginImplFrame.
- scheduler_->SetNeedsRedraw();
- EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
- client_->Reset();
-
- EXPECT_SCOPED(AdvanceFrame());
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
-
- // Switch to an unthrottled frame source before the frame deadline is hit.
- scheduler_->SetThrottleFrameProduction(false);
- client_->Reset();
-
- EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(scheduler_->begin_frames_expected());
- client_->Reset();
-
- task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
- client_->Reset();
-
- // Unthrottled frame source will immediately begin a new frame.
- task_runner().RunPendingTasks(); // Run BeginFrame.
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
- scheduler_->SetNeedsRedraw();
- client_->Reset();
-
- task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
- EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
- client_->Reset();
-}
-
-// Tests to ensure that the active frame source can successfully be changed from
-// unthrottled to throttled.
-TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) {
- scheduler_settings_.throttle_frame_production = false;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
-
- scheduler_->SetNeedsRedraw();
- EXPECT_NO_ACTION(client_);
- client_->Reset();
-
- task_runner().RunPendingTasks(); // Run posted BeginFrame.
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
- EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
- client_->Reset();
-
- task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
- EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
- client_->Reset();
-
- // Switch to a throttled frame source.
- scheduler_->SetThrottleFrameProduction(true);
- client_->Reset();
-
- // SetNeedsRedraw should begin the frame on the next BeginImplFrame.
- scheduler_->SetNeedsRedraw();
- task_runner().RunPendingTasks();
- EXPECT_NO_ACTION(client_);
- client_->Reset();
-
- EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
- EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(scheduler_->begin_frames_expected());
- client_->Reset();
- task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
-}
-
// Tests to ensure that we send a BeginMainFrameNotExpectedSoon when expected.
TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) {
scheduler_settings_.use_external_begin_frame_source = true;
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/test/fake_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698