Chromium Code Reviews| Index: cc/scheduler/scheduler_unittest.cc |
| diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc |
| index f416cec008fabc87c04786e619bc2b1bb0ffea5d..2ab1010d1642623225ded3d6398a2705bda18259 100644 |
| --- a/cc/scheduler/scheduler_unittest.cc |
| +++ b/cc/scheduler/scheduler_unittest.cc |
| @@ -43,40 +43,6 @@ class FakeSchedulerClient; |
| void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, |
| FakeSchedulerClient* client); |
| -class TestScheduler : public Scheduler { |
| - public: |
| - static scoped_ptr<TestScheduler> Create( |
| - SchedulerClient* client, |
| - const SchedulerSettings& scheduler_settings, |
| - int layer_tree_host_id, |
| - const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner) { |
| - return make_scoped_ptr(new TestScheduler( |
| - client, scheduler_settings, layer_tree_host_id, impl_task_runner)); |
| - } |
| - |
| - virtual ~TestScheduler() {} |
| - |
| - bool IsBeginRetroFrameArgsEmpty() const { |
| - return begin_retro_frame_args_.empty(); |
| - } |
| - |
| - bool IsSyntheticBeginFrameSourceActive() const { |
| - return synthetic_begin_frame_source_->IsActive(); |
| - } |
| - |
| - private: |
| - TestScheduler( |
| - 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) { |
| - } |
| -}; |
| - |
| class FakeSchedulerClient : public SchedulerClient { |
| public: |
| FakeSchedulerClient() |
| @@ -97,8 +63,7 @@ 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); |
| return scheduler_.get(); |
| } |
| @@ -116,7 +81,7 @@ class FakeSchedulerClient : public SchedulerClient { |
| return posted_begin_impl_frame_deadline_; |
| } |
| - OrderedSimpleTaskRunner& task_runner() { return *task_runner_; } |
| + OrderedSimpleTaskRunner& task_runner() { return scheduler_->task_runner(); } |
| int ActionIndex(const char* action) const { |
| for (size_t i = 0; i < actions_.size(); i++) |
| @@ -241,7 +206,6 @@ class FakeSchedulerClient : public SchedulerClient { |
| std::vector<const char*> actions_; |
| std::vector<scoped_refptr<base::debug::ConvertableToTraceFormat> > states_; |
| scoped_ptr<TestScheduler> scheduler_; |
| - scoped_refptr<OrderedSimpleTaskRunner> task_runner_; |
| }; |
| void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, |
| @@ -258,24 +222,24 @@ void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, |
| scheduler->NotifyReadyToActivate(); |
| // Go through the motions to draw the commit. |
| if (client_initiates_begin_frame) |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame( |
| + CreateBeginFrameArgsForTesting(client->task_runner())); |
| else |
| client->task_runner().RunPendingTasks(); // Run posted BeginFrame. |
| // Run the posted deadline task. |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| client->task_runner().RunPendingTasks(); |
|
brianderson
2014/08/22 23:34:26
Thanks for attaching the diff, it made it very cle
|
| - EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
|
brianderson
2014/08/20 20:04:30
Why was this removed? If this expectation is no lo
mithro-old
2014/08/21 17:39:18
There is a lot of complexity here that I'm finding
brianderson
2014/08/21 21:48:52
In your description of the possible states at line
|
| // We need another BeginImplFrame so Scheduler calls |
| // SetNeedsBeginFrame(false). |
| if (client_initiates_begin_frame) |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame( |
| + CreateBeginFrameArgsForTesting(client->task_runner())); |
| else |
| client->task_runner().RunPendingTasks(); // Run posted BeginFrame. |
| // Run the posted deadline task. |
| - EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
|
brianderson
2014/08/20 20:04:30
Why was this removed?
mithro-old
2014/08/21 17:39:18
See above.
|
| client->task_runner().RunPendingTasks(); |
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
| } |
| @@ -312,7 +276,7 @@ TEST(SchedulerTest, RequestCommit) { |
| EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -334,7 +298,7 @@ TEST(SchedulerTest, RequestCommit) { |
| client.Reset(); |
| // BeginImplFrame should prepare the draw. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -350,7 +314,7 @@ TEST(SchedulerTest, RequestCommit) { |
| // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) |
| // to avoid excessive toggles. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| client.Reset(); |
| @@ -378,7 +342,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) { |
| EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -408,7 +372,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) { |
| client.Reset(); |
| // Since another commit is needed, the next BeginImplFrame should initiate |
| // the second commit. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -430,7 +394,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) { |
| // On the next BeginImplFrame, verify we go back to a quiescent state and |
| // no longer request BeginImplFrames. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_FALSE(client.needs_begin_frame()); |
| client.Reset(); |
| @@ -476,13 +440,13 @@ TEST(SchedulerTest, RequestRedrawInsideDraw) { |
| EXPECT_TRUE(client.needs_begin_frame()); |
| EXPECT_EQ(0, client.num_draws()); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(1, client.num_draws()); |
| EXPECT_TRUE(scheduler->RedrawPending()); |
| EXPECT_TRUE(client.needs_begin_frame()); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(2, client.num_draws()); |
| EXPECT_FALSE(scheduler->RedrawPending()); |
| @@ -490,7 +454,7 @@ TEST(SchedulerTest, RequestRedrawInsideDraw) { |
| // We stop requesting BeginImplFrames after a BeginImplFrame where we don't |
| // swap. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(2, client.num_draws()); |
| EXPECT_FALSE(scheduler->RedrawPending()); |
| @@ -516,7 +480,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { |
| EXPECT_EQ(0, client.num_draws()); |
| // Fail the draw. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(1, client.num_draws()); |
| @@ -527,7 +491,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { |
| EXPECT_TRUE(client.needs_begin_frame()); |
| // Fail the draw again. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(2, client.num_draws()); |
| EXPECT_TRUE(scheduler->CommitPending()); |
| @@ -536,7 +500,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { |
| // Draw successfully. |
| client.SetDrawWillHappen(true); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(3, client.num_draws()); |
| EXPECT_TRUE(scheduler->CommitPending()); |
| @@ -594,7 +558,7 @@ TEST(SchedulerTest, RequestCommitInsideDraw) { |
| EXPECT_TRUE(client.needs_begin_frame()); |
| client.SetNeedsCommitOnNextDraw(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.SetNeedsCommitOnNextDraw(); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(1, client.num_draws()); |
| @@ -603,7 +567,7 @@ TEST(SchedulerTest, RequestCommitInsideDraw) { |
| scheduler->NotifyBeginMainFrameStarted(); |
| scheduler->NotifyReadyToCommit(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(2, client.num_draws()); |
| @@ -613,7 +577,7 @@ TEST(SchedulerTest, RequestCommitInsideDraw) { |
| // We stop requesting BeginImplFrames after a BeginImplFrame where we don't |
| // swap. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(2, client.num_draws()); |
| EXPECT_FALSE(scheduler->RedrawPending()); |
| @@ -640,7 +604,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) { |
| EXPECT_EQ(0, client.num_draws()); |
| // Fail the draw. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(1, client.num_draws()); |
| @@ -651,7 +615,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) { |
| EXPECT_TRUE(client.needs_begin_frame()); |
| // Fail the draw again. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(2, client.num_draws()); |
| @@ -661,7 +625,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) { |
| // Draw successfully. |
| client.SetDrawWillHappen(true); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(3, client.num_draws()); |
| EXPECT_TRUE(scheduler->CommitPending()); |
| @@ -686,7 +650,7 @@ TEST(SchedulerTest, NoSwapWhenDrawFails) { |
| // Draw successfully, this starts a new frame. |
| client.SetNeedsCommitOnNextDraw(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(1, client.num_draws()); |
| @@ -697,7 +661,7 @@ TEST(SchedulerTest, NoSwapWhenDrawFails) { |
| // Fail to draw, this should not start a frame. |
| client.SetDrawWillHappen(false); |
| client.SetNeedsCommitOnNextDraw(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(2, client.num_draws()); |
| } |
| @@ -736,7 +700,7 @@ TEST(SchedulerTest, ManageTiles) { |
| // We have no immediate actions to perform, so the BeginImplFrame should post |
| // the deadline task. |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -764,7 +728,7 @@ TEST(SchedulerTest, ManageTiles) { |
| // We have no immediate actions to perform, so the BeginImplFrame should post |
| // the deadline task. |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -785,7 +749,7 @@ TEST(SchedulerTest, ManageTiles) { |
| // We need a BeginImplFrame where we don't swap to go idle. |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| client.Reset(); |
| @@ -806,7 +770,7 @@ TEST(SchedulerTest, ManageTiles) { |
| // BeginImplFrame. There will be no draw, only ManageTiles. |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| client.Reset(); |
| @@ -832,7 +796,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
| scheduler->SetNeedsManageTiles(); |
| scheduler->SetNeedsRedraw(); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -854,7 +818,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
| scheduler->SetNeedsManageTiles(); |
| scheduler->SetNeedsRedraw(); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -877,7 +841,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
| scheduler->SetNeedsManageTiles(); |
| scheduler->SetNeedsRedraw(); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -900,7 +864,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
| scheduler->SetNeedsManageTiles(); |
| scheduler->SetNeedsRedraw(); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -919,7 +883,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) { |
| scheduler->SetNeedsManageTiles(); |
| scheduler->SetNeedsRedraw(); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -955,7 +919,7 @@ TEST(SchedulerTest, ShouldUpdateVisibleTiles) { |
| EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -977,7 +941,7 @@ TEST(SchedulerTest, ShouldUpdateVisibleTiles) { |
| EXPECT_FALSE(scheduler->RedrawPending()); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -988,7 +952,7 @@ TEST(SchedulerTest, ShouldUpdateVisibleTiles) { |
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 2, 3); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -1010,7 +974,7 @@ TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) { |
| client.Reset(); |
| scheduler->SetNeedsRedraw(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| // The deadline should be zero since there is no work other than drawing |
| // pending. |
| @@ -1066,7 +1030,7 @@ void MainFrameInHighLatencyMode(int64 begin_main_frame_to_commit_estimate_in_ms, |
| client.Reset(); |
| scheduler->SetNeedsCommit(); |
| EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
| @@ -1078,7 +1042,7 @@ void MainFrameInHighLatencyMode(int64 begin_main_frame_to_commit_estimate_in_ms, |
| client.Reset(); |
| scheduler->SetNeedsCommit(); |
| EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_EQ(scheduler->MainThreadIsInHighLatencyMode(), |
| @@ -1135,7 +1099,8 @@ TEST(SchedulerTest, PollForCommitCompletion) { |
| scheduler->NotifyReadyToCommit(); |
| scheduler->SetNeedsRedraw(); |
| - BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting(); |
| + BeginFrameArgs frame_args = |
| + CreateBeginFrameArgsForTesting(client.task_runner()); |
| frame_args.interval = base::TimeDelta::FromMilliseconds(1000); |
| scheduler->BeginFrame(frame_args); |
| @@ -1167,7 +1132,7 @@ TEST(SchedulerTest, PollForCommitCompletion) { |
| // Does three iterations to make sure that the timer is properly repeating. |
| for (int i = 0; i < 3; ++i) { |
| EXPECT_EQ((frame_args.interval * 2).InMicroseconds(), |
| - client.task_runner().NextPendingTaskDelay().InMicroseconds()) |
| + client.task_runner().DelayToNextPendingTask().InMicroseconds()) |
| << scheduler->AsValue()->ToString(); |
| client.task_runner().RunPendingTasks(); |
| EXPECT_GT(client.num_actions_(), actions_so_far); |
| @@ -1180,7 +1145,7 @@ TEST(SchedulerTest, PollForCommitCompletion) { |
| scheduler->NotifyBeginMainFrameStarted(); |
| for (int i = 0; i < 3; ++i) { |
| EXPECT_EQ((frame_args.interval * 2).InMicroseconds(), |
| - client.task_runner().NextPendingTaskDelay().InMicroseconds()) |
| + client.task_runner().DelayToNextPendingTask().InMicroseconds()) |
| << scheduler->AsValue()->ToString(); |
| client.task_runner().RunPendingTasks(); |
| EXPECT_GT(client.num_actions_(), actions_so_far); |
| @@ -1208,7 +1173,7 @@ TEST(SchedulerTest, BeginRetroFrame) { |
| // Create a BeginFrame with a long deadline to avoid race conditions. |
| // This is the first BeginFrame, which will be handled immediately. |
| - BeginFrameArgs args = CreateBeginFrameArgsForTesting(); |
| + BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.task_runner()); |
| args.deadline += base::TimeDelta::FromHours(1); |
| scheduler->BeginFrame(args); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| @@ -1287,7 +1252,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) { |
| // Create a BeginFrame with a long deadline to avoid race conditions. |
| // This is the first BeginFrame, which will be handled immediately. |
| - BeginFrameArgs args = CreateBeginFrameArgsForTesting(); |
| + BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.task_runner()); |
| args.deadline += base::TimeDelta::FromHours(1); |
| scheduler->BeginFrame(args); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| @@ -1345,6 +1310,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) { |
| // BeginImplFrame deadline should draw. |
| scheduler->SetNeedsRedraw(); |
| + client.task_runner().SetNow(base::TimeTicks::FromInternalValue(1133332)); |
|
Sami
2014/08/19 18:45:04
Does this value have any significance? Could we co
mithro-old
2014/08/21 17:39:18
Done.
|
| client.task_runner().RunPendingTasks(); // Run posted deadline. |
| EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); |
| @@ -1577,7 +1543,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) { |
| EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -1616,7 +1582,7 @@ void DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency( |
| EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -1633,7 +1599,7 @@ void DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency( |
| EXPECT_NO_ACTION(client); |
| // BeginImplFrame is not started. |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_NO_ACTION(client); |
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -1679,7 +1645,7 @@ void DidLoseOutputSurfaceAfterReadyToCommit(bool impl_side_painting) { |
| EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -1728,7 +1694,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsManageTiles) { |
| EXPECT_TRUE(client.needs_begin_frame()); |
| client.Reset(); |
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); |
| + scheduler->BeginFrame(CreateBeginFrameArgsForTesting(client.task_runner())); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| @@ -1761,7 +1727,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) { |
| // 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(); |
| + BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.task_runner()); |
| args.deadline += base::TimeDelta::FromHours(1); |
| scheduler->BeginFrame(args); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| @@ -1820,7 +1786,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) { |
| // 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(); |
| + BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.task_runner()); |
| args.deadline += base::TimeDelta::FromHours(1); |
| scheduler->BeginFrame(args); |
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |