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 3583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3594 } | 3594 } |
3595 | 3595 |
3596 void AfterTest() override {} | 3596 void AfterTest() override {} |
3597 | 3597 |
3598 FakeContentLayerClient client_; | 3598 FakeContentLayerClient client_; |
3599 scoped_refptr<FakePictureLayer> root_layer_; | 3599 scoped_refptr<FakePictureLayer> root_layer_; |
3600 }; | 3600 }; |
3601 | 3601 |
3602 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport); | 3602 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport); |
3603 | 3603 |
3604 class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest { | |
3605 protected: | |
3606 void InitializeSettings(LayerTreeSettings* settings) override { | |
3607 // Testing async uploads. | |
3608 settings->use_zero_copy = false; | |
3609 settings->use_one_copy = false; | |
3610 } | |
3611 | |
3612 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | |
3613 scoped_refptr<TestContextProvider> context_provider = | |
3614 TestContextProvider::Create(); | |
3615 context_provider->SetMaxTransferBufferUsageBytes(512 * 512); | |
3616 if (delegating_renderer()) | |
3617 return FakeOutputSurface::CreateDelegating3d(context_provider); | |
3618 else | |
3619 return FakeOutputSurface::Create3d(context_provider); | |
3620 } | |
3621 | |
3622 void SetupTree() override { | |
3623 client_.set_fill_with_nonsolid_color(true); | |
3624 scoped_refptr<FakePictureLayer> root_layer = | |
3625 FakePictureLayer::Create(layer_settings(), &client_); | |
3626 root_layer->SetBounds(gfx::Size(1024, 1024)); | |
3627 root_layer->SetIsDrawable(true); | |
3628 | |
3629 layer_tree_host()->SetRootLayer(root_layer); | |
3630 LayerTreeHostTest::SetupTree(); | |
3631 } | |
3632 | |
3633 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | |
3634 | |
3635 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | |
3636 TestWebGraphicsContext3D* context = TestContext(); | |
3637 | |
3638 // Expect that the transfer buffer memory used is equal to the | |
3639 // MaxTransferBufferUsageBytes value set in CreateOutputSurface. | |
3640 EXPECT_EQ(512 * 512u, context->max_used_transfer_buffer_usage_bytes()); | |
3641 EndTest(); | |
3642 } | |
3643 | |
3644 void AfterTest() override {} | |
3645 | |
3646 private: | |
3647 FakeContentLayerClient client_; | |
3648 }; | |
3649 | |
3650 // Impl-side painting is a multi-threaded compositor feature. | |
3651 MULTI_THREAD_TEST_F(LayerTreeHostTestMaxTransferBufferUsageBytes); | |
3652 | |
3653 class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface | 3604 class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface |
3654 : public LayerTreeHostTest { | 3605 : public LayerTreeHostTest { |
3655 protected: | 3606 protected: |
3656 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface() | 3607 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface() |
3657 : first_output_surface_memory_limit_(4321234), | 3608 : first_output_surface_memory_limit_(4321234), |
3658 second_output_surface_memory_limit_(1234321) {} | 3609 second_output_surface_memory_limit_(1234321) {} |
3659 | 3610 |
3660 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 3611 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
3661 if (!first_context_provider_.get()) { | 3612 if (!first_context_provider_.get()) { |
3662 first_context_provider_ = TestContextProvider::Create(); | 3613 first_context_provider_ = TestContextProvider::Create(); |
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6036 void AfterTest() override {} | 5987 void AfterTest() override {} |
6037 | 5988 |
6038 std::vector<int> affected_by_page_scale_; | 5989 std::vector<int> affected_by_page_scale_; |
6039 std::vector<int> not_affected_by_page_scale_; | 5990 std::vector<int> not_affected_by_page_scale_; |
6040 }; | 5991 }; |
6041 | 5992 |
6042 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestPageScaleFlags); | 5993 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestPageScaleFlags); |
6043 | 5994 |
6044 } // namespace | 5995 } // namespace |
6045 } // namespace cc | 5996 } // namespace cc |
OLD | NEW |