Index: cc/scheduler/scheduler_unittest.cc |
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc |
index 7d5a163dacc151cf2ccc2cb638f938e6ad368b19..7de59f16d6bd49e2c623c9d47c7799ef3bd8bae6 100644 |
--- a/cc/scheduler/scheduler_unittest.cc |
+++ b/cc/scheduler/scheduler_unittest.cc |
@@ -39,8 +39,21 @@ namespace { |
class FakeSchedulerClient; |
-void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, |
- FakeSchedulerClient* client); |
+class FakeBeginFrameSource : public BaseBeginFrameSource { |
+ public: |
+ FakeSchedulerClient* fake_client_; |
+ |
+ explicit FakeBeginFrameSource(FakeSchedulerClient* fake_client) |
+ : BaseBeginFrameSource(0), fake_client_(fake_client) {} |
+ |
+ virtual void OnGenerateChange(bool generate_frames) OVERRIDE; |
+ |
+ virtual inline std::string TypeString() const OVERRIDE { |
+ return "FakeBeginFrameSource"; |
+ } |
+ |
+ void TestBeginFrame(BeginFrameArgs args) { frame_sink_->BeginFrame(args); } |
+}; |
class TestScheduler : public Scheduler { |
public: |
@@ -48,9 +61,13 @@ class TestScheduler : public Scheduler { |
SchedulerClient* client, |
const SchedulerSettings& scheduler_settings, |
int layer_tree_host_id, |
+ BeginFrameSource* external_frame_source, |
const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner) { |
- return make_scoped_ptr(new TestScheduler( |
- client, scheduler_settings, layer_tree_host_id, impl_task_runner)); |
+ return make_scoped_ptr(new TestScheduler(client, |
+ scheduler_settings, |
+ layer_tree_host_id, |
+ external_frame_source, |
+ impl_task_runner)); |
} |
virtual ~TestScheduler() {} |
@@ -59,8 +76,8 @@ class TestScheduler : public Scheduler { |
return begin_retro_frame_args_.empty(); |
} |
- bool IsSyntheticBeginFrameSourceActive() const { |
- return synthetic_begin_frame_source_->IsActive(); |
+ bool IsFrameSourceGeneratingFrames() const { |
+ return frame_source_->IsGeneratingFrames(); |
} |
private: |
@@ -68,21 +85,23 @@ class TestScheduler : public Scheduler { |
SchedulerClient* client, |
const SchedulerSettings& scheduler_settings, |
int layer_tree_host_id, |
- const scoped_refptr<base::SingleThreadTaskRunner> & impl_task_runner) |
- : Scheduler(client, |
- scheduler_settings, |
- layer_tree_host_id, |
- impl_task_runner) { |
- } |
+ BeginFrameSource* external_frame_source, |
+ const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner) |
+ : Scheduler(client, |
+ scheduler_settings, |
+ layer_tree_host_id, |
+ external_frame_source, |
+ impl_task_runner) {} |
}; |
class FakeSchedulerClient : public SchedulerClient { |
public: |
FakeSchedulerClient() |
- : needs_begin_frame_(false), |
+ : generate_frames_(false), |
automatic_swap_ack_(true), |
swap_contains_incomplete_tile_(false), |
- redraw_will_happen_if_update_visible_tiles_happens_(false) { |
+ redraw_will_happen_if_update_visible_tiles_happens_(false), |
+ frame_source_(this) { |
Reset(); |
} |
@@ -97,7 +116,13 @@ class FakeSchedulerClient : public SchedulerClient { |
TestScheduler* CreateScheduler(const SchedulerSettings& settings) { |
task_runner_ = new OrderedSimpleTaskRunner; |
- scheduler_ = TestScheduler::Create(this, settings, 0, task_runner_); |
+ |
+ scheduler_ = |
+ TestScheduler::Create(this, |
+ settings, |
+ 0, |
+ static_cast<BeginFrameSource*>(&frame_source_), |
+ task_runner_); |
return scheduler_.get(); |
} |
@@ -106,7 +131,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 generate_frames() { return generate_frames_; } |
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]; } |
@@ -145,11 +170,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().release()); |
- needs_begin_frame_ = enable; |
- } |
virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE { |
actions_.push_back("WillBeginImplFrame"); |
states_.push_back(scheduler_->AsValue().release()); |
@@ -227,8 +247,10 @@ class FakeSchedulerClient : public SchedulerClient { |
virtual void DidBeginImplFrameDeadline() OVERRIDE {} |
+ FakeBeginFrameSource& frame_source() { return frame_source_; } |
+ |
protected: |
- bool needs_begin_frame_; |
+ bool generate_frames_; |
bool draw_will_happen_; |
bool swap_will_happen_if_draw_happens_; |
bool automatic_swap_ack_; |
@@ -241,8 +263,18 @@ class FakeSchedulerClient : public SchedulerClient { |
ScopedVector<base::Value> states_; |
scoped_ptr<TestScheduler> scheduler_; |
scoped_refptr<OrderedSimpleTaskRunner> task_runner_; |
+ |
+ friend class FakeBeginFrameSource; |
+ FakeBeginFrameSource frame_source_; |
}; |
+void FakeBeginFrameSource::OnGenerateChange(bool generate_frames) { |
+ fake_client_->actions_.push_back("SetGenerateFrames"); |
+ fake_client_->states_.push_back( |
+ fake_client_->scheduler_->AsValue().release()); |
+ fake_client_->generate_frames_ = generate_frames; |
+} |
+ |
void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, |
FakeSchedulerClient* client) { |
bool client_initiates_begin_frame = |
@@ -257,7 +289,7 @@ void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, |
scheduler->NotifyReadyToActivate(); |
// Go through the motions to draw the commit. |
if (client_initiates_begin_frame) |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client->frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
else |
client->task_runner().RunPendingTasks(); // Run posted BeginFrame. |
@@ -266,13 +298,17 @@ void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, |
client->task_runner().RunPendingTasks(); |
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
+ // EXPECT_TRUE(client->generate_frames()); |
+ |
// We need another BeginImplFrame so Scheduler calls |
- // SetNeedsBeginFrame(false). |
+ // SetGenerateFrames(false). |
if (client_initiates_begin_frame) |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client->frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
else |
client->task_runner().RunPendingTasks(); // Run posted BeginFrame. |
+ // EXPECT_FALSE(client->generate_frames()); |
+ |
// Run the posted deadline task. |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
client->task_runner().RunPendingTasks(); |
@@ -307,56 +343,56 @@ 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_TRUE(client.generate_frames()); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", client); |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
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.generate_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.generate_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.generate_frames()); |
client.Reset(); |
// BeginImplFrame should prepare the draw. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
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.generate_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.generate_frames()); |
client.Reset(); |
- // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) |
+ // The following BeginImplFrame deadline should SetGenerateFrames(false) |
// to avoid excessive toggles. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
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("SetGenerateFrames", client); |
+ EXPECT_FALSE(client.generate_frames()); |
client.Reset(); |
} |
@@ -374,15 +410,15 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) { |
// SetNeedsCommit should begin the frame. |
scheduler->SetNeedsCommit(); |
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", client); |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
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.generate_frames()); |
client.Reset(); |
// Now SetNeedsCommit again. Calling here means we need a second commit. |
@@ -403,11 +439,11 @@ 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.generate_frames()); |
client.Reset(); |
// Since another commit is needed, the next BeginImplFrame should initiate |
// the second commit. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
@@ -424,14 +460,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.generate_frames()); |
client.Reset(); |
// On the next BeginImplFrame, verify we go back to a quiescent state and |
// no longer request BeginImplFrames. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
- EXPECT_FALSE(client.needs_begin_frame()); |
+ EXPECT_FALSE(client.generate_frames()); |
client.Reset(); |
} |
@@ -472,28 +508,28 @@ TEST(SchedulerTest, RequestRedrawInsideDraw) { |
scheduler->SetNeedsRedraw(); |
EXPECT_TRUE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
EXPECT_EQ(0, client.num_draws()); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
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.generate_frames()); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
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.generate_frames()); |
// We stop requesting BeginImplFrames after a BeginImplFrame where we don't |
// swap. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
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.generate_frames()); |
} |
// Test that requesting redraw inside a failed draw doesn't lose the request. |
@@ -511,11 +547,11 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { |
scheduler->SetNeedsRedraw(); |
EXPECT_TRUE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
EXPECT_EQ(0, client.num_draws()); |
// Fail the draw. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client.num_draws()); |
@@ -523,24 +559,24 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { |
// request. |
EXPECT_TRUE(scheduler->CommitPending()); |
EXPECT_TRUE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
// Fail the draw again. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(2, client.num_draws()); |
EXPECT_TRUE(scheduler->CommitPending()); |
EXPECT_TRUE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
// Draw successfully. |
client.SetDrawWillHappen(true); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(3, client.num_draws()); |
EXPECT_TRUE(scheduler->CommitPending()); |
EXPECT_FALSE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
} |
class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient { |
@@ -586,38 +622,38 @@ TEST(SchedulerTest, RequestCommitInsideDraw) { |
InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
client.Reset(); |
- EXPECT_FALSE(client.needs_begin_frame()); |
+ EXPECT_FALSE(client.generate_frames()); |
scheduler->SetNeedsRedraw(); |
EXPECT_TRUE(scheduler->RedrawPending()); |
EXPECT_EQ(0, client.num_draws()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
client.SetNeedsCommitOnNextDraw(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.SetNeedsCommitOnNextDraw(); |
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.generate_frames()); |
scheduler->NotifyBeginMainFrameStarted(); |
scheduler->NotifyReadyToCommit(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(2, client.num_draws()); |
EXPECT_FALSE(scheduler->RedrawPending()); |
EXPECT_FALSE(scheduler->CommitPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
// We stop requesting BeginImplFrames after a BeginImplFrame where we don't |
// swap. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(2, client.num_draws()); |
EXPECT_FALSE(scheduler->RedrawPending()); |
EXPECT_FALSE(scheduler->CommitPending()); |
- EXPECT_FALSE(client.needs_begin_frame()); |
+ EXPECT_FALSE(client.generate_frames()); |
} |
// Tests that when a draw fails then the pending commit should not be dropped. |
@@ -635,11 +671,11 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) { |
scheduler->SetNeedsRedraw(); |
EXPECT_TRUE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
EXPECT_EQ(0, client.num_draws()); |
// Fail the draw. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client.num_draws()); |
@@ -647,25 +683,25 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) { |
// request. |
EXPECT_TRUE(scheduler->CommitPending()); |
EXPECT_TRUE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
// Fail the draw again. |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(2, client.num_draws()); |
EXPECT_TRUE(scheduler->CommitPending()); |
EXPECT_TRUE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
// Draw successfully. |
client.SetDrawWillHappen(true); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(3, client.num_draws()); |
EXPECT_TRUE(scheduler->CommitPending()); |
EXPECT_FALSE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
} |
TEST(SchedulerTest, NoSwapWhenDrawFails) { |
@@ -680,23 +716,23 @@ TEST(SchedulerTest, NoSwapWhenDrawFails) { |
scheduler->SetNeedsRedraw(); |
EXPECT_TRUE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
EXPECT_EQ(0, client.num_draws()); |
// Draw successfully, this starts a new frame. |
client.SetNeedsCommitOnNextDraw(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(1, client.num_draws()); |
scheduler->SetNeedsRedraw(); |
EXPECT_TRUE(scheduler->RedrawPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
// Fail to draw, this should not start a frame. |
client.SetDrawWillHappen(false); |
client.SetNeedsCommitOnNextDraw(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(2, client.num_draws()); |
} |
@@ -727,7 +763,7 @@ TEST(SchedulerTest, ManageTiles) { |
scheduler->SetNeedsRedraw(); |
EXPECT_TRUE(scheduler->RedrawPending()); |
EXPECT_TRUE(scheduler->ManageTilesPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
EXPECT_EQ(0, client.num_draws()); |
EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); |
EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
@@ -735,7 +771,7 @@ TEST(SchedulerTest, ManageTiles) { |
// We have no immediate actions to perform, so the BeginImplFrame should post |
// the deadline task. |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
@@ -757,13 +793,13 @@ TEST(SchedulerTest, ManageTiles) { |
scheduler->SetNeedsRedraw(); |
EXPECT_TRUE(scheduler->RedrawPending()); |
EXPECT_FALSE(scheduler->ManageTilesPending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
EXPECT_EQ(0, client.num_draws()); |
// We have no immediate actions to perform, so the BeginImplFrame should post |
// the deadline task. |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
@@ -784,28 +820,28 @@ TEST(SchedulerTest, ManageTiles) { |
// We need a BeginImplFrame where we don't swap to go idle. |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
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("SetGenerateFrames", client); |
+ EXPECT_FALSE(client.generate_frames()); |
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.generate_frames()); |
scheduler->SetNeedsManageTiles(); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
EXPECT_TRUE(scheduler->ManageTilesPending()); |
EXPECT_FALSE(scheduler->RedrawPending()); |
// BeginImplFrame. There will be no draw, only ManageTiles. |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
client.Reset(); |
@@ -831,7 +867,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
scheduler->SetNeedsManageTiles(); |
scheduler->SetNeedsRedraw(); |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
@@ -853,7 +889,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
scheduler->SetNeedsManageTiles(); |
scheduler->SetNeedsRedraw(); |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
@@ -876,7 +912,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
scheduler->SetNeedsManageTiles(); |
scheduler->SetNeedsRedraw(); |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
@@ -899,7 +935,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
scheduler->SetNeedsManageTiles(); |
scheduler->SetNeedsRedraw(); |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
@@ -918,7 +954,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
scheduler->SetNeedsManageTiles(); |
scheduler->SetNeedsRedraw(); |
client.Reset(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
@@ -951,7 +987,7 @@ TEST(SchedulerTest, ShouldUpdateVisibleTiles) { |
// SetNeedsCommit should begin the frame. |
client.Reset(); |
scheduler->SetNeedsCommit(); |
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", client); |
client.Reset(); |
scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
@@ -994,8 +1030,8 @@ 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("SetGenerateFrames", client); |
+ EXPECT_FALSE(client.generate_frames()); |
} |
TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) { |
@@ -1009,7 +1045,7 @@ TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) { |
client.Reset(); |
scheduler->SetNeedsRedraw(); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
// The deadline should be zero since there is no work other than drawing |
// pending. |
@@ -1065,7 +1101,7 @@ void MainFrameInHighLatencyMode(int64 begin_main_frame_to_commit_estimate_in_ms, |
client.Reset(); |
scheduler->SetNeedsCommit(); |
EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
@@ -1077,7 +1113,7 @@ void MainFrameInHighLatencyMode(int64 begin_main_frame_to_commit_estimate_in_ms, |
client.Reset(); |
scheduler->SetNeedsCommit(); |
EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
- scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
+ client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting()); |
EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_EQ(scheduler->MainThreadIsInHighLatencyMode(), |
@@ -1136,7 +1172,7 @@ TEST(SchedulerTest, PollForCommitCompletion) { |
BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting(); |
frame_args.interval = base::TimeDelta::FromMilliseconds(1000); |
- scheduler->BeginFrame(frame_args); |
+ client.frame_source().TestBeginFrame(frame_args); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
@@ -1149,7 +1185,7 @@ TEST(SchedulerTest, PollForCommitCompletion) { |
// the NotifyReadyToCommit for now. |
EXPECT_FALSE(scheduler->CommitPending()); |
scheduler->SetNeedsCommit(); |
- scheduler->BeginFrame(frame_args); |
+ client.frame_source().TestBeginFrame(frame_args); |
EXPECT_TRUE(scheduler->CommitPending()); |
// Draw and swap the frame, but don't ack the swap to simulate the Browser |
@@ -1201,39 +1237,39 @@ 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_TRUE(client.generate_frames()); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", 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(); |
args.deadline += base::TimeDelta::FromHours(1); |
- scheduler->BeginFrame(args); |
+ client.frame_source().TestBeginFrame(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.generate_frames()); |
client.Reset(); |
// Queue BeginFrames while we are still handling the previous BeginFrame. |
args.frame_time += base::TimeDelta::FromSeconds(1); |
- scheduler->BeginFrame(args); |
+ client.frame_source().TestBeginFrame(args); |
args.frame_time += base::TimeDelta::FromSeconds(1); |
- scheduler->BeginFrame(args); |
+ client.frame_source().TestBeginFrame(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.generate_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.generate_frames()); |
client.Reset(); |
// BeginImplFrame should prepare the draw. |
@@ -1241,17 +1277,17 @@ 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.generate_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.generate_frames()); |
client.Reset(); |
- // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) |
+ // The following BeginImplFrame deadline should SetGenerateFrames(false) |
// to avoid excessive toggles. |
client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. |
EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
@@ -1259,8 +1295,8 @@ 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("SetGenerateFrames", client); |
+ EXPECT_FALSE(client.generate_frames()); |
client.Reset(); |
} |
@@ -1280,25 +1316,25 @@ 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_TRUE(client.generate_frames()); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", 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(); |
args.deadline += base::TimeDelta::FromHours(1); |
- scheduler->BeginFrame(args); |
+ client.frame_source().TestBeginFrame(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.generate_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.frame_source().TestBeginFrame(args); |
EXPECT_NO_ACTION(client); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
client.Reset(); |
@@ -1307,7 +1343,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) { |
scheduler->NotifyBeginMainFrameStarted(); |
scheduler->NotifyReadyToCommit(); |
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
client.Reset(); |
// Swapping will put us into a swap throttled state. |
@@ -1315,7 +1351,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.generate_frames()); |
client.Reset(); |
// While swap throttled, BeginRetroFrames should trigger BeginImplFrames |
@@ -1324,22 +1360,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.generate_frames()); |
client.Reset(); |
// Queue BeginFrame while we are still handling the previous BeginFrame. |
args.frame_time += base::TimeDelta::FromSeconds(1); |
- scheduler->BeginFrame(args); |
+ client.frame_source().TestBeginFrame(args); |
EXPECT_NO_ACTION(client); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_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.generate_frames()); |
client.Reset(); |
// BeginImplFrame deadline should draw. |
@@ -1348,7 +1384,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.generate_frames()); |
client.Reset(); |
} |
@@ -1366,10 +1402,10 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled, |
InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
// SetNeedsCommit should begin the frame on the next BeginImplFrame |
- // without calling SetNeedsBeginFrame. |
+ // without calling SetGenerateFrames. |
client.Reset(); |
scheduler->SetNeedsCommit(); |
- EXPECT_FALSE(client.needs_begin_frame()); |
+ EXPECT_FALSE(client.generate_frames()); |
EXPECT_NO_ACTION(client); |
client.Reset(); |
@@ -1379,21 +1415,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.generate_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.generate_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.generate_frames()); |
client.Reset(); |
// BeginImplFrame should prepare the draw. |
@@ -1401,28 +1437,28 @@ 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.generate_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_FALSE(client.needs_begin_frame()); |
+ EXPECT_FALSE(client.generate_frames()); |
client.Reset(); |
- // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) |
+ // The following BeginImplFrame deadline should SetGenerateFrames(false) |
// to avoid excessive toggles. |
client.task_runner().RunPendingTasks(); // Run posted BeginFrame. |
EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
client.Reset(); |
- // Make sure SetNeedsBeginFrame isn't called on the client |
+ // Make sure SetGenerateFrames isn't called on the client |
// 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.generate_frames()); |
client.Reset(); |
} |
@@ -1467,7 +1503,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.generate_frames()); |
EXPECT_NO_ACTION(client); |
client.Reset(); |
@@ -1476,14 +1512,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.generate_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.generate_frames()); |
client.Reset(); |
// Swapping will put us into a swap throttled state. |
@@ -1491,7 +1527,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.generate_frames()); |
client.Reset(); |
// While swap throttled, BeginFrames should trigger BeginImplFrames, |
@@ -1500,14 +1536,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.generate_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.generate_frames()); |
client.Reset(); |
// BeginImplFrame deadline should draw. |
@@ -1516,7 +1552,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.generate_frames()); |
client.Reset(); |
} |
@@ -1572,7 +1608,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) { |
// SetNeedsCommit should begin the frame. |
client.Reset(); |
scheduler->SetNeedsCommit(); |
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", client); |
client.Reset(); |
scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
@@ -1611,7 +1647,7 @@ void DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency( |
// SetNeedsCommit should begin the frame. |
client.Reset(); |
scheduler->SetNeedsCommit(); |
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", client); |
client.Reset(); |
scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
@@ -1674,7 +1710,7 @@ void DidLoseOutputSurfaceAfterReadyToCommit(bool impl_side_painting) { |
// SetNeedsCommit should begin the frame. |
client.Reset(); |
scheduler->SetNeedsCommit(); |
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", client); |
client.Reset(); |
scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
@@ -1722,8 +1758,8 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsManageTiles) { |
client.Reset(); |
scheduler->SetNeedsManageTiles(); |
scheduler->SetNeedsRedraw(); |
- EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", client); |
+ EXPECT_TRUE(client.generate_frames()); |
client.Reset(); |
scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
@@ -1753,8 +1789,8 @@ 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_TRUE(client.generate_frames()); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", client); |
// Create a BeginFrame with a long deadline to avoid race conditions. |
// This is the first BeginFrame, which will be handled immediately. |
@@ -1765,7 +1801,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) { |
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.generate_frames()); |
// Queue BeginFrames while we are still handling the previous BeginFrame. |
args.frame_time += base::TimeDelta::FromSeconds(1); |
@@ -1778,20 +1814,20 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) { |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_NO_ACTION(client); |
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_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.generate_frames()); |
client.Reset(); |
EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty()); |
scheduler->DidLoseOutputSurface(); |
EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_frames()); |
EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty()); |
// Posted BeginRetroFrame is aborted. |
@@ -1812,8 +1848,8 @@ 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_TRUE(client.generate_frames()); |
+ EXPECT_SINGLE_ACTION("SetGenerateFrames", client); |
// Create a BeginFrame with a long deadline to avoid race conditions. |
// This is the first BeginFrame, which will be handled immediately. |
@@ -1824,7 +1860,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) { |
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.generate_frames()); |
// Queue BeginFrames while we are still handling the previous BeginFrame. |
args.frame_time += base::TimeDelta::FromSeconds(1); |
@@ -1837,14 +1873,14 @@ TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) { |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_NO_ACTION(client); |
EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
- EXPECT_TRUE(client.needs_begin_frame()); |
+ EXPECT_TRUE(client.generate_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.generate_frames()); |
// BeginImplFrame should prepare the draw. |
client.Reset(); |
@@ -1852,7 +1888,7 @@ 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.generate_frames()); |
client.Reset(); |
EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty()); |
@@ -1865,7 +1901,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_TRUE(client.generate_frames()); |
// No more BeginRetroFrame because BeginRetroFrame queue is cleared. |
client.Reset(); |
@@ -1886,33 +1922,33 @@ TEST(SchedulerTest, |
// SetNeedsCommit should begin the frame on the next BeginImplFrame. |
client.Reset(); |
- EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive()); |
+ EXPECT_FALSE(scheduler->IsFrameSourceGeneratingFrames()); |
scheduler->SetNeedsCommit(); |
- EXPECT_TRUE(scheduler->IsSyntheticBeginFrameSourceActive()); |
+ EXPECT_TRUE(scheduler->IsFrameSourceGeneratingFrames()); |
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->IsFrameSourceGeneratingFrames()); |
// NotifyReadyToCommit should trigger the commit. |
client.Reset(); |
scheduler->NotifyBeginMainFrameStarted(); |
scheduler->NotifyReadyToCommit(); |
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
- EXPECT_TRUE(scheduler->IsSyntheticBeginFrameSourceActive()); |
+ EXPECT_TRUE(scheduler->IsFrameSourceGeneratingFrames()); |
client.Reset(); |
scheduler->DidLoseOutputSurface(); |
EXPECT_EQ(0, client.num_actions_()); |
- EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive()); |
+ EXPECT_FALSE(scheduler->IsFrameSourceGeneratingFrames()); |
client.Reset(); |
client.task_runner().RunPendingTasks(); // Run posted deadline. |
EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
- EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive()); |
+ EXPECT_FALSE(scheduler->IsFrameSourceGeneratingFrames()); |
} |
} // namespace |