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

Side by Side Diff: cc/scheduler/scheduler_state_machine_unittest.cc

Issue 184063002: cc: Change texture locking check point (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modify invariant condition 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/scheduler/scheduler_state_machine.h" 5 #include "cc/scheduler/scheduler_state_machine.h"
6 6
7 #include "cc/scheduler/scheduler.h" 7 #include "cc/scheduler/scheduler.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 #define EXPECT_ACTION_UPDATE_STATE(action) \ 10 #define EXPECT_ACTION_UPDATE_STATE(action) \
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 state.UpdateState(state.NextAction()); 1269 state.UpdateState(state.NextAction());
1270 state.DidCreateAndInitializeOutputSurface(); 1270 state.DidCreateAndInitializeOutputSurface();
1271 1271
1272 EXPECT_FALSE(state.RedrawPending()); 1272 EXPECT_FALSE(state.RedrawPending());
1273 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); 1273 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
1274 EXPECT_EQ(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME, 1274 EXPECT_EQ(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME,
1275 state.NextAction()); 1275 state.NextAction());
1276 } 1276 }
1277 1277
1278 TEST(SchedulerStateMachineTest, 1278 TEST(SchedulerStateMachineTest,
1279 TestPendingActivationsShouldBeForcedAfterLostOutputSurface) {
1280 SchedulerSettings settings;
1281 settings.impl_side_painting = true;
1282 StateMachine state(settings);
1283 state.SetCanStart();
1284 state.UpdateState(state.NextAction());
1285 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1286 state.SetVisible(true);
1287 state.SetCanDraw(true);
1288
1289 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS);
1290
1291 // Cause a lost context.
1292 state.DidLoseOutputSurface();
1293
1294 state.FinishCommit();
1295 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1296
1297 EXPECT_TRUE(state.PendingActivationsShouldBeForced());
1298 EXPECT_ACTION_UPDATE_STATE(
1299 SchedulerStateMachine::ACTION_ACTIVATE_PENDING_TREE);
1300
1301 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
1302 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
1303 }
1304
1305 TEST(SchedulerStateMachineTest,
1279 TestSendBeginMainFrameWhenInvisibleAndForceCommit) { 1306 TestSendBeginMainFrameWhenInvisibleAndForceCommit) {
1280 SchedulerSettings default_scheduler_settings; 1307 SchedulerSettings default_scheduler_settings;
1281 StateMachine state(default_scheduler_settings); 1308 StateMachine state(default_scheduler_settings);
1282 state.SetCanStart(); 1309 state.SetCanStart();
1283 state.UpdateState(state.NextAction()); 1310 state.UpdateState(state.NextAction());
1284 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1311 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1285 state.SetVisible(false); 1312 state.SetVisible(false);
1286 state.SetNeedsForcedCommitForReadback(); 1313 state.SetNeedsForcedCommitForReadback();
1287 EXPECT_EQ(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME, 1314 EXPECT_EQ(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME,
1288 state.NextAction()); 1315 state.NextAction());
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 state.UpdateState(state.NextAction()); 1623 state.UpdateState(state.NextAction());
1597 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1624 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1598 state.SetCanDraw(true); 1625 state.SetCanDraw(true);
1599 state.SetVisible(true); 1626 state.SetVisible(true);
1600 EXPECT_FALSE(state.PendingDrawsShouldBeAborted()); 1627 EXPECT_FALSE(state.PendingDrawsShouldBeAborted());
1601 1628
1602 state.SetMainThreadNeedsLayerTextures(); 1629 state.SetMainThreadNeedsLayerTextures();
1603 EXPECT_ACTION_UPDATE_STATE( 1630 EXPECT_ACTION_UPDATE_STATE(
1604 SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD); 1631 SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD);
1605 EXPECT_TRUE(state.PendingDrawsShouldBeAborted()); 1632 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
1606 EXPECT_TRUE(state.PendingActivationsShouldBeForced());
1607 1633
1608 state.SetNeedsCommit(); 1634 state.SetNeedsCommit();
1609 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); 1635 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
1610 EXPECT_ACTION_UPDATE_STATE( 1636 EXPECT_ACTION_UPDATE_STATE(
1611 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1637 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1612 EXPECT_TRUE(state.PendingDrawsShouldBeAborted()); 1638 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
1613 EXPECT_TRUE(state.PendingActivationsShouldBeForced());
1614 1639
1615 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction()); 1640 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
1616 1641
1617 state.FinishCommit(); 1642 state.FinishCommit();
1618 EXPECT_TRUE(state.PendingDrawsShouldBeAborted()); 1643 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
1619 1644
1620 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction()); 1645 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction());
1621 1646
1622 state.UpdateState(state.NextAction()); 1647 state.UpdateState(state.NextAction());
1623 EXPECT_FALSE(state.PendingDrawsShouldBeAborted()); 1648 EXPECT_FALSE(state.PendingDrawsShouldBeAborted());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1733 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1709 1734
1710 // The deadline is not triggered early until we enter prefer smoothness mode. 1735 // The deadline is not triggered early until we enter prefer smoothness mode.
1711 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); 1736 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
1712 state.SetSmoothnessTakesPriority(true); 1737 state.SetSmoothnessTakesPriority(true);
1713 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); 1738 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
1714 } 1739 }
1715 1740
1716 } // namespace 1741 } // namespace
1717 } // namespace cc 1742 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698