OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/layers/delegated_renderer_layer.h" | 5 #include "cc/layers/delegated_renderer_layer.h" |
6 | 6 |
7 #include "cc/layers/delegated_frame_provider.h" | 7 #include "cc/layers/delegated_frame_provider.h" |
8 #include "cc/layers/delegated_frame_resource_collection.h" | 8 #include "cc/layers/delegated_frame_resource_collection.h" |
9 #include "cc/layers/solid_color_layer.h" | 9 #include "cc/layers/solid_color_layer.h" |
10 #include "cc/output/delegated_frame_data.h" | 10 #include "cc/output/delegated_frame_data.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 DelegatedRendererLayerTestSimple() : DelegatedRendererLayerTest() { | 37 DelegatedRendererLayerTestSimple() : DelegatedRendererLayerTest() { |
38 scoped_ptr<RenderPass> root_pass(RenderPass::Create()); | 38 scoped_ptr<RenderPass> root_pass(RenderPass::Create()); |
39 root_pass->SetNew( | 39 root_pass->SetNew( |
40 RenderPassId(1, 1), gfx::Rect(1, 1), gfx::Rect(1, 1), gfx::Transform()); | 40 RenderPassId(1, 1), gfx::Rect(1, 1), gfx::Rect(1, 1), gfx::Transform()); |
41 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 41 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
42 frame_data->render_pass_list.push_back(root_pass.Pass()); | 42 frame_data->render_pass_list.push_back(root_pass.Pass()); |
43 resources_ = new DelegatedFrameResourceCollection; | 43 resources_ = new DelegatedFrameResourceCollection; |
44 provider_ = new DelegatedFrameProvider(resources_, frame_data.Pass()); | 44 provider_ = new DelegatedFrameProvider(resources_, frame_data.Pass()); |
45 root_layer_ = SolidColorLayer::Create(); | 45 root_layer_ = SolidColorLayer::Create(); |
46 layer_before_ = SolidColorLayer::Create(); | 46 layer_before_ = SolidColorLayer::Create(); |
47 delegated_renderer_layer_ = FakeDelegatedRendererLayer::Create(provider_); | 47 delegated_renderer_layer_ = |
| 48 FakeDelegatedRendererLayer::Create(provider_.get()); |
48 } | 49 } |
49 | 50 |
50 protected: | 51 protected: |
51 scoped_refptr<Layer> root_layer_; | 52 scoped_refptr<Layer> root_layer_; |
52 scoped_refptr<Layer> layer_before_; | 53 scoped_refptr<Layer> layer_before_; |
53 scoped_refptr<DelegatedRendererLayer> delegated_renderer_layer_; | 54 scoped_refptr<DelegatedRendererLayer> delegated_renderer_layer_; |
54 scoped_refptr<DelegatedFrameResourceCollection> resources_; | 55 scoped_refptr<DelegatedFrameResourceCollection> resources_; |
55 scoped_refptr<DelegatedFrameProvider> provider_; | 56 scoped_refptr<DelegatedFrameProvider> provider_; |
56 }; | 57 }; |
57 | 58 |
58 TEST_F(DelegatedRendererLayerTestSimple, DelegatedManyDescendants) { | 59 TEST_F(DelegatedRendererLayerTestSimple, DelegatedManyDescendants) { |
59 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent()); | 60 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent()); |
60 root_layer_->AddChild(layer_before_); | 61 root_layer_->AddChild(layer_before_); |
61 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent()); | 62 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent()); |
62 layer_before_->SetIsDrawable(true); | 63 layer_before_->SetIsDrawable(true); |
63 EXPECT_EQ(1, root_layer_->NumDescendantsThatDrawContent()); | 64 EXPECT_EQ(1, root_layer_->NumDescendantsThatDrawContent()); |
64 EXPECT_EQ(0, layer_before_->NumDescendantsThatDrawContent()); | 65 EXPECT_EQ(0, layer_before_->NumDescendantsThatDrawContent()); |
65 layer_before_->AddChild(delegated_renderer_layer_); | 66 layer_before_->AddChild(delegated_renderer_layer_); |
66 EXPECT_EQ(0, layer_before_->NumDescendantsThatDrawContent()); | 67 EXPECT_EQ(0, layer_before_->NumDescendantsThatDrawContent()); |
67 EXPECT_EQ(0, delegated_renderer_layer_->NumDescendantsThatDrawContent()); | 68 EXPECT_EQ(0, delegated_renderer_layer_->NumDescendantsThatDrawContent()); |
68 EXPECT_EQ(1, root_layer_->NumDescendantsThatDrawContent()); | 69 EXPECT_EQ(1, root_layer_->NumDescendantsThatDrawContent()); |
69 delegated_renderer_layer_->SetIsDrawable(true); | 70 delegated_renderer_layer_->SetIsDrawable(true); |
70 EXPECT_EQ(1000, delegated_renderer_layer_->NumDescendantsThatDrawContent()); | 71 EXPECT_EQ(1000, delegated_renderer_layer_->NumDescendantsThatDrawContent()); |
71 EXPECT_EQ(1001, layer_before_->NumDescendantsThatDrawContent()); | 72 EXPECT_EQ(1001, layer_before_->NumDescendantsThatDrawContent()); |
72 EXPECT_EQ(1002, root_layer_->NumDescendantsThatDrawContent()); | 73 EXPECT_EQ(1002, root_layer_->NumDescendantsThatDrawContent()); |
73 } | 74 } |
74 | 75 |
75 } // namespace | 76 } // namespace |
76 } // namespace cc | 77 } // namespace cc |
OLD | NEW |