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

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

Issue 227413011: Remove old texture path in TextureLayer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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') | 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 "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 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 1949
1950 state.SetCanDraw(false); 1950 state.SetCanDraw(false);
1951 state.SetVisible(false); 1951 state.SetVisible(false);
1952 EXPECT_TRUE(state.PendingDrawsShouldBeAborted()); 1952 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
1953 1953
1954 state.SetCanDraw(true); 1954 state.SetCanDraw(true);
1955 state.SetVisible(true); 1955 state.SetVisible(true);
1956 EXPECT_FALSE(state.PendingDrawsShouldBeAborted()); 1956 EXPECT_FALSE(state.PendingDrawsShouldBeAborted());
1957 } 1957 }
1958 1958
1959 TEST(SchedulerStateMachineTest, ReportIfNotDrawingFromAcquiredTextures) {
1960 SchedulerSettings default_scheduler_settings;
1961 StateMachine state(default_scheduler_settings);
1962 state.SetCanStart();
1963 state.UpdateState(state.NextAction());
1964 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1965 state.SetCanDraw(true);
1966 state.SetVisible(true);
1967 EXPECT_FALSE(state.PendingDrawsShouldBeAborted());
1968
1969 state.SetMainThreadNeedsLayerTextures();
1970 EXPECT_ACTION_UPDATE_STATE(
1971 SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD);
1972 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
1973
1974 state.SetNeedsCommit();
1975 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting());
1976 EXPECT_ACTION_UPDATE_STATE(
1977 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1978 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
1979
1980 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
1981
1982 state.NotifyBeginMainFrameStarted();
1983 state.NotifyReadyToCommit();
1984 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
1985
1986 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction());
1987
1988 state.UpdateState(state.NextAction());
1989 EXPECT_FALSE(state.PendingDrawsShouldBeAborted());
1990 }
1991
1992 TEST(SchedulerStateMachineTest, AcquireTexturesWithAbort) {
1993 SchedulerSettings default_scheduler_settings;
1994 StateMachine state(default_scheduler_settings);
1995 state.SetCanStart();
1996 state.UpdateState(state.NextAction());
1997 state.DidCreateAndInitializeOutputSurface();
1998 state.SetCanDraw(true);
1999 state.SetVisible(true);
2000
2001 state.SetMainThreadNeedsLayerTextures();
2002 EXPECT_EQ(
2003 SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD,
2004 state.NextAction());
2005 state.UpdateState(state.NextAction());
2006 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
2007
2008 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
2009
2010 state.SetNeedsCommit();
2011 EXPECT_EQ(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME,
2012 state.NextAction());
2013 state.UpdateState(state.NextAction());
2014 EXPECT_TRUE(state.PendingDrawsShouldBeAborted());
2015
2016 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
2017
2018 state.BeginMainFrameAborted(true);
2019
2020 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
2021 EXPECT_FALSE(state.PendingDrawsShouldBeAborted());
2022 }
2023
2024 TEST(SchedulerStateMachineTest, TestTriggerDeadlineEarlyAfterAbortedCommit) { 1959 TEST(SchedulerStateMachineTest, TestTriggerDeadlineEarlyAfterAbortedCommit) {
2025 SchedulerSettings settings; 1960 SchedulerSettings settings;
2026 settings.impl_side_painting = true; 1961 settings.impl_side_painting = true;
2027 StateMachine state(settings); 1962 StateMachine state(settings);
2028 state.SetCanStart(); 1963 state.SetCanStart();
2029 state.UpdateState(state.NextAction()); 1964 state.UpdateState(state.NextAction());
2030 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1965 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
2031 state.SetVisible(true); 1966 state.SetVisible(true);
2032 state.SetCanDraw(true); 1967 state.SetCanDraw(true);
2033 1968
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 2009 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
2075 2010
2076 // The deadline is not triggered early until we enter prefer smoothness mode. 2011 // The deadline is not triggered early until we enter prefer smoothness mode.
2077 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); 2012 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
2078 state.SetSmoothnessTakesPriority(true); 2013 state.SetSmoothnessTakesPriority(true);
2079 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); 2014 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
2080 } 2015 }
2081 2016
2082 } // namespace 2017 } // namespace
2083 } // namespace cc 2018 } // 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