| 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 // If we make it without kicking a frame, we pass! | 657 // If we make it without kicking a frame, we pass! |
| 658 EndTestAfterDelay(1); | 658 EndTestAfterDelay(1); |
| 659 } | 659 } |
| 660 | 660 |
| 661 virtual void Layout() OVERRIDE { | 661 virtual void Layout() OVERRIDE { |
| 662 ASSERT_FALSE(true); | 662 ASSERT_FALSE(true); |
| 663 EndTest(); | 663 EndTest(); |
| 664 } | 664 } |
| 665 | 665 |
| 666 virtual void AfterTest() OVERRIDE {} | 666 virtual void AfterTest() OVERRIDE {} |
| 667 | |
| 668 private: | |
| 669 }; | 667 }; |
| 670 | 668 |
| 671 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortFrameWhenInvisible); | 669 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortFrameWhenInvisible); |
| 672 | 670 |
| 673 // This test verifies that properties on the layer tree host are commited | 671 // This test verifies that properties on the layer tree host are commited |
| 674 // to the impl side. | 672 // to the impl side. |
| 675 class LayerTreeHostTestCommit : public LayerTreeHostTest { | 673 class LayerTreeHostTestCommit : public LayerTreeHostTest { |
| 676 public: | 674 public: |
| 677 LayerTreeHostTestCommit() {} | 675 LayerTreeHostTestCommit() {} |
| 678 | 676 |
| (...skipping 3778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4457 } | 4455 } |
| 4458 | 4456 |
| 4459 private: | 4457 private: |
| 4460 int num_will_begin_frames_; | 4458 int num_will_begin_frames_; |
| 4461 int num_impl_commits_; | 4459 int num_impl_commits_; |
| 4462 }; | 4460 }; |
| 4463 | 4461 |
| 4464 // Commits can only be aborted when using the thread proxy. | 4462 // Commits can only be aborted when using the thread proxy. |
| 4465 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures); | 4463 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures); |
| 4466 | 4464 |
| 4465 class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest { |
| 4466 protected: |
| 4467 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 4468 settings->impl_side_painting = true; |
| 4469 } |
| 4470 |
| 4471 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
| 4472 OVERRIDE { |
| 4473 context_provider_ = TestContextProvider::Create(); |
| 4474 context_provider_->SetMaxTransferBufferUsageBytes(1024 * 1024); |
| 4475 return FakeOutputSurface::Create3d(context_provider_) |
| 4476 .PassAs<OutputSurface>(); |
| 4477 } |
| 4478 |
| 4479 virtual void SetupTree() OVERRIDE { |
| 4480 scoped_refptr<FakePictureLayer> root_layer = |
| 4481 FakePictureLayer::Create(&client_); |
| 4482 root_layer->SetBounds(gfx::Size(6000, 6000)); |
| 4483 root_layer->SetIsDrawable(true); |
| 4484 |
| 4485 layer_tree_host()->SetRootLayer(root_layer); |
| 4486 LayerTreeHostTest::SetupTree(); |
| 4487 } |
| 4488 |
| 4489 virtual void BeginTest() OVERRIDE { |
| 4490 PostSetNeedsCommitToMainThread(); |
| 4491 } |
| 4492 |
| 4493 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 4494 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( |
| 4495 impl->output_surface()->context_provider()->Context3d()); |
| 4496 |
| 4497 // Expect that the transfer buffer memory used is equal to the |
| 4498 // MaxTransferBufferUsageBytes value set in CreateOutputSurface. |
| 4499 EXPECT_EQ(1024 * 1024u, |
| 4500 context->transfer_buffer_memory_used_bytes()); |
| 4501 EndTest(); |
| 4502 } |
| 4503 |
| 4504 virtual void AfterTest() OVERRIDE {} |
| 4505 |
| 4506 private: |
| 4507 scoped_refptr<TestContextProvider> context_provider_; |
| 4508 FakeContentLayerClient client_; |
| 4509 }; |
| 4510 |
| 4511 // Impl-side painting is a multi-threaded compositor feature. |
| 4512 MULTI_THREAD_TEST_F(LayerTreeHostTestMaxTransferBufferUsageBytes); |
| 4513 |
| 4467 } // namespace | 4514 } // namespace |
| 4468 | 4515 |
| 4469 } // namespace cc | 4516 } // namespace cc |
| OLD | NEW |