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 4903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4914 } | 4914 } |
4915 virtual void AfterTest() OVERRIDE {} | 4915 virtual void AfterTest() OVERRIDE {} |
4916 | 4916 |
4917 private: | 4917 private: |
4918 FakeContentLayerClient client_; | 4918 FakeContentLayerClient client_; |
4919 scoped_refptr<FakeContentLayer> root_layer_; | 4919 scoped_refptr<FakeContentLayer> root_layer_; |
4920 }; | 4920 }; |
4921 | 4921 |
4922 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoQuadsForEmptyLayer); | 4922 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoQuadsForEmptyLayer); |
4923 | 4923 |
| 4924 class LayerTreeHostTestNoQuadsForZeroOpacity : public LayerTreeHostTest { |
| 4925 protected: |
| 4926 virtual void SetupTree() OVERRIDE { |
| 4927 LayerTreeHostTest::SetupTree(); |
| 4928 root_layer_ = FakeContentLayer::Create(&client_); |
| 4929 root_layer_->SetBounds(gfx::Size(100, 100)); |
| 4930 |
| 4931 surface_layer1_ = FakeContentLayer::Create(&client_); |
| 4932 surface_layer1_->SetBounds(gfx::Size(100, 100)); |
| 4933 surface_layer1_->SetForceRenderSurface(true); |
| 4934 surface_layer1_->SetOpacity(0.f); |
| 4935 |
| 4936 surface_layer2_ = FakeContentLayer::Create(&client_); |
| 4937 surface_layer2_->SetBounds(gfx::Size(50, 50)); |
| 4938 surface_layer2_->SetForceRenderSurface(true); |
| 4939 |
| 4940 touch_handler_ = FakeContentLayer::Create(&client_); |
| 4941 touch_handler_->SetBounds(gfx::Size(50, 50)); |
| 4942 touch_handler_->SetPosition(gfx::Point(50, 0)); |
| 4943 touch_handler_->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50)); |
| 4944 |
| 4945 surface_layer2_->AddChild(touch_handler_); |
| 4946 surface_layer1_->AddChild(surface_layer2_); |
| 4947 root_layer_->AddChild(surface_layer1_); |
| 4948 |
| 4949 layer_tree_host()->SetRootLayer(root_layer_); |
| 4950 LayerTreeHostTest::SetupTree(); |
| 4951 } |
| 4952 |
| 4953 virtual void BeginTest() OVERRIDE { |
| 4954 PostSetNeedsCommitToMainThread(); |
| 4955 } |
| 4956 |
| 4957 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 4958 FakeContentLayerImpl* layer_impl = |
| 4959 static_cast<FakeContentLayerImpl*>(impl->RootLayer()); |
| 4960 |
| 4961 FakeContentLayerImpl* surface_1_impl = |
| 4962 static_cast<FakeContentLayerImpl*>(layer_impl->children()[0]); |
| 4963 FakeContentLayerImpl* surface_2_impl = |
| 4964 static_cast<FakeContentLayerImpl*>(surface_1_impl->children()[0]); |
| 4965 EXPECT_EQ(0u, surface_1_impl->append_quads_count()); |
| 4966 EXPECT_EQ(0u, surface_2_impl->append_quads_count()); |
| 4967 |
| 4968 EndTest(); |
| 4969 } |
| 4970 |
| 4971 virtual void AfterTest() OVERRIDE {} |
| 4972 |
| 4973 private: |
| 4974 FakeContentLayerClient client_; |
| 4975 scoped_refptr<FakeContentLayer> root_layer_; |
| 4976 scoped_refptr<FakeContentLayer> surface_layer1_; |
| 4977 scoped_refptr<FakeContentLayer> surface_layer2_; |
| 4978 scoped_refptr<FakeContentLayer> touch_handler_; |
| 4979 }; |
| 4980 |
| 4981 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoQuadsForZeroOpacity); |
| 4982 |
4924 | 4983 |
4925 } // namespace | 4984 } // namespace |
4926 | 4985 |
4927 } // namespace cc | 4986 } // namespace cc |
OLD | NEW |