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

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

Issue 653013002: Revert of Making scheduler run ANIMATE after a COMMIT (instead of LayerTreeHostImpl). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | 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 "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/scheduler/scheduler.h" 8 #include "cc/scheduler/scheduler.h"
9 #include "cc/test/begin_frame_args_test.h" 9 #include "cc/test/begin_frame_args_test.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1752 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1753 EXPECT_ACTION_UPDATE_STATE( 1753 EXPECT_ACTION_UPDATE_STATE(
1754 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1754 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1755 1755
1756 state.OnBeginImplFrameDeadlinePending(); 1756 state.OnBeginImplFrameDeadlinePending();
1757 state.OnBeginImplFrameDeadline(); 1757 state.OnBeginImplFrameDeadline();
1758 EXPECT_ACTION_UPDATE_STATE( 1758 EXPECT_ACTION_UPDATE_STATE(
1759 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1759 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1760 } 1760 }
1761 1761
1762 TEST(SchedulerStateMachineTest, TestAnimateAfterCommitBeforeDraw) {
1763 SchedulerSettings settings;
1764 settings.impl_side_painting = true;
1765 StateMachine state(settings);
1766 state.SetCanStart();
1767 state.UpdateState(state.NextAction());
1768 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1769 state.SetVisible(true);
1770 state.SetCanDraw(true);
1771
1772 // Check that animations are updated before we start a commit.
1773 state.SetNeedsAnimate();
1774 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1775 state.SetNeedsCommit();
1776 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1777 EXPECT_TRUE(state.BeginFrameNeeded());
1778
1779 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
1780 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1781 EXPECT_ACTION_UPDATE_STATE(
1782 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1783
1784 state.NotifyBeginMainFrameStarted();
1785 state.NotifyReadyToCommit();
1786 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1787
1788 state.OnBeginImplFrameDeadlinePending();
1789 state.OnBeginImplFrameDeadline();
1790 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1791 EXPECT_ACTION_UPDATE_STATE(
1792 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1793 }
1794
1795 TEST(SchedulerStateMachineTest, TestSetNeedsAnimateAfterAnimate) { 1762 TEST(SchedulerStateMachineTest, TestSetNeedsAnimateAfterAnimate) {
1796 SchedulerSettings settings; 1763 SchedulerSettings settings;
1797 settings.impl_side_painting = true; 1764 settings.impl_side_painting = true;
1798 StateMachine state(settings); 1765 StateMachine state(settings);
1799 state.SetCanStart(); 1766 state.SetCanStart();
1800 state.UpdateState(state.NextAction()); 1767 state.UpdateState(state.NextAction());
1801 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1768 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1802 state.SetVisible(true); 1769 state.SetVisible(true);
1803 state.SetCanDraw(true); 1770 state.SetCanDraw(true);
1804 1771
1805 // Test requesting an animation after we have already animated during this 1772 // Test requesting an animation after we have already animated during this
1806 // frame. 1773 // frame.
1807 state.SetNeedsRedraw(true); 1774 state.SetNeedsRedraw(true);
1808 EXPECT_TRUE(state.BeginFrameNeeded()); 1775 EXPECT_TRUE(state.BeginFrameNeeded());
1809 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1776 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1810 1777
1811 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting()); 1778 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
1812 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1779 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1813 1780
1814 state.SetNeedsAnimate(); 1781 state.SetNeedsAnimate();
1815 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1782 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1816 1783
1817 state.OnBeginImplFrameDeadline(); 1784 state.OnBeginImplFrameDeadline();
1818 EXPECT_ACTION_UPDATE_STATE( 1785 EXPECT_ACTION_UPDATE_STATE(
1819 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1786 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1820 } 1787 }
1821 1788
1822 } // namespace 1789 } // namespace
1823 } // namespace cc 1790 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698