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..902281943c058cc67c78e1433ac43974ee24c980 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,60 @@ class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest { |
MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
+class LayerTreeHostTestWillBeginImplFrameHasDidBeginImplFrameDeadline |
+ : public LayerTreeHostTest { |
+ public: |
+ enum { kExpectedNumImplFrames = 10 }; |
+ |
+ LayerTreeHostTestWillBeginImplFrameHasDidBeginImplFrameDeadline() |
+ : will_begin_impl_frame_count_(0), |
+ did_begin_impl_frame_deadline_count_(0) {} |
+ |
+ 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_begin_impl_frame_deadline_count_); |
+ EXPECT_FALSE(TestEnded()); |
+ will_begin_impl_frame_count_++; |
+ } |
+ |
+ void DidBeginImplFrameDeadlineOnThread( |
+ LayerTreeHostImpl* host_impl) override { |
+ EXPECT_EQ(will_begin_impl_frame_count_, |
+ did_begin_impl_frame_deadline_count_ + 1); |
danakj
2015/04/30 18:43:38
nit: reverse the order of the increment with this
mithro-old
2015/05/01 02:52:35
Done. I was thinking of it like "do the checks fir
|
+ did_begin_impl_frame_deadline_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. |
danakj
2015/04/30 18:43:38
can you say why?
mithro-old
2015/05/01 02:52:35
Done.
|
+ if (did_begin_impl_frame_deadline_count_ < kExpectedNumImplFrames - 1) |
danakj
2015/04/30 18:43:38
else EndTest()?
mithro-old
2015/05/01 02:52:35
Putting the EndTest inside DidBeginImplFrameDeadli
danakj
2015/05/04 17:42:04
Oh, we should make LayerTreeTest::RealEndTest not
mithro-old
2015/05/05 04:13:13
I added the TODO inside LayerTreeTest::RealEndTest
danakj
2015/05/05 18:42:00
I disagree, I think the test should EndTest() when
mithro-old
2015/05/06 02:14:11
I agree that the test should call EndTest() when i
|
+ PostSetNeedsCommitToMainThread(); |
+ } |
+ |
+ void SendBeginMainFrameNotExpectedSoon() override { EndTest(); } |
danakj
2015/04/30 18:43:38
prefer to do this as else to PostSNC
mithro-old
2015/05/01 02:52:35
Using SendBeginMainFrameNotExpectedSoon guarantees
|
+ |
+ void AfterTest() override { |
+ EXPECT_EQ(will_begin_impl_frame_count_, |
+ did_begin_impl_frame_deadline_count_); |
+ // TODO(mithro): Figure out why the multithread version of this test has |
sunnyps
2015/05/01 00:31:43
I've had issue before too - I think it has somethi
mithro-old
2015/05/01 02:52:35
The number of WillBeginImplFrames equal to the Did
|
+ // one more frame then expected.Possibly related to |
danakj
2015/04/30 18:43:38
spacing
mithro-old
2015/05/01 02:52:35
Done.
|
+ // http://crbug.com/443185 |
+ // EXPECT_EQ(will_begin_impl_frame_count_, kExpectedNumImplFrames); |
danakj
2015/04/30 18:43:38
You can ask if there's a thread and compare agains
mithro-old
2015/05/01 02:52:35
Done. I'm now checking the value where it is corre
|
+ // EXPECT_EQ(did_begin_impl_frame_deadline_count_, kExpectedNumImplFrames); |
+ } |
+ |
+ private: |
+ int will_begin_impl_frame_count_; |
+ int did_begin_impl_frame_deadline_count_; |
+}; |
+ |
+SINGLE_AND_MULTI_THREAD_TEST_F( |
+ LayerTreeHostTestWillBeginImplFrameHasDidBeginImplFrameDeadline); |
+ |
class LayerTreeHostTestSendBeginFramesToChildren : public LayerTreeHostTest { |
public: |
LayerTreeHostTestSendBeginFramesToChildren() |