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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 218633010: cc: Handle retroactive BeginFrames in the Scheduler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@compositorVsyncDisable
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index f4027bf4a112fdea5eee4b2138fc928d1ea5b38f..b1be06fa52526fca7e0147bcda7e156fbc364d92 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -40,7 +40,7 @@ void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler) {
scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
scheduler->OnBeginImplFrameDeadline();
// We need another BeginImplFrame so Scheduler calls
- // SetNeedsBeginImplFrame(false).
+ // SetNeedsBeginFrame(false).
scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
scheduler->OnBeginImplFrameDeadline();
}
@@ -100,8 +100,8 @@ class FakeSchedulerClient : public SchedulerClient {
}
// SchedulerClient implementation.
- virtual void SetNeedsBeginImplFrame(bool enable) OVERRIDE {
- actions_.push_back("SetNeedsBeginImplFrame");
+ virtual void SetNeedsBeginFrame(bool enable) OVERRIDE {
+ actions_.push_back("SetNeedsBeginFrame");
states_.push_back(scheduler_->StateAsValue().release());
needs_begin_impl_frame_ = enable;
}
@@ -221,7 +221,7 @@ TEST(SchedulerTest, RequestCommit) {
client.Reset();
scheduler->SetNeedsCommit();
EXPECT_TRUE(client.needs_begin_impl_frame());
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
client.Reset();
scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
@@ -233,7 +233,7 @@ TEST(SchedulerTest, RequestCommit) {
// If we don't swap on the deadline, we need to request another
// BeginImplFrame.
scheduler->OnBeginImplFrameDeadline();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_TRUE(client.needs_begin_impl_frame());
client.Reset();
@@ -255,12 +255,12 @@ TEST(SchedulerTest, RequestCommit) {
// BeginImplFrame deadline should draw.
scheduler->OnBeginImplFrameDeadline();
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
- EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
+ EXPECT_ACTION("SetNeedsBeginFrame", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_TRUE(client.needs_begin_impl_frame());
client.Reset();
- // The following BeginImplFrame deadline should SetNeedsBeginImplFrame(false)
+ // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
// to avoid excessive toggles.
scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
EXPECT_EQ(client.num_actions_(), 0);
@@ -268,7 +268,7 @@ TEST(SchedulerTest, RequestCommit) {
client.Reset();
scheduler->OnBeginImplFrameDeadline();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_FALSE(client.needs_begin_impl_frame());
client.Reset();
}
@@ -287,7 +287,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
// SetNeedsCommit should begin the frame.
scheduler->SetNeedsCommit();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
client.Reset();
scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
@@ -310,7 +310,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
client.Reset();
scheduler->OnBeginImplFrameDeadline();
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
- EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
+ EXPECT_ACTION("SetNeedsBeginFrame", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
// Because we just swapped, the Scheduler should also request the next
@@ -334,7 +334,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
client.Reset();
scheduler->OnBeginImplFrameDeadline();
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
- EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
+ EXPECT_ACTION("SetNeedsBeginFrame", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_TRUE(client.needs_begin_impl_frame());
client.Reset();
@@ -360,7 +360,7 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
client.Reset();
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_TRUE(client.needs_begin_impl_frame());
client.Reset();
@@ -370,7 +370,7 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
client.Reset();
scheduler->OnBeginImplFrameDeadline();
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
- EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
+ EXPECT_ACTION("SetNeedsBeginFrame", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_FALSE(scheduler->RedrawPending());
EXPECT_TRUE(client.needs_begin_impl_frame());
@@ -381,7 +381,7 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client.Reset();
scheduler->OnBeginImplFrameDeadline();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_FALSE(scheduler->RedrawPending());
EXPECT_FALSE(client.needs_begin_impl_frame());
@@ -395,7 +395,7 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
client.Reset();
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_TRUE(client.needs_begin_impl_frame());
// No draw happens since the textures are acquired by the main thread.
@@ -405,7 +405,7 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client.Reset();
scheduler->OnBeginImplFrameDeadline();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_TRUE(scheduler->RedrawPending());
EXPECT_TRUE(client.needs_begin_impl_frame());
@@ -431,7 +431,7 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
client.Reset();
scheduler->OnBeginImplFrameDeadline();
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
- EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
+ EXPECT_ACTION("SetNeedsBeginFrame", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_FALSE(scheduler->RedrawPending());
EXPECT_TRUE(client.needs_begin_impl_frame());
@@ -443,7 +443,7 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client.Reset();
scheduler->OnBeginImplFrameDeadline();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_FALSE(client.needs_begin_impl_frame());
}
@@ -460,7 +460,7 @@ TEST(SchedulerTest, TextureAcquisitionCollision) {
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
client.Reset();
scheduler->SetMainThreadNeedsLayerTextures();
@@ -474,10 +474,10 @@ TEST(SchedulerTest, TextureAcquisitionCollision) {
client.Reset();
scheduler->OnBeginImplFrameDeadline();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
// Although the compositor cannot draw because textures are locked by main
- // thread, we continue requesting SetNeedsBeginImplFrame in anticipation of
+ // thread, we continue requesting SetNeedsBeginFrame in anticipation of
// the unlock.
EXPECT_TRUE(client.needs_begin_impl_frame());
@@ -503,7 +503,7 @@ TEST(SchedulerTest, TextureAcquisitionCollision) {
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 3);
EXPECT_ACTION(
"ScheduledActionAcquireLayerTexturesForMainThread", client, 1, 3);
- EXPECT_ACTION("SetNeedsBeginImplFrame", client, 2, 3);
+ EXPECT_ACTION("SetNeedsBeginFrame", client, 2, 3);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_TRUE(client.needs_begin_impl_frame());
@@ -515,7 +515,7 @@ TEST(SchedulerTest, TextureAcquisitionCollision) {
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client.Reset();
scheduler->OnBeginImplFrameDeadline();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_FALSE(client.needs_begin_impl_frame());
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
@@ -523,7 +523,7 @@ TEST(SchedulerTest, TextureAcquisitionCollision) {
// the textures.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_TRUE(client.needs_begin_impl_frame());
client.Reset();
@@ -543,7 +543,7 @@ TEST(SchedulerTest, TextureAcquisitionCollision) {
// Verify we draw on the next BeginImplFrame deadline
scheduler->OnBeginImplFrameDeadline();
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
- EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
+ EXPECT_ACTION("SetNeedsBeginFrame", client, 1, 2);
EXPECT_TRUE(client.needs_begin_impl_frame());
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
client.Reset();
@@ -993,7 +993,7 @@ TEST(SchedulerTest, ManageTiles) {
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client.Reset();
scheduler->OnBeginImplFrameDeadline();
- EXPECT_SINGLE_ACTION("SetNeedsBeginImplFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_EQ(0, client.num_draws());

Powered by Google App Engine
This is Rietveld 408576698