Chromium Code Reviews| Index: cc/trees/layer_tree_host_unittest.cc |
| diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc |
| index be879af1384d097e5b7d9ef53ec4ea1603c10248..a1676124ba25e769813e004e3acdfe202412b718 100644 |
| --- a/cc/trees/layer_tree_host_unittest.cc |
| +++ b/cc/trees/layer_tree_host_unittest.cc |
| @@ -2283,7 +2283,8 @@ class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { |
| void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| - void WillBeginImplFrame(const BeginFrameArgs& args) override { |
| + void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, |
| + const BeginFrameArgs& args) override { |
| num_will_begin_impl_frame_++; |
| switch (num_will_begin_impl_frame_) { |
| case 1: |
| @@ -5493,6 +5494,72 @@ class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest { |
| MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| +class LayerTreeHostTestWillBeginImplFrameHasDidFinishImplFrame |
| + : public LayerTreeHostTest { |
| + public: |
| + enum { kExpectedNumImplFrames = 10 }; |
| + |
| + LayerTreeHostTestWillBeginImplFrameHasDidFinishImplFrame() |
| + : threaded_(false), |
| + will_begin_impl_frame_count_(0), |
| + did_finish_impl_frame_count_(0) {} |
| + |
| + void RunTest(bool threaded, |
| + bool delegating_renderer, |
| + bool impl_side_painting) override { |
| + threaded_ = threaded; |
| + LayerTreeHostTest::RunTest(threaded, delegating_renderer, |
| + impl_side_painting); |
| + } |
| + |
| + void BeginTest() override { |
| + // Kick off the test with a commit. |
| + PostSetNeedsCommitToMainThread(); |
| + } |
| + |
| + void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, |
| + const BeginFrameArgs& args) override { |
| + EXPECT_EQ(will_begin_impl_frame_count_, did_finish_impl_frame_count_); |
| + EXPECT_FALSE(TestEnded()); |
| + will_begin_impl_frame_count_++; |
| + } |
| + |
| + void DidFinishImplFrameOnThread(LayerTreeHostImpl* host_impl) override { |
| + did_finish_impl_frame_count_++; |
| + EXPECT_EQ(will_begin_impl_frame_count_, did_finish_impl_frame_count_); |
| + |
| + // Request a number of commits to cause multiple impl frames. We expect to |
| + // get one more impl frames than the number of commits requested because |
| + // after a commit it takes one frame to become idle. |
| + if (did_finish_impl_frame_count_ < kExpectedNumImplFrames - 1) |
| + PostSetNeedsCommitToMainThread(); |
| + } |
| + |
| + void SendBeginMainFrameNotExpectedSoon() override { EndTest(); } |
| + |
| + void AfterTest() override { |
| + EXPECT_GT(will_begin_impl_frame_count_, 0); |
| + EXPECT_GT(did_finish_impl_frame_count_, 0); |
| + EXPECT_EQ(will_begin_impl_frame_count_, did_finish_impl_frame_count_); |
| + |
| + // TODO(mithro): Figure out why the multithread version of this test |
| + // sometimes has one more frame then expected. Possibly related to |
| + // http://crbug.com/443185 |
| + if (!threaded_) { |
|
danakj
2015/05/04 17:39:19
You can just do HasImplThread() there's a function
mithro-old
2015/05/05 04:13:13
I tried to use HasImplThread() here but it seems t
danakj
2015/05/05 18:42:00
It looks to me that your threaded_ is always false
mithro-old
2015/05/06 02:14:11
I tracked down the issue and uploaded a patch at h
|
| + EXPECT_EQ(will_begin_impl_frame_count_, kExpectedNumImplFrames); |
| + EXPECT_EQ(did_finish_impl_frame_count_, kExpectedNumImplFrames); |
| + } |
| + } |
| + |
| + private: |
| + bool threaded_; |
| + int will_begin_impl_frame_count_; |
| + int did_finish_impl_frame_count_; |
| +}; |
| + |
| +SINGLE_AND_MULTI_THREAD_TEST_F( |
| + LayerTreeHostTestWillBeginImplFrameHasDidFinishImplFrame); |
| + |
| class LayerTreeHostTestSendBeginFramesToChildren : public LayerTreeHostTest { |
| public: |
| LayerTreeHostTestSendBeginFramesToChildren() |