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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 267783004: Refactoring the way begin frame sources inside scheduler work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Trying an alternative to OnMissedBeginFrames method. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index 256acd5bd8f6a211637b8d72b24e295485d0db86..efb895f5589275d66b4de388a47765649981f151 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -45,12 +45,31 @@ void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
class FakeSchedulerClient : public SchedulerClient {
public:
+ struct FakeBeginFrameSourceForFakeSchedulerClient
+ : public FakeBeginFrameSource {
+ FakeSchedulerClient* client_;
+
+ explicit FakeBeginFrameSourceForFakeSchedulerClient(
+ FakeSchedulerClient* client)
+ : client_(client) {}
+
+ virtual void SetNeedsBeginFrames(bool needs_begin_frames) OVERRIDE {
+ FakeBeginFrameSource::SetNeedsBeginFrames(needs_begin_frames);
+ if (needs_begin_frames) {
+ client_->actions_.push_back("SetNeedsBeginFrames(true)");
+ } else {
+ client_->actions_.push_back("SetNeedsBeginFrames(false)");
+ }
+ client_->states_.push_back(client_->scheduler_->AsValue());
+ }
+ };
+
FakeSchedulerClient()
- : needs_begin_frame_(false),
- automatic_swap_ack_(true),
+ : automatic_swap_ack_(true),
swap_contains_incomplete_tile_(false),
redraw_will_happen_if_update_visible_tiles_happens_(false),
- now_src_(TestNowSource::Create()) {
+ now_src_(TestNowSource::Create()),
+ fake_frame_source_(this) {
Reset();
}
@@ -65,6 +84,7 @@ class FakeSchedulerClient : public SchedulerClient {
TestScheduler* CreateScheduler(const SchedulerSettings& settings) {
scheduler_ = TestScheduler::Create(now_src_, this, settings, 0);
+ DCHECK(scheduler_);
// Fail if we need to run 100 tasks in a row.
task_runner().SetRunTaskLimit(100);
return scheduler_.get();
@@ -75,7 +95,7 @@ class FakeSchedulerClient : public SchedulerClient {
void set_log_anticipated_draw_time_change(bool log) {
log_anticipated_draw_time_change_ = log;
}
- bool needs_begin_frame() { return needs_begin_frame_; }
+ bool needs_begin_frames() { return fake_frame_source_.NeedsBeginFrames(); }
int num_draws() const { return num_draws_; }
int num_actions_() const { return static_cast<int>(actions_.size()); }
const char* Action(int i) const { return actions_[i]; }
@@ -84,13 +104,25 @@ class FakeSchedulerClient : public SchedulerClient {
return posted_begin_impl_frame_deadline_;
}
- void AdvanceFrame() {
- bool external_begin_frame =
- scheduler_->settings().begin_frame_scheduling_enabled &&
- scheduler_->settings().throttle_frame_production;
+ bool ExternalBeginFrame() {
+ return scheduler_->settings().begin_frame_scheduling_enabled &&
+ scheduler_->settings().throttle_frame_production;
+ }
+ virtual FakeBeginFrameSource* ExternalBeginFrameSource() OVERRIDE {
+ return &fake_frame_source_;
+ }
- if (external_begin_frame) {
- scheduler_->BeginFrame(CreateBeginFrameArgsForTesting(now_src_));
+ void AdvanceFrame() {
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"),
+ "FakeSchedulerClient::AdvanceFrame");
+ // EXPECT_TRUE(needs_begin_frames());
+ if (ExternalBeginFrame()) {
+ // Creep the time forward so that any BeginFrameArgs is not equal to the
+ // last one otherwise we violate the BeginFrameSource contract.
+ now_src_->AdvanceNowMicroseconds(1);
+ fake_frame_source_.TestOnBeginFrame(
+ CreateBeginFrameArgsForTesting(now_src_));
+ EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
}
EXPECT_TRUE(task_runner().RunTasksWhile(ImplFrameDeadlinePending(false)));
@@ -128,11 +160,6 @@ class FakeSchedulerClient : public SchedulerClient {
redraw_will_happen_if_update_visible_tiles_happens_ = redraw;
}
// SchedulerClient implementation.
- virtual void SetNeedsBeginFrame(bool enable) OVERRIDE {
- actions_.push_back("SetNeedsBeginFrame");
- states_.push_back(scheduler_->AsValue());
- needs_begin_frame_ = enable;
- }
virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE {
actions_.push_back("WillBeginImplFrame");
states_.push_back(scheduler_->AsValue());
@@ -221,7 +248,6 @@ class FakeSchedulerClient : public SchedulerClient {
return scheduler_->BeginImplFrameDeadlinePending() == state;
}
- bool needs_begin_frame_;
bool draw_will_happen_;
bool swap_will_happen_if_draw_happens_;
bool automatic_swap_ack_;
@@ -234,6 +260,7 @@ class FakeSchedulerClient : public SchedulerClient {
std::vector<scoped_refptr<base::debug::ConvertableToTraceFormat> > states_;
scoped_ptr<TestScheduler> scheduler_;
scoped_refptr<TestNowSource> now_src_;
+ FakeBeginFrameSourceForFakeSchedulerClient fake_frame_source_;
};
void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
@@ -248,22 +275,29 @@ void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
if (scheduler->settings().impl_side_painting)
scheduler->NotifyReadyToActivate();
- // Go through the motions to draw the commit.
- client->AdvanceFrame();
+ {
+ SCOPED_TRACE("Go through the motions to draw the commit");
+ client->AdvanceFrame();
+ }
// Run the posted deadline task.
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client->task_runner().RunTasksWhile(client->ImplFrameDeadlinePending(true));
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- // We need another BeginImplFrame so Scheduler calls
- // SetNeedsBeginFrame(false).
- client->AdvanceFrame();
+ {
+ SCOPED_TRACE(
+ "We need another BeginImplFrame so Scheduler calls "
+ "SetNeedsBeginFrame(false).");
+ client->AdvanceFrame();
+ }
// Run the posted deadline task.
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client->task_runner().RunTasksWhile(client->ImplFrameDeadlinePending(true));
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
+
+ // EXPECT_FALSE(client->needs_begin_frames());
}
TEST(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) {
@@ -294,29 +328,28 @@ TEST(SchedulerTest, RequestCommit) {
// SetNeedsCommit should begin the frame on the next BeginImplFrame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_TRUE(client.needs_begin_frame());
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
client.Reset();
client.AdvanceFrame();
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// If we don't swap on the deadline, we wait for the next BeginFrame.
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_NO_ACTION(client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// NotifyReadyToCommit should trigger the commit.
scheduler->NotifyBeginMainFrameStarted();
scheduler->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// BeginImplFrame should prepare the draw.
@@ -324,14 +357,14 @@ TEST(SchedulerTest, RequestCommit) {
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// BeginImplFrame deadline should draw.
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
@@ -342,8 +375,7 @@ TEST(SchedulerTest, RequestCommit) {
client.Reset();
client.task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
client.Reset();
}
@@ -361,7 +393,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
// SetNeedsCommit should begin the frame.
scheduler->SetNeedsCommit();
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
client.Reset();
client.AdvanceFrame();
@@ -369,7 +401,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// Now SetNeedsCommit again. Calling here means we need a second commit.
@@ -390,7 +422,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
// Because we just swapped, the Scheduler should also request the next
// BeginImplFrame from the OutputSurface.
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// Since another commit is needed, the next BeginImplFrame should initiate
// the second commit.
@@ -411,14 +443,14 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// On the next BeginImplFrame, verify we go back to a quiescent state and
// no longer request BeginImplFrames.
client.AdvanceFrame();
client.task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
}
@@ -459,20 +491,20 @@ TEST(SchedulerTest, RequestRedrawInsideDraw) {
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
EXPECT_EQ(0, client.num_draws());
client.AdvanceFrame();
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_EQ(1, client.num_draws());
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.AdvanceFrame();
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_EQ(2, client.num_draws());
EXPECT_FALSE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// We stop requesting BeginImplFrames after a BeginImplFrame where we don't
// swap.
@@ -480,7 +512,7 @@ TEST(SchedulerTest, RequestRedrawInsideDraw) {
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_EQ(2, client.num_draws());
EXPECT_FALSE(scheduler->RedrawPending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
}
// Test that requesting redraw inside a failed draw doesn't lose the request.
@@ -498,7 +530,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
EXPECT_EQ(0, client.num_draws());
// Fail the draw.
@@ -510,7 +542,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
// request.
EXPECT_TRUE(scheduler->CommitPending());
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// Fail the draw again.
client.AdvanceFrame();
@@ -518,7 +550,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
EXPECT_EQ(2, client.num_draws());
EXPECT_TRUE(scheduler->CommitPending());
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// Draw successfully.
client.SetDrawWillHappen(true);
@@ -527,7 +559,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
EXPECT_EQ(3, client.num_draws());
EXPECT_TRUE(scheduler->CommitPending());
EXPECT_FALSE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
}
class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
@@ -573,11 +605,11 @@ TEST(SchedulerTest, RequestCommitInsideDraw) {
InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
client.Reset();
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
EXPECT_EQ(0, client.num_draws());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.SetNeedsCommitOnNextDraw();
client.AdvanceFrame();
@@ -585,7 +617,7 @@ TEST(SchedulerTest, RequestCommitInsideDraw) {
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_EQ(1, client.num_draws());
EXPECT_TRUE(scheduler->CommitPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
scheduler->NotifyBeginMainFrameStarted();
scheduler->NotifyReadyToCommit();
@@ -595,7 +627,7 @@ TEST(SchedulerTest, RequestCommitInsideDraw) {
EXPECT_FALSE(scheduler->RedrawPending());
EXPECT_FALSE(scheduler->CommitPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// We stop requesting BeginImplFrames after a BeginImplFrame where we don't
// swap.
@@ -604,7 +636,7 @@ TEST(SchedulerTest, RequestCommitInsideDraw) {
EXPECT_EQ(2, client.num_draws());
EXPECT_FALSE(scheduler->RedrawPending());
EXPECT_FALSE(scheduler->CommitPending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
}
// Tests that when a draw fails then the pending commit should not be dropped.
@@ -622,7 +654,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
EXPECT_EQ(0, client.num_draws());
// Fail the draw.
@@ -634,7 +666,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
// request.
EXPECT_TRUE(scheduler->CommitPending());
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// Fail the draw again.
client.AdvanceFrame();
@@ -643,7 +675,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
EXPECT_EQ(2, client.num_draws());
EXPECT_TRUE(scheduler->CommitPending());
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// Draw successfully.
client.SetDrawWillHappen(true);
@@ -652,7 +684,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
EXPECT_EQ(3, client.num_draws());
EXPECT_TRUE(scheduler->CommitPending());
EXPECT_FALSE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
}
TEST(SchedulerTest, NoSwapWhenDrawFails) {
@@ -667,7 +699,7 @@ TEST(SchedulerTest, NoSwapWhenDrawFails) {
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
EXPECT_EQ(0, client.num_draws());
// Draw successfully, this starts a new frame.
@@ -678,7 +710,7 @@ TEST(SchedulerTest, NoSwapWhenDrawFails) {
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// Fail to draw, this should not start a frame.
client.SetDrawWillHappen(false);
@@ -714,7 +746,7 @@ TEST(SchedulerTest, ManageTiles) {
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
EXPECT_TRUE(scheduler->ManageTilesPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
EXPECT_EQ(0, client.num_draws());
EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles"));
EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
@@ -744,7 +776,7 @@ TEST(SchedulerTest, ManageTiles) {
scheduler->SetNeedsRedraw();
EXPECT_TRUE(scheduler->RedrawPending());
EXPECT_FALSE(scheduler->ManageTilesPending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
EXPECT_EQ(0, client.num_draws());
// We have no immediate actions to perform, so the BeginImplFrame should post
@@ -776,17 +808,16 @@ TEST(SchedulerTest, ManageTiles) {
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client.Reset();
client.task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
EXPECT_EQ(0, client.num_draws());
// Now trigger a ManageTiles outside of a draw. We will then need
// a begin-frame for the ManageTiles, but we don't need a draw.
client.Reset();
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
scheduler->SetNeedsManageTiles();
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
EXPECT_TRUE(scheduler->ManageTilesPending());
EXPECT_FALSE(scheduler->RedrawPending());
@@ -938,7 +969,7 @@ TEST(SchedulerTest, ShouldUpdateVisibleTiles) {
// SetNeedsCommit should begin the frame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
client.Reset();
client.AdvanceFrame();
@@ -981,8 +1012,7 @@ TEST(SchedulerTest, ShouldUpdateVisibleTiles) {
// No more UpdateVisibleTiles().
client.Reset();
client.task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
}
TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) {
@@ -1123,7 +1153,7 @@ TEST(SchedulerTest, PollForCommitCompletion) {
BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting(client.now_src());
frame_args.interval = base::TimeDelta::FromMilliseconds(1000);
- scheduler->BeginFrame(frame_args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(frame_args);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client.task_runner().RunPendingTasks(); // Run posted deadline.
@@ -1136,7 +1166,7 @@ TEST(SchedulerTest, PollForCommitCompletion) {
// the NotifyReadyToCommit for now.
EXPECT_FALSE(scheduler->CommitPending());
scheduler->SetNeedsCommit();
- scheduler->BeginFrame(frame_args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(frame_args);
EXPECT_TRUE(scheduler->CommitPending());
// Draw and swap the frame, but don't ack the swap to simulate the Browser
@@ -1188,39 +1218,38 @@ TEST(SchedulerTest, BeginRetroFrame) {
// SetNeedsCommit should begin the frame on the next BeginImplFrame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_TRUE(client.needs_begin_frame());
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
client.Reset();
// Create a BeginFrame with a long deadline to avoid race conditions.
// This is the first BeginFrame, which will be handled immediately.
BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src());
args.deadline += base::TimeDelta::FromHours(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// Queue BeginFrames while we are still handling the previous BeginFrame.
args.frame_time += base::TimeDelta::FromSeconds(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
args.frame_time += base::TimeDelta::FromSeconds(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
// If we don't swap on the deadline, we wait for the next BeginImplFrame.
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_NO_ACTION(client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// NotifyReadyToCommit should trigger the commit.
scheduler->NotifyBeginMainFrameStarted();
scheduler->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// BeginImplFrame should prepare the draw.
@@ -1228,14 +1257,14 @@ TEST(SchedulerTest, BeginRetroFrame) {
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// BeginImplFrame deadline should draw.
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
@@ -1246,8 +1275,7 @@ TEST(SchedulerTest, BeginRetroFrame) {
client.Reset();
client.task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
client.Reset();
}
@@ -1267,25 +1295,24 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
// SetNeedsCommit should begin the frame on the next BeginImplFrame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_TRUE(client.needs_begin_frame());
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
client.Reset();
// Create a BeginFrame with a long deadline to avoid race conditions.
// This is the first BeginFrame, which will be handled immediately.
BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src());
args.deadline += base::TimeDelta::FromHours(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// Queue BeginFrame while we are still handling the previous BeginFrame.
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
args.frame_time += base::TimeDelta::FromSeconds(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
EXPECT_NO_ACTION(client);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
client.Reset();
@@ -1294,7 +1321,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
scheduler->NotifyBeginMainFrameStarted();
scheduler->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// Swapping will put us into a swap throttled state.
@@ -1302,7 +1329,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// While swap throttled, BeginRetroFrames should trigger BeginImplFrames
@@ -1311,22 +1338,22 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// Queue BeginFrame while we are still handling the previous BeginFrame.
args.frame_time += base::TimeDelta::FromSeconds(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
EXPECT_NO_ACTION(client);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// Take us out of a swap throttled state.
scheduler->DidSwapBuffersComplete();
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
// BeginImplFrame deadline should draw.
@@ -1338,7 +1365,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
}
@@ -1359,7 +1386,7 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
// without calling SetNeedsBeginFrame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
EXPECT_NO_ACTION(client);
client.Reset();
@@ -1369,21 +1396,21 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// If we don't swap on the deadline, we wait for the next BeginFrame.
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_NO_ACTION(client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// NotifyReadyToCommit should trigger the commit.
scheduler->NotifyBeginMainFrameStarted();
scheduler->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// BeginImplFrame should prepare the draw.
@@ -1391,14 +1418,14 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// BeginImplFrame deadline should draw.
client.task_runner().RunTasksWhile(client.ImplFrameDeadlinePending(true));
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
@@ -1412,7 +1439,7 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
// when the BeginFrame is no longer needed.
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_NO_ACTION(client);
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
}
@@ -1457,7 +1484,7 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
// SetNeedsCommit should begin the frame on the next BeginImplFrame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
EXPECT_NO_ACTION(client);
client.Reset();
@@ -1466,14 +1493,14 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// NotifyReadyToCommit should trigger the pending commit and draw.
scheduler->NotifyBeginMainFrameStarted();
scheduler->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// Swapping will put us into a swap throttled state.
@@ -1481,7 +1508,7 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// While swap throttled, BeginFrames should trigger BeginImplFrames,
@@ -1490,14 +1517,14 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// Take us out of a swap throttled state.
scheduler->DidSwapBuffersComplete();
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
// BeginImplFrame deadline should draw.
@@ -1506,7 +1533,7 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_FALSE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
client.Reset();
}
@@ -1562,7 +1589,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) {
// SetNeedsCommit should begin the frame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
client.Reset();
client.AdvanceFrame();
@@ -1573,7 +1600,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) {
client.Reset();
scheduler->DidLoseOutputSurface();
// Do nothing when impl frame is in deadine pending state.
- EXPECT_NO_ACTION(client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
client.Reset();
scheduler->NotifyBeginMainFrameStarted();
@@ -1601,7 +1628,7 @@ void DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency(
// SetNeedsCommit should begin the frame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
client.Reset();
client.AdvanceFrame();
@@ -1612,7 +1639,7 @@ void DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency(
client.Reset();
scheduler->DidLoseOutputSurface();
// Do nothing when impl frame is in deadine pending state.
- EXPECT_NO_ACTION(client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
client.Reset();
// Run posted deadline.
@@ -1668,7 +1695,7 @@ void DidLoseOutputSurfaceAfterReadyToCommit(bool impl_side_painting) {
// SetNeedsCommit should begin the frame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
client.Reset();
client.AdvanceFrame();
@@ -1685,10 +1712,10 @@ void DidLoseOutputSurfaceAfterReadyToCommit(bool impl_side_painting) {
scheduler->DidLoseOutputSurface();
if (impl_side_painting) {
// Sync tree should be forced to activate.
- EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client);
+ EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2);
+ EXPECT_ACTION("ScheduledActionActivateSyncTree", client, 1, 2);
} else {
- // Do nothing when impl frame is in deadine pending state.
- EXPECT_NO_ACTION(client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
}
client.Reset();
@@ -1716,8 +1743,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsManageTiles) {
client.Reset();
scheduler->SetNeedsManageTiles();
scheduler->SetNeedsRedraw();
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
client.Reset();
client.AdvanceFrame();
@@ -1727,7 +1753,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsManageTiles) {
client.Reset();
scheduler->DidLoseOutputSurface();
- EXPECT_NO_ACTION(client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
client.Reset();
client.task_runner().RunPendingTasks(); // Run posted deadline.
@@ -1747,45 +1773,44 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) {
// SetNeedsCommit should begin the frame on the next BeginImplFrame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_TRUE(client.needs_begin_frame());
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
// Create a BeginFrame with a long deadline to avoid race conditions.
// This is the first BeginFrame, which will be handled immediately.
client.Reset();
BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src());
args.deadline += base::TimeDelta::FromHours(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// Queue BeginFrames while we are still handling the previous BeginFrame.
args.frame_time += base::TimeDelta::FromSeconds(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
args.frame_time += base::TimeDelta::FromSeconds(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
// If we don't swap on the deadline, we wait for the next BeginImplFrame.
client.Reset();
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_NO_ACTION(client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// NotifyReadyToCommit should trigger the commit.
client.Reset();
scheduler->NotifyBeginMainFrameStarted();
scheduler->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty());
scheduler->DidLoseOutputSurface();
- EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client, 1, 2);
EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty());
// Posted BeginRetroFrame is aborted.
@@ -1806,39 +1831,38 @@ TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
// SetNeedsCommit should begin the frame on the next BeginImplFrame.
client.Reset();
scheduler->SetNeedsCommit();
- EXPECT_TRUE(client.needs_begin_frame());
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
// Create a BeginFrame with a long deadline to avoid race conditions.
// This is the first BeginFrame, which will be handled immediately.
client.Reset();
BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src());
args.deadline += base::TimeDelta::FromHours(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// Queue BeginFrames while we are still handling the previous BeginFrame.
args.frame_time += base::TimeDelta::FromSeconds(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
args.frame_time += base::TimeDelta::FromSeconds(1);
- scheduler->BeginFrame(args);
+ client.ExternalBeginFrameSource()->TestOnBeginFrame(args);
// If we don't swap on the deadline, we wait for the next BeginImplFrame.
client.Reset();
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_NO_ACTION(client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// NotifyReadyToCommit should trigger the commit.
client.Reset();
scheduler->NotifyBeginMainFrameStarted();
scheduler->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
// BeginImplFrame should prepare the draw.
client.Reset();
@@ -1846,12 +1870,12 @@ TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_TRUE(client.needs_begin_frames());
client.Reset();
EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty());
scheduler->DidLoseOutputSurface();
- EXPECT_NO_ACTION(client);
+ EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty());
// BeginImplFrame deadline should abort drawing.
@@ -1859,7 +1883,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(client.needs_begin_frame());
+ EXPECT_FALSE(client.needs_begin_frames());
// No more BeginRetroFrame because BeginRetroFrame queue is cleared.
client.Reset();
@@ -1880,33 +1904,33 @@ TEST(SchedulerTest,
// SetNeedsCommit should begin the frame on the next BeginImplFrame.
client.Reset();
- EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive());
+ EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames());
scheduler->SetNeedsCommit();
- EXPECT_TRUE(scheduler->IsSyntheticBeginFrameSourceActive());
+ EXPECT_TRUE(scheduler->frame_source().NeedsBeginFrames());
client.Reset();
client.task_runner().RunPendingTasks(); // Run posted Tick.
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
- EXPECT_TRUE(scheduler->IsSyntheticBeginFrameSourceActive());
+ EXPECT_TRUE(scheduler->frame_source().NeedsBeginFrames());
// NotifyReadyToCommit should trigger the commit.
client.Reset();
scheduler->NotifyBeginMainFrameStarted();
scheduler->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
- EXPECT_TRUE(scheduler->IsSyntheticBeginFrameSourceActive());
+ EXPECT_TRUE(scheduler->frame_source().NeedsBeginFrames());
client.Reset();
scheduler->DidLoseOutputSurface();
- EXPECT_EQ(0, client.num_actions_());
- EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive());
+ EXPECT_NO_ACTION(client);
+ EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames());
client.Reset();
client.task_runner().RunPendingTasks(); // Run posted deadline.
EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
- EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive());
+ EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames());
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698