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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 15730005: cc: Don't make AcquireLayerTextures force a commit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + fix test Created 7 years, 5 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_state_machine_unittest.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 f0f91a86c70874831842f350bf87d7c497fa90dc..14da80ebee5b01e88bbaae28dcbc3b3ebaa55b58 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -245,18 +245,14 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
client.Reset();
scheduler->SetMainThreadNeedsLayerTextures();
- EXPECT_ACTION("ScheduledActionAcquireLayerTexturesForMainThread",
- client,
- 0,
- 3);
- // A commit was started by SetMainThreadNeedsLayerTextures().
- EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 1, 3);
- EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 2, 3);
+ EXPECT_SINGLE_ACTION("ScheduledActionAcquireLayerTexturesForMainThread",
+ client);
// We should request a BeginFrame in anticipation of a draw.
client.Reset();
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrameOnImplThread", client);
EXPECT_TRUE(client.needs_begin_frame());
// No draw happens since the textures are acquired by the main thread.
@@ -266,6 +262,11 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
EXPECT_TRUE(scheduler->RedrawPending());
EXPECT_TRUE(client.needs_begin_frame());
+ scheduler->SetNeedsCommit();
+ EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 0, 2);
+ EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 1, 2);
+ EXPECT_TRUE(client.needs_begin_frame());
+
// Commit will release the texture.
client.Reset();
scheduler->FinishCommit();
@@ -322,15 +323,29 @@ TEST(SchedulerTest, TextureAcquisitionCollision) {
EXPECT_EQ(0, client.num_actions_());
client.Reset();
- // Once compositor draw complete, the delayed texture acquisition fires.
+ // No implicit commit is expected.
scheduler->BeginFrame(BeginFrameArgs::CreateForTesting());
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 3);
EXPECT_ACTION("ScheduledActionAcquireLayerTexturesForMainThread",
client,
1,
3);
- EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 2, 3);
+ EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 2, 3);
client.Reset();
+
+ // Compositor not scheduled to draw because textures are locked by main
+ // thread.
+ EXPECT_FALSE(client.needs_begin_frame());
+
+ // Needs an explicit commit from the main thread.
+ scheduler->SetNeedsCommit();
+ EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 0, 2);
+ EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 1, 2);
+ client.Reset();
+
+ // Trigger the commit
+ scheduler->FinishCommit();
+ EXPECT_TRUE(client.needs_begin_frame());
}
TEST(SchedulerTest, VisibilitySwitchWithTextureAcquisition) {
@@ -348,6 +363,7 @@ TEST(SchedulerTest, VisibilitySwitchWithTextureAcquisition) {
scheduler->SetNeedsCommit();
scheduler->FinishCommit();
scheduler->SetMainThreadNeedsLayerTextures();
+ scheduler->SetNeedsCommit();
client.Reset();
// Verify that pending texture acquisition fires when visibility
// is lost in order to avoid a deadlock.
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698