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/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 virtual void AfterTest() OVERRIDE { EXPECT_EQ(5, num_draws_); } | 522 virtual void AfterTest() OVERRIDE { EXPECT_EQ(5, num_draws_); } |
523 | 523 |
524 private: | 524 private: |
525 int num_draws_; | 525 int num_draws_; |
526 const gfx::Size bounds_; | 526 const gfx::Size bounds_; |
527 const gfx::Rect invalid_rect_; | 527 const gfx::Rect invalid_rect_; |
528 FakeContentLayerClient client_; | 528 FakeContentLayerClient client_; |
529 scoped_refptr<ContentLayer> root_layer_; | 529 scoped_refptr<ContentLayer> root_layer_; |
530 }; | 530 }; |
531 | 531 |
532 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); | 532 // This test does not make sense in the single-threaded impl-side painting |
enne (OOO)
2014/08/27 23:53:38
These two tests are the only ones that called Bloc
danakj
2014/09/03 17:01:31
I like the sound of that idea.
enne (OOO)
2014/09/03 19:41:28
Done.
| |
533 // configuration, as activation cannot fail. | |
534 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); | |
535 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); | |
533 | 536 |
534 // Tests that if a layer is not drawn because of some reason in the parent then | 537 // Tests that if a layer is not drawn because of some reason in the parent then |
535 // its damage is preserved until the next time it is drawn. | 538 // its damage is preserved until the next time it is drawn. |
536 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { | 539 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { |
537 public: | 540 public: |
538 LayerTreeHostTestUndrawnLayersDamageLater() | 541 LayerTreeHostTestUndrawnLayersDamageLater() |
539 : root_layer_(ContentLayer::Create(&client_)) {} | 542 : root_layer_(ContentLayer::Create(&client_)) {} |
540 | 543 |
541 virtual void SetupTree() OVERRIDE { | 544 virtual void SetupTree() OVERRIDE { |
542 root_layer_->SetIsDrawable(true); | 545 root_layer_->SetIsDrawable(true); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
770 EXPECT_NE(frame_count_with_pending_tree_, 1); | 773 EXPECT_NE(frame_count_with_pending_tree_, 1); |
771 } | 774 } |
772 | 775 |
773 virtual void AfterTest() OVERRIDE {} | 776 virtual void AfterTest() OVERRIDE {} |
774 | 777 |
775 private: | 778 private: |
776 int frame_count_with_pending_tree_; | 779 int frame_count_with_pending_tree_; |
777 base::TimeTicks first_frame_time_; | 780 base::TimeTicks first_frame_time_; |
778 }; | 781 }; |
779 | 782 |
780 SINGLE_AND_MULTI_THREAD_TEST_F( | 783 // This test does not make sense in the single-threaded impl-side painting |
784 // configuration, as activation cannot fail. | |
785 MULTI_THREAD_TEST_F(LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); | |
786 SINGLE_THREAD_NOIMPL_TEST_F( | |
781 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); | 787 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); |
782 | 788 |
783 // This test verifies that LayerTreeHostImpl's current frame time gets | 789 // This test verifies that LayerTreeHostImpl's current frame time gets |
784 // updated in consecutive frames when it draws in each frame. | 790 // updated in consecutive frames when it draws in each frame. |
785 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { | 791 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { |
786 public: | 792 public: |
787 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} | 793 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} |
788 | 794 |
789 virtual void BeginTest() OVERRIDE { | 795 virtual void BeginTest() OVERRIDE { |
790 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | 796 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2212 EXPECT_FALSE(layer_tree_host()->root_layer()->can_use_lcd_text()); | 2218 EXPECT_FALSE(layer_tree_host()->root_layer()->can_use_lcd_text()); |
2213 EndTest(); | 2219 EndTest(); |
2214 break; | 2220 break; |
2215 } | 2221 } |
2216 } | 2222 } |
2217 | 2223 |
2218 private: | 2224 private: |
2219 NotificationClient client_; | 2225 NotificationClient client_; |
2220 }; | 2226 }; |
2221 | 2227 |
2222 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDNotification); | 2228 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestLCDNotification); |
danakj
2014/09/03 17:01:32
Why this? What happened to MULTI?
enne (OOO)
2014/09/03 19:41:28
Fixed.
| |
2223 | 2229 |
2224 // Verify that the BeginFrame notification is used to initiate rendering. | 2230 // Verify that the BeginFrame notification is used to initiate rendering. |
2225 class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { | 2231 class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { |
2226 public: | 2232 public: |
2227 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 2233 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
2228 settings->begin_frame_scheduling_enabled = true; | 2234 settings->begin_frame_scheduling_enabled = true; |
2229 } | 2235 } |
2230 | 2236 |
2231 virtual void BeginTest() OVERRIDE { | 2237 virtual void BeginTest() OVERRIDE { |
2232 // This will trigger a SetNeedsBeginFrame which will trigger a | 2238 // This will trigger a SetNeedsBeginFrame which will trigger a |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2396 | 2402 |
2397 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 2403 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } |
2398 | 2404 |
2399 private: | 2405 private: |
2400 Layer* layer_; | 2406 Layer* layer_; |
2401 }; | 2407 }; |
2402 | 2408 |
2403 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} | 2409 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} |
2404 | 2410 |
2405 virtual void SetupTree() OVERRIDE { | 2411 virtual void SetupTree() OVERRIDE { |
2406 scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); | 2412 scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); |
danakj
2014/09/03 17:01:31
can you make this a PictureLayer and run this with
enne (OOO)
2014/09/03 19:41:28
Added PictureLayer when impl-side painting. Left
| |
2407 root_layer->SetIsDrawable(true); | 2413 root_layer->SetIsDrawable(true); |
2408 root_layer->SetBounds(gfx::Size(1, 1)); | 2414 root_layer->SetBounds(gfx::Size(1, 1)); |
2409 | 2415 |
2410 layer_tree_host()->SetRootLayer(root_layer); | 2416 layer_tree_host()->SetRootLayer(root_layer); |
2411 client_.set_layer(root_layer.get()); | 2417 client_.set_layer(root_layer.get()); |
2412 | 2418 |
2413 LayerTreeHostTest::SetupTree(); | 2419 LayerTreeHostTest::SetupTree(); |
2414 } | 2420 } |
2415 | 2421 |
2416 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 2422 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
2417 virtual void AfterTest() OVERRIDE {} | 2423 virtual void AfterTest() OVERRIDE {} |
2418 | 2424 |
2419 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 2425 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
danakj
2014/09/03 17:01:32
This should be DidActivateOnThread since it's usin
enne (OOO)
2014/09/03 19:41:28
Done.
| |
2420 num_commits_++; | 2426 num_commits_++; |
2421 if (num_commits_ == 1) { | 2427 if (num_commits_ == 1) { |
2422 LayerImpl* root_layer = host_impl->active_tree()->root_layer(); | 2428 LayerImpl* root_layer = host_impl->active_tree()->root_layer(); |
2423 EXPECT_SIZE_EQ(gfx::Size(1, 1), root_layer->bounds()); | 2429 EXPECT_SIZE_EQ(gfx::Size(1, 1), root_layer->bounds()); |
2424 } else { | 2430 } else { |
2425 LayerImpl* root_layer = host_impl->active_tree()->root_layer(); | 2431 LayerImpl* root_layer = host_impl->active_tree()->root_layer(); |
2426 EXPECT_SIZE_EQ(gfx::Size(2, 2), root_layer->bounds()); | 2432 EXPECT_SIZE_EQ(gfx::Size(2, 2), root_layer->bounds()); |
2427 EndTest(); | 2433 EndTest(); |
2428 } | 2434 } |
2429 } | 2435 } |
2430 | 2436 |
2431 private: | 2437 private: |
2432 SetBoundsClient client_; | 2438 SetBoundsClient client_; |
2433 int num_commits_; | 2439 int num_commits_; |
2434 }; | 2440 }; |
2435 | 2441 |
2436 SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents); | 2442 SINGLE_THREAD_NOIMPL_TEST_F( |
danakj
2014/09/03 17:01:32
can this be SINGLE_AND_MULTI_IMPL after all that?
enne (OOO)
2014/09/03 19:41:28
Made it SINGLE_AND_MULTI instead.
| |
2443 LayerTreeHostTestChangeLayerPropertiesInPaintContents); | |
2437 | 2444 |
2438 class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D { | 2445 class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D { |
2439 public: | 2446 public: |
2440 MockIOSurfaceWebGraphicsContext3D() { | 2447 MockIOSurfaceWebGraphicsContext3D() { |
2441 test_capabilities_.gpu.iosurface = true; | 2448 test_capabilities_.gpu.iosurface = true; |
2442 test_capabilities_.gpu.texture_rectangle = true; | 2449 test_capabilities_.gpu.texture_rectangle = true; |
2443 } | 2450 } |
2444 | 2451 |
2445 virtual GLuint createTexture() OVERRIDE { | 2452 virtual GLuint createTexture() OVERRIDE { |
2446 return 1; | 2453 return 1; |
(...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5033 const gfx::Size bounds_; | 5040 const gfx::Size bounds_; |
5034 FakeContentLayerClient client_; | 5041 FakeContentLayerClient client_; |
5035 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5042 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
5036 scoped_refptr<FakePictureLayer> picture_layer_; | 5043 scoped_refptr<FakePictureLayer> picture_layer_; |
5037 Layer* child_layer_; | 5044 Layer* child_layer_; |
5038 }; | 5045 }; |
5039 | 5046 |
5040 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5047 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
5041 | 5048 |
5042 } // namespace cc | 5049 } // namespace cc |
OLD | NEW |