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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 1135003006: Revert of cc: Aggressively expire retro frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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') | no next file » | 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 916386094f794eece1792c150d40113771706acd..106cbd40fd5ad643a89e21cccdb341f948383ae3 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -372,15 +372,13 @@
}
}
- BeginFrameArgs SendNextBeginFrame() {
+ void SendNextBeginFrame() {
DCHECK(scheduler_->settings().use_external_begin_frame_source);
// Creep the time forward so that any BeginFrameArgs is not equal to the
// last one otherwise we violate the BeginFrameSource contract.
now_src_->AdvanceNow(BeginFrameArgs::DefaultInterval());
- BeginFrameArgs args =
- CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
- fake_external_begin_frame_source_->TestOnBeginFrame(args);
- return args;
+ fake_external_begin_frame_source_->TestOnBeginFrame(
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src()));
}
FakeExternalBeginFrameSource* fake_external_begin_frame_source() const {
@@ -1548,7 +1546,7 @@
scheduler_->NotifyBeginMainFrameStarted();
client_->Reset();
- BeginFrameArgs retro_frame_args = SendNextBeginFrame();
+ SendNextBeginFrame();
// This BeginFrame is queued up as a retro frame.
EXPECT_NO_ACTION(client_);
// The previous deadline is still pending.
@@ -1572,8 +1570,10 @@
scheduler_->SetNeedsRedraw();
EXPECT_NO_ACTION(client_);
- // Let's advance to the retro frame's deadline.
- now_src()->AdvanceNow(retro_frame_args.deadline - now_src()->Now());
+ // Let's advance sufficiently past the next frame's deadline.
+ now_src()->AdvanceNow(BeginFrameArgs::DefaultInterval() -
+ BeginFrameArgs::DefaultEstimatedParentDrawTime() +
+ base::TimeDelta::FromMicroseconds(1));
// The retro frame hasn't expired yet.
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(false));
@@ -1588,7 +1588,7 @@
EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
}
-TEST_F(SchedulerTest, RetroFrameExpiresOnTime) {
+TEST_F(SchedulerTest, RetroFrameDoesNotExpireTooLate) {
scheduler_settings_.use_external_begin_frame_source = true;
SetUpScheduler(true);
@@ -1606,7 +1606,7 @@
scheduler_->NotifyBeginMainFrameStarted();
client_->Reset();
- BeginFrameArgs retro_frame_args = SendNextBeginFrame();
+ SendNextBeginFrame();
// This BeginFrame is queued up as a retro frame.
EXPECT_NO_ACTION(client_);
// The previous deadline is still pending.
@@ -1630,62 +1630,12 @@
scheduler_->SetNeedsRedraw();
EXPECT_NO_ACTION(client_);
- // Let's advance sufficiently past the retro frame's deadline.
- now_src()->AdvanceNow(retro_frame_args.deadline - now_src()->Now() +
+ // Let's advance sufficiently past the next frame's deadline.
+ now_src()->AdvanceNow(BeginFrameArgs::DefaultInterval() +
base::TimeDelta::FromMicroseconds(1));
// The retro frame should've expired.
EXPECT_NO_ACTION(client_);
-}
-
-TEST_F(SchedulerTest, MissedFrameDoesNotExpireTooEarly) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
-
- scheduler_->SetNeedsCommit();
- EXPECT_TRUE(client_->needs_begin_frames());
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_);
-
- BeginFrameArgs missed_frame_args =
- CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
- missed_frame_args.type = BeginFrameArgs::MISSED;
-
- // Advance to the deadline.
- now_src()->AdvanceNow(missed_frame_args.deadline - now_src()->Now());
-
- // Missed frame is handled because it's on time.
- client_->Reset();
- fake_external_begin_frame_source_->TestOnBeginFrame(missed_frame_args);
- EXPECT_TRUE(
- task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(false)));
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
- EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
- EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
-}
-
-TEST_F(SchedulerTest, MissedFrameExpiresOnTime) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
-
- scheduler_->SetNeedsCommit();
- EXPECT_TRUE(client_->needs_begin_frames());
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_);
-
- BeginFrameArgs missed_frame_args =
- CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
- missed_frame_args.type = BeginFrameArgs::MISSED;
-
- // Advance sufficiently past the deadline.
- now_src()->AdvanceNow(missed_frame_args.deadline - now_src()->Now() +
- base::TimeDelta::FromMicroseconds(1));
-
- // Missed frame is dropped because it's too late.
- client_->Reset();
- fake_external_begin_frame_source_->TestOnBeginFrame(missed_frame_args);
- EXPECT_FALSE(
- task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(false)));
- EXPECT_NO_ACTION(client_);
- EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
}
void SchedulerTest::BeginFramesNotFromClient(
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698