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

Unified Diff: Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp

Issue 10202004: Merge 114599 - [chromium] Add canBeginFrame state to CCSchedulerStateMachine to suppress initializa… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | Source/WebKit/chromium/tests/CCSchedulerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp
===================================================================
--- Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp (revision 114975)
+++ Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp (working copy)
@@ -75,6 +75,7 @@
{
StateMachine state;
state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_IDLE);
+ state.setCanBeginFrame(true);
state.setNeedsRedraw(false);
state.setNeedsCommit(false);
state.setUpdateMoreResourcesPending(false);
@@ -89,10 +90,30 @@
EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
}
+ // If commit requested but canBeginFrame is still false, do nothing.
+ {
+ StateMachine state;
+ state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_IDLE);
+ state.setNeedsRedraw(false);
+ state.setNeedsCommit(false);
+ state.setUpdateMoreResourcesPending(false);
+ state.setVisible(true);
+
+ EXPECT_FALSE(state.vsyncCallbackNeeded());
+
+ state.didLeaveVSync();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+ EXPECT_FALSE(state.vsyncCallbackNeeded());
+ state.didEnterVSync();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+ }
+
+
// If commit requested, begin a frame
{
StateMachine state;
state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_IDLE);
+ state.setCanBeginFrame(true);
state.setNeedsRedraw(false);
state.setNeedsCommit(true);
state.setUpdateMoreResourcesPending(false);
@@ -103,6 +124,7 @@
// Begin the frame, make sure needsCommit and commitState update correctly.
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME);
EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState());
@@ -122,6 +144,7 @@
TEST(CCSchedulerStateMachineTest, TestFailedDrawSetsNeedsCommitAndDoesNotDrawAgain)
{
CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
state.setNeedsRedraw();
EXPECT_TRUE(state.redrawPending());
@@ -146,6 +169,7 @@
TEST(CCSchedulerStateMachineTest, TestSetNeedsRedrawDuringFailedDrawDoesNotRemoveNeedsRedraw)
{
CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
state.setNeedsRedraw();
EXPECT_TRUE(state.redrawPending());
@@ -173,6 +197,7 @@
TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedDrawAllowsDrawInSameFrame)
{
CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Start a commit.
@@ -212,6 +237,7 @@
TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedAndSuccessfulDrawDoesNotAllowDrawInSameFrame)
{
CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Start a commit.
@@ -262,6 +288,7 @@
TEST(CCSchedulerStateMachineTest, TestFailedDrawIsRetriedNextVSync)
{
CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Start a draw.
@@ -447,6 +474,7 @@
{
StateMachine state;
state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
+ state.setCanBeginFrame(true);
state.setNeedsCommit(true);
state.setNeedsRedraw(true);
state.setUpdateMoreResourcesPending(false);
@@ -590,6 +618,7 @@
TEST(CCSchedulerStateMachineTest, TestSetNeedsCommitIsNotLost)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setNeedsCommit(true);
state.setVisible(true);
@@ -632,6 +661,7 @@
TEST(CCSchedulerStateMachineTest, TestFullCycle)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Start clean and set commit.
@@ -679,6 +709,7 @@
TEST(CCSchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Start clean and set commit.
@@ -737,6 +768,7 @@
TEST(CCSchedulerStateMachineTest, TestGoesInvisibleMidCommit)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Start clean and set commit.
@@ -782,6 +814,7 @@
TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
state.didLoseContext();
@@ -803,6 +836,7 @@
TEST(CCSchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhileRecreating)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
state.didLoseContext();
@@ -838,6 +872,7 @@
TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Get a commit in flight.
@@ -878,6 +913,7 @@
TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCommitRequested)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Get a commit in flight.
@@ -956,6 +992,16 @@
TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenInvisibleAndForceCommit)
{
StateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(false);
+ state.setNeedsCommit(true);
+ state.setNeedsForcedCommit(true);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
+}
+
+TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenCanBeginFrameFalseAndForceCommit)
+{
+ StateMachine state;
state.setVisible(true);
state.setNeedsCommit(true);
state.setNeedsForcedCommit(true);
@@ -965,6 +1011,7 @@
TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenCommitInProgress)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(false);
state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS);
state.setNeedsCommit(true);
@@ -986,6 +1033,7 @@
TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenContextLost)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
state.setNeedsCommit(true);
state.setNeedsForcedCommit(true);
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | Source/WebKit/chromium/tests/CCSchedulerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698