OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/layers/delegated_renderer_layer.h" | |
6 | |
7 #include "cc/layers/delegated_frame_provider.h" | |
8 #include "cc/layers/delegated_frame_resource_collection.h" | |
9 #include "cc/layers/solid_color_layer.h" | |
10 #include "cc/output/delegated_frame_data.h" | |
11 #include "cc/test/fake_delegated_renderer_layer.h" | |
12 #include "cc/test/fake_layer_tree_host.h" | |
13 #include "cc/test/fake_proxy.h" | |
14 #include "testing/gtest/include/gtest/gtest.h" | |
15 | |
16 namespace cc { | |
17 namespace { | |
18 | |
19 class DelegatedRendererLayerTest : public testing::Test { | |
20 public: | |
21 DelegatedRendererLayerTest() | |
22 : proxy_(), always_impl_thread_and_main_thread_blocked_(&proxy_) { | |
23 LayerTreeSettings settings; | |
24 settings.minimum_occlusion_tracking_size = gfx::Size(); | |
25 | |
26 host_impl_ = FakeLayerTreeHost::Create(settings); | |
27 host_impl_->SetViewportSize(gfx::Size(10, 10)); | |
28 } | |
29 | |
30 protected: | |
31 FakeProxy proxy_; | |
32 DebugScopedSetImplThreadAndMainThreadBlocked | |
33 always_impl_thread_and_main_thread_blocked_; | |
danakj
2014/07/17 17:21:25
do you need this?
awoloszyn
2014/07/17 20:44:59
Done.
| |
34 TestSharedBitmapManager shared_bitmap_manager_; | |
35 scoped_ptr<LayerTreeHost> host_impl_; | |
36 }; | |
37 | |
38 class DelegatedRendererLayerTestSimple : public DelegatedRendererLayerTest { | |
39 public: | |
40 DelegatedRendererLayerTestSimple() : DelegatedRendererLayerTest() { | |
41 scoped_ptr<RenderPass> root_pass(RenderPass::Create()); | |
42 root_pass->SetNew(RenderPass::Id(1, 1), | |
43 gfx::Rect(1, 1), | |
44 gfx::Rect(1, 1), | |
45 gfx::Transform()); | |
46 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | |
47 frame_data->render_pass_list.push_back(root_pass.Pass()); | |
48 resources_ = new DelegatedFrameResourceCollection; | |
49 provider_ = new DelegatedFrameProvider(resources_, frame_data.Pass()); | |
50 root_layer_ = SolidColorLayer::Create(); | |
51 layer_before_ = SolidColorLayer::Create(); | |
52 layer_after_ = SolidColorLayer::Create(); | |
53 delegated_renderer_layer_ = FakeDelegatedRendererLayer::Create(provider_); | |
54 } | |
55 | |
56 protected: | |
57 scoped_refptr<Layer> root_layer_; | |
58 scoped_refptr<Layer> layer_before_; | |
59 scoped_refptr<Layer> layer_after_; | |
danakj
2014/07/17 17:21:25
don't see you using this
awoloszyn
2014/07/17 20:44:59
Done.
| |
60 scoped_refptr<DelegatedRendererLayer> delegated_renderer_layer_; | |
61 | |
62 scoped_refptr<DelegatedFrameResourceCollection> resources_; | |
63 scoped_refptr<DelegatedFrameProvider> provider_; | |
64 }; | |
65 | |
66 TEST_F(DelegatedRendererLayerTestSimple, DelegatedManyDescendants) { | |
67 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent()); | |
68 root_layer_->AddChild(layer_before_); | |
69 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent()); | |
70 layer_before_->SetIsDrawable(true); | |
71 EXPECT_EQ(1, root_layer_->NumDescendantsThatDrawContent()); | |
72 EXPECT_EQ(0, layer_before_->NumDescendantsThatDrawContent()); | |
73 layer_before_->AddChild(delegated_renderer_layer_); | |
74 EXPECT_EQ(1000, layer_before_->NumDescendantsThatDrawContent()); | |
75 EXPECT_EQ(1000, delegated_renderer_layer_->NumDescendantsThatDrawContent()); | |
danakj
2014/07/17 17:21:25
if the DRL isn't going to draw, this should be 0
awoloszyn
2014/07/17 20:44:59
This behavior has been changed, and DRLs won't con
| |
76 EXPECT_EQ(1001, root_layer_->NumDescendantsThatDrawContent()); | |
77 delegated_renderer_layer_->SetIsDrawable(true); | |
78 EXPECT_EQ(1000, delegated_renderer_layer_->NumDescendantsThatDrawContent()); | |
79 EXPECT_EQ(1001, layer_before_->NumDescendantsThatDrawContent()); | |
80 EXPECT_EQ(1002, root_layer_->NumDescendantsThatDrawContent()); | |
81 } | |
82 | |
83 } // namespace | |
84 } // namespace cc | |
OLD | NEW |