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

Side by Side Diff: Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp

Issue 10690121: Merge 121076 - [chromium] LayerRendererChromium is not getting visibility messages in single thread… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); 758 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
759 } 759 }
760 760
761 TEST(CCSchedulerStateMachineTest, TestRequestCommitInvisible) 761 TEST(CCSchedulerStateMachineTest, TestRequestCommitInvisible)
762 { 762 {
763 StateMachine state; 763 StateMachine state;
764 state.setNeedsCommit(true); 764 state.setNeedsCommit(true);
765 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); 765 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
766 } 766 }
767 767
768 TEST(CCSchedulerStateMachineTest, TestGoesInvisibleMidCommit) 768 TEST(CCSchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes)
769 { 769 {
770 StateMachine state; 770 StateMachine state;
771 state.setCanBeginFrame(true); 771 state.setCanBeginFrame(true);
772 state.setVisible(true); 772 state.setVisible(true);
773 773
774 // Start clean and set commit. 774 // Start clean and set commit.
775 state.setNeedsCommit(true); 775 state.setNeedsCommit(true);
776 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); 776 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
777 777
778 // Begin the frame while visible. 778 // Begin the frame while visible.
779 state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); 779 state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME);
780 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.com mitState()); 780 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.com mitState());
781 EXPECT_FALSE(state.needsCommit()); 781 EXPECT_FALSE(state.needsCommit());
782 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); 782 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
783 783
784 // Become invisible 784 // Become invisible and abort the beginFrame.
785 state.setVisible(false); 785 state.setVisible(false);
786 state.beginFrameAborted();
786 787
787 // Tell the scheduler the frame finished 788 // We should now be back in the idle state as if we didn't start a frame at all.
788 state.beginFrameComplete(); 789 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState());
789 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_UPDATING_RESOURCES, state.co mmitState());
790 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state .nextAction());
791
792 // Tell the scheduler the update began and finished
793 state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCE S);
794 state.beginUpdateMoreResourcesComplete(false);
795 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, state.commi tState());
796 EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction());
797
798 // Commit in invisible state should leave us:
799 // - COMMIT_STATE_WAITING_FOR_FIRST_DRAW
800 // - Waiting for redraw.
801 // - No commit needed
802 state.updateState(CCSchedulerStateMachine::ACTION_COMMIT);
803 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, stat e.commitState());
804 EXPECT_TRUE(state.needsRedraw());
805 EXPECT_FALSE(state.needsCommit());
806
807 // Expect to do nothing, both in and out of vsync.
808 state.didLeaveVSync();
809 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
810 state.didEnterVSync();
811 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); 790 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
812 } 791 }
813 792
814 TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) 793 TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle)
815 { 794 {
816 StateMachine state; 795 StateMachine state;
817 state.setCanBeginFrame(true); 796 state.setCanBeginFrame(true);
818 state.setVisible(true); 797 state.setVisible(true);
819 798
820 state.didLoseContext(); 799 state.didLoseContext();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 StateMachine state; 1014 StateMachine state;
1036 state.setCanBeginFrame(true); 1015 state.setCanBeginFrame(true);
1037 state.setVisible(true); 1016 state.setVisible(true);
1038 state.setNeedsCommit(true); 1017 state.setNeedsCommit(true);
1039 state.setNeedsForcedCommit(true); 1018 state.setNeedsForcedCommit(true);
1040 state.didLoseContext(); 1019 state.didLoseContext();
1041 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); 1020 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
1042 } 1021 }
1043 1022
1044 } 1023 }
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp ('k') | Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698