Commit 303b4f84 authored by mithro's avatar mithro Committed by Commit bot

cc: Adding testing for commits triggering NeedsBeginFrame.

This CL does two things;

 * Makes the commit requested test explicitly check that
   a commit only occurs during the impl frame.

 * Adds check for the case where commit is requested by
   can't draw.

This test was extracted from my original CL at
https://codereview.chromium.org/792803008/

BUG=346230

Review URL: https://codereview.chromium.org/1055673005

Cr-Commit-Position: refs/heads/master@{#324215}
parent f9747e19
...@@ -248,6 +248,35 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) { ...@@ -248,6 +248,35 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) {
EXPECT_TRUE(state.BeginFrameNeeded()); EXPECT_TRUE(state.BeginFrameNeeded());
// Expect nothing to happen until after OnBeginImplFrame.
EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
state.OnBeginImplFrame();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
}
// If commit requested and can't draw, still begin a main frame.
{
StateMachine state(default_scheduler_settings);
state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE);
state.SetCanStart();
state.UpdateState(state.NextAction());
state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
state.SetNeedsRedraw(false);
state.SetVisible(true);
state.SetNeedsCommit();
state.SetCanDraw(false);
EXPECT_TRUE(state.BeginFrameNeeded());
// Expect nothing to happen until after OnBeginImplFrame.
EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
state.OnBeginImplFrame(); state.OnBeginImplFrame();
EXPECT_ACTION_UPDATE_STATE( EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment