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 4615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4626 | 4626 |
4627 void set_needs_context(bool need) { needs_context_ = need; } | 4627 void set_needs_context(bool need) { needs_context_ = need; } |
4628 | 4628 |
4629 private: | 4629 private: |
4630 LayerSetsNeedsFilterContext() : needs_context_(false) {} | 4630 LayerSetsNeedsFilterContext() : needs_context_(false) {} |
4631 virtual ~LayerSetsNeedsFilterContext() {} | 4631 virtual ~LayerSetsNeedsFilterContext() {} |
4632 | 4632 |
4633 bool needs_context_; | 4633 bool needs_context_; |
4634 }; | 4634 }; |
4635 | 4635 |
4636 class LayerTreeHostTestOffscreenContext : public LayerTreeHostTest { | |
4637 protected: | |
4638 virtual void SetupTree() OVERRIDE { | |
4639 scoped_refptr<LayerSetsNeedsFilterContext> root = | |
4640 LayerSetsNeedsFilterContext::Create(); | |
4641 root->SetIsDrawable(true); | |
4642 root->SetAnchorPoint(gfx::PointF()); | |
4643 root->SetBounds(gfx::Size(10, 10)); | |
4644 root->set_needs_context(with_context_); | |
4645 layer_tree_host()->SetRootLayer(root); | |
4646 LayerTreeHostTest::SetupTree(); | |
4647 } | |
4648 | |
4649 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | |
4650 | |
4651 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | |
4652 bool expect_context = with_context_; | |
4653 if (delegating_renderer()) | |
4654 expect_context = false; | |
4655 EXPECT_EQ(expect_context, !!host_impl->offscreen_context_provider()); | |
4656 EndTest(); | |
4657 } | |
4658 | |
4659 virtual void AfterTest() OVERRIDE {} | |
4660 | |
4661 bool with_context_; | |
4662 }; | |
4663 | |
4664 class LayerTreeHostTestOffscreenContext_NoContext | |
4665 : public LayerTreeHostTestOffscreenContext { | |
4666 protected: | |
4667 LayerTreeHostTestOffscreenContext_NoContext() { with_context_ = false; } | |
4668 }; | |
4669 | |
4670 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOffscreenContext_NoContext); | |
4671 | |
4672 class LayerTreeHostTestOffscreenContext_WithContext | |
4673 : public LayerTreeHostTestOffscreenContext { | |
4674 protected: | |
4675 LayerTreeHostTestOffscreenContext_WithContext() { with_context_ = true; } | |
4676 }; | |
4677 | |
4678 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOffscreenContext_WithContext); | |
4679 | |
4680 class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest { | 4636 class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest { |
4681 protected: | 4637 protected: |
4682 virtual void SetupTree() OVERRIDE { | 4638 virtual void SetupTree() OVERRIDE { |
4683 LayerTreeHostTest::SetupTree(); | 4639 LayerTreeHostTest::SetupTree(); |
4684 root_layer_ = FakeContentLayer::Create(&client_); | 4640 root_layer_ = FakeContentLayer::Create(&client_); |
4685 root_layer_->SetBounds(gfx::Size(10, 10)); | 4641 root_layer_->SetBounds(gfx::Size(10, 10)); |
4686 root_layer_->SetIsDrawable(false); | 4642 root_layer_->SetIsDrawable(false); |
4687 root_layer_->SetHaveWheelEventHandlers(true); | 4643 root_layer_->SetHaveWheelEventHandlers(true); |
4688 layer_tree_host()->SetRootLayer(root_layer_); | 4644 layer_tree_host()->SetRootLayer(root_layer_); |
4689 LayerTreeHostTest::SetupTree(); | 4645 LayerTreeHostTest::SetupTree(); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5218 const gfx::Size bounds_; | 5174 const gfx::Size bounds_; |
5219 FakeContentLayerClient client_; | 5175 FakeContentLayerClient client_; |
5220 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5176 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
5221 scoped_refptr<FakePictureLayer> picture_layer_; | 5177 scoped_refptr<FakePictureLayer> picture_layer_; |
5222 Layer* child_layer_; | 5178 Layer* child_layer_; |
5223 }; | 5179 }; |
5224 | 5180 |
5225 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5181 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
5226 | 5182 |
5227 } // namespace cc | 5183 } // namespace cc |
OLD | NEW |