Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2276 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousInvalidate); | 2276 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousInvalidate); |
| 2277 | 2277 |
| 2278 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { | 2278 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { |
| 2279 public: | 2279 public: |
| 2280 LayerTreeHostTestDeferCommits() | 2280 LayerTreeHostTestDeferCommits() |
| 2281 : num_will_begin_impl_frame_(0), | 2281 : num_will_begin_impl_frame_(0), |
| 2282 num_send_begin_main_frame_(0) {} | 2282 num_send_begin_main_frame_(0) {} |
| 2283 | 2283 |
| 2284 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2284 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2285 | 2285 |
| 2286 void WillBeginImplFrame(const BeginFrameArgs& args) override { | 2286 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, |
| 2287 const BeginFrameArgs& args) override { | |
| 2287 num_will_begin_impl_frame_++; | 2288 num_will_begin_impl_frame_++; |
| 2288 switch (num_will_begin_impl_frame_) { | 2289 switch (num_will_begin_impl_frame_) { |
| 2289 case 1: | 2290 case 1: |
| 2290 break; | 2291 break; |
| 2291 case 2: | 2292 case 2: |
| 2292 case 3: | 2293 case 3: |
| 2293 case 4: | 2294 case 4: |
| 2294 // Post a number of frames to increase the chance that, if there exist | 2295 // Post a number of frames to increase the chance that, if there exist |
| 2295 // bugs, an unexpected BeginMainFrame will be issued. | 2296 // bugs, an unexpected BeginMainFrame will be issued. |
| 2296 PostSetNeedsCommitToMainThread(); | 2297 PostSetNeedsCommitToMainThread(); |
| (...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5486 int num_draws_; | 5487 int num_draws_; |
| 5487 const gfx::Size bounds_; | 5488 const gfx::Size bounds_; |
| 5488 FakeContentLayerClient client_; | 5489 FakeContentLayerClient client_; |
| 5489 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5490 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 5490 scoped_refptr<FakePictureLayer> picture_layer_; | 5491 scoped_refptr<FakePictureLayer> picture_layer_; |
| 5491 Layer* child_layer_; | 5492 Layer* child_layer_; |
| 5492 }; | 5493 }; |
| 5493 | 5494 |
| 5494 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5495 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 5495 | 5496 |
| 5497 class LayerTreeHostTestWillBeginImplFrameHasDidBeginImplFrameDeadline | |
| 5498 : public LayerTreeHostTest { | |
| 5499 public: | |
| 5500 enum { kExpectedNumImplFrames = 10 }; | |
| 5501 | |
| 5502 LayerTreeHostTestWillBeginImplFrameHasDidBeginImplFrameDeadline() | |
| 5503 : will_begin_impl_frame_count_(0), | |
| 5504 did_begin_impl_frame_deadline_count_(0) {} | |
| 5505 | |
| 5506 void BeginTest() override { | |
| 5507 // Kick off the test with a commit. | |
| 5508 PostSetNeedsCommitToMainThread(); | |
| 5509 } | |
| 5510 | |
| 5511 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, | |
| 5512 const BeginFrameArgs& args) override { | |
| 5513 EXPECT_EQ(will_begin_impl_frame_count_, | |
| 5514 did_begin_impl_frame_deadline_count_); | |
| 5515 EXPECT_FALSE(TestEnded()); | |
| 5516 will_begin_impl_frame_count_++; | |
| 5517 } | |
| 5518 | |
| 5519 void DidBeginImplFrameDeadlineOnThread( | |
| 5520 LayerTreeHostImpl* host_impl) override { | |
| 5521 EXPECT_EQ(will_begin_impl_frame_count_, | |
| 5522 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
| |
| 5523 did_begin_impl_frame_deadline_count_++; | |
| 5524 | |
| 5525 // Request a number of commits to cause multiple impl frames. We expect to | |
| 5526 // 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.
| |
| 5527 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
| |
| 5528 PostSetNeedsCommitToMainThread(); | |
| 5529 } | |
| 5530 | |
| 5531 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
| |
| 5532 | |
| 5533 void AfterTest() override { | |
| 5534 EXPECT_EQ(will_begin_impl_frame_count_, | |
| 5535 did_begin_impl_frame_deadline_count_); | |
| 5536 // 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
| |
| 5537 // 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.
| |
| 5538 // http://crbug.com/443185 | |
| 5539 // 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
| |
| 5540 // EXPECT_EQ(did_begin_impl_frame_deadline_count_, kExpectedNumImplFrames); | |
| 5541 } | |
| 5542 | |
| 5543 private: | |
| 5544 int will_begin_impl_frame_count_; | |
| 5545 int did_begin_impl_frame_deadline_count_; | |
| 5546 }; | |
| 5547 | |
| 5548 SINGLE_AND_MULTI_THREAD_TEST_F( | |
| 5549 LayerTreeHostTestWillBeginImplFrameHasDidBeginImplFrameDeadline); | |
| 5550 | |
| 5496 class LayerTreeHostTestSendBeginFramesToChildren : public LayerTreeHostTest { | 5551 class LayerTreeHostTestSendBeginFramesToChildren : public LayerTreeHostTest { |
| 5497 public: | 5552 public: |
| 5498 LayerTreeHostTestSendBeginFramesToChildren() | 5553 LayerTreeHostTestSendBeginFramesToChildren() |
| 5499 : begin_frame_sent_to_children_(false) { | 5554 : begin_frame_sent_to_children_(false) { |
| 5500 } | 5555 } |
| 5501 | 5556 |
| 5502 void BeginTest() override { | 5557 void BeginTest() override { |
| 5503 // Kick off the test with a commit. | 5558 // Kick off the test with a commit. |
| 5504 PostSetNeedsCommitToMainThread(); | 5559 PostSetNeedsCommitToMainThread(); |
| 5505 } | 5560 } |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6992 void AfterTest() override {} | 7047 void AfterTest() override {} |
| 6993 | 7048 |
| 6994 scoped_refptr<FakePictureLayer> content_child_layer_; | 7049 scoped_refptr<FakePictureLayer> content_child_layer_; |
| 6995 FakeContentLayerClient client_; | 7050 FakeContentLayerClient client_; |
| 6996 }; | 7051 }; |
| 6997 | 7052 |
| 6998 SINGLE_AND_MULTI_THREAD_TEST_F( | 7053 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 6999 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); | 7054 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); |
| 7000 | 7055 |
| 7001 } // namespace cc | 7056 } // namespace cc |
| OLD | NEW |