OLD | NEW |
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 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1922 state.UpdateState(state.NextAction()); | 1922 state.UpdateState(state.NextAction()); |
1923 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); | 1923 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); |
1924 state.SetVisible(true); | 1924 state.SetVisible(true); |
1925 state.SetCanDraw(true); | 1925 state.SetCanDraw(true); |
1926 | 1926 |
1927 EXPECT_FALSE(state.BeginFrameNeeded()); | 1927 EXPECT_FALSE(state.BeginFrameNeeded()); |
1928 state.SetChildrenNeedBeginFrames(true); | 1928 state.SetChildrenNeedBeginFrames(true); |
1929 EXPECT_TRUE(state.BeginFrameNeeded()); | 1929 EXPECT_TRUE(state.BeginFrameNeeded()); |
1930 } | 1930 } |
1931 | 1931 |
| 1932 TEST(SchedulerStateMachineTest, TestDeferCommit) { |
| 1933 SchedulerSettings settings; |
| 1934 StateMachine state(settings); |
| 1935 state.SetCanStart(); |
| 1936 state.UpdateState(state.NextAction()); |
| 1937 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); |
| 1938 state.SetVisible(true); |
| 1939 state.SetCanDraw(true); |
| 1940 |
| 1941 state.SetDeferCommits(true); |
| 1942 |
| 1943 state.SetNeedsCommit(); |
| 1944 EXPECT_TRUE(state.BeginFrameNeeded()); |
| 1945 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1946 |
| 1947 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
| 1948 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1949 |
| 1950 state.OnBeginImplFrameDeadline(); |
| 1951 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1952 |
| 1953 state.SetDeferCommits(false); |
| 1954 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
| 1955 EXPECT_ACTION_UPDATE_STATE( |
| 1956 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
| 1957 } |
| 1958 |
1932 } // namespace | 1959 } // namespace |
1933 } // namespace cc | 1960 } // namespace cc |
OLD | NEW |