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: cc/scheduler/scheduler_state_machine_unittest.cc

Issue 655783002: Attempt to fix flaky ChromeOS test timeouts. (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/scheduler/scheduler_unittest.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 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 state.SetNeedsCommit(); 1666 state.SetNeedsCommit();
1667 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); 1667 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state);
1668 EXPECT_ACTION_UPDATE_STATE( 1668 EXPECT_ACTION_UPDATE_STATE(
1669 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1669 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1670 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1670 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1671 state.DidSwapBuffersComplete(); 1671 state.DidSwapBuffersComplete();
1672 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1672 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1673 1673
1674 // Finish the previous commit and draw it. 1674 // Finish the previous commit and draw it.
1675 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); 1675 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state);
1676 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1677
1678 // Verify we do not send another BeginMainFrame if was are swap throttled
1679 // and did not just swap.
1676 state.SetNeedsCommit(); 1680 state.SetNeedsCommit();
1677 EXPECT_ACTION_UPDATE_STATE( 1681 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1678 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1682 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
1683 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1684 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
1685 state.OnBeginImplFrameDeadline();
1679 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1686 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1680 } 1687 }
1681 1688
1682 TEST(SchedulerStateMachineTest, TestTriggerDeadlineEarlyOnLostOutputSurface) { 1689 TEST(SchedulerStateMachineTest, TestTriggerDeadlineEarlyOnLostOutputSurface) {
1683 SchedulerSettings default_scheduler_settings; 1690 SchedulerSettings default_scheduler_settings;
1684 StateMachine state(default_scheduler_settings); 1691 StateMachine state(default_scheduler_settings);
1685 state.SetCanStart(); 1692 state.SetCanStart();
1686 state.UpdateState(state.NextAction()); 1693 state.UpdateState(state.NextAction());
1687 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1694 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1688 state.SetVisible(true); 1695 state.SetVisible(true);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1781 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1775 1782
1776 state.SetNeedsAnimate(); 1783 state.SetNeedsAnimate();
1777 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1784 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1778 1785
1779 state.OnBeginImplFrameDeadline(); 1786 state.OnBeginImplFrameDeadline();
1780 EXPECT_ACTION_UPDATE_STATE( 1787 EXPECT_ACTION_UPDATE_STATE(
1781 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1788 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1782 } 1789 }
1783 1790
1784 TEST(SchedulerStateMachineTest, TestBeginMainFrameNotSwapThrottled) {
1785 SchedulerSettings settings;
1786 settings.impl_side_painting = true;
1787 StateMachine state(settings);
1788 state.SetCanStart();
1789 state.UpdateState(state.NextAction());
1790 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1791 state.SetVisible(true);
1792 state.SetCanDraw(true);
1793 state.SetNeedsCommit();
1794
1795 // Begin frame and finish without interruption;
1796 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
1797 EXPECT_ACTION_UPDATE_STATE(
1798 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1799 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1800 state.NotifyBeginMainFrameStarted();
1801 state.NotifyReadyToCommit();
1802 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
1803 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1804 state.NotifyReadyToActivate();
1805 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE);
1806 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1807 state.OnBeginImplFrameDeadline();
1808 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1809 EXPECT_ACTION_UPDATE_STATE(
1810 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1811 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1812
1813 // Make sure we're not swap throttled
1814 state.DidSwapBuffers();
1815 state.DidSwapBuffersComplete();
1816
1817 // Verify we send another begin frame
1818 state.SetNeedsCommit();
1819 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
1820 EXPECT_ACTION_UPDATE_STATE(
1821 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1822 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1823 }
1824
1825 } // namespace 1791 } // namespace
1826 } // namespace cc 1792 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698