Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: cc/layers/delegated_renderer_layer_unittest.cc

Issue 1122393003: CC: Plumb LayerSettings parameter for cc::Layer construction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/delegated_renderer_layer.cc ('k') | cc/layers/heads_up_display_layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
37 class DelegatedRendererLayerTestSimple : public DelegatedRendererLayerTest { 37 class DelegatedRendererLayerTestSimple : public DelegatedRendererLayerTest {
38 public: 38 public:
39 DelegatedRendererLayerTestSimple() : DelegatedRendererLayerTest() { 39 DelegatedRendererLayerTestSimple() : DelegatedRendererLayerTest() {
40 scoped_ptr<RenderPass> root_pass(RenderPass::Create()); 40 scoped_ptr<RenderPass> root_pass(RenderPass::Create());
41 root_pass->SetNew( 41 root_pass->SetNew(
42 RenderPassId(1, 1), gfx::Rect(1, 1), gfx::Rect(1, 1), gfx::Transform()); 42 RenderPassId(1, 1), gfx::Rect(1, 1), gfx::Rect(1, 1), gfx::Transform());
43 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); 43 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
44 frame_data->render_pass_list.push_back(root_pass.Pass()); 44 frame_data->render_pass_list.push_back(root_pass.Pass());
45 resources_ = new DelegatedFrameResourceCollection; 45 resources_ = new DelegatedFrameResourceCollection;
46 provider_ = new DelegatedFrameProvider(resources_, frame_data.Pass()); 46 provider_ = new DelegatedFrameProvider(resources_, frame_data.Pass());
47 root_layer_ = SolidColorLayer::Create(); 47 LayerSettings layer_settings;
48 layer_before_ = SolidColorLayer::Create(); 48 root_layer_ = SolidColorLayer::Create(layer_settings);
49 layer_before_ = SolidColorLayer::Create(layer_settings);
49 delegated_renderer_layer_ = 50 delegated_renderer_layer_ =
50 FakeDelegatedRendererLayer::Create(provider_.get()); 51 FakeDelegatedRendererLayer::Create(layer_settings, provider_.get());
51 } 52 }
52 53
53 protected: 54 protected:
54 scoped_refptr<Layer> root_layer_; 55 scoped_refptr<Layer> root_layer_;
55 scoped_refptr<Layer> layer_before_; 56 scoped_refptr<Layer> layer_before_;
56 scoped_refptr<DelegatedRendererLayer> delegated_renderer_layer_; 57 scoped_refptr<DelegatedRendererLayer> delegated_renderer_layer_;
57 scoped_refptr<DelegatedFrameResourceCollection> resources_; 58 scoped_refptr<DelegatedFrameResourceCollection> resources_;
58 scoped_refptr<DelegatedFrameProvider> provider_; 59 scoped_refptr<DelegatedFrameProvider> provider_;
59 }; 60 };
60 61
61 TEST_F(DelegatedRendererLayerTestSimple, DelegatedManyDescendants) { 62 TEST_F(DelegatedRendererLayerTestSimple, DelegatedManyDescendants) {
62 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent()); 63 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent());
63 root_layer_->AddChild(layer_before_); 64 root_layer_->AddChild(layer_before_);
64 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent()); 65 EXPECT_EQ(0, root_layer_->NumDescendantsThatDrawContent());
65 layer_before_->SetIsDrawable(true); 66 layer_before_->SetIsDrawable(true);
66 EXPECT_EQ(1, root_layer_->NumDescendantsThatDrawContent()); 67 EXPECT_EQ(1, root_layer_->NumDescendantsThatDrawContent());
67 EXPECT_EQ(0, layer_before_->NumDescendantsThatDrawContent()); 68 EXPECT_EQ(0, layer_before_->NumDescendantsThatDrawContent());
68 layer_before_->AddChild(delegated_renderer_layer_); 69 layer_before_->AddChild(delegated_renderer_layer_);
69 EXPECT_EQ(0, layer_before_->NumDescendantsThatDrawContent()); 70 EXPECT_EQ(0, layer_before_->NumDescendantsThatDrawContent());
70 EXPECT_EQ(0, delegated_renderer_layer_->NumDescendantsThatDrawContent()); 71 EXPECT_EQ(0, delegated_renderer_layer_->NumDescendantsThatDrawContent());
71 EXPECT_EQ(1, root_layer_->NumDescendantsThatDrawContent()); 72 EXPECT_EQ(1, root_layer_->NumDescendantsThatDrawContent());
72 delegated_renderer_layer_->SetIsDrawable(true); 73 delegated_renderer_layer_->SetIsDrawable(true);
73 EXPECT_EQ(1000, delegated_renderer_layer_->NumDescendantsThatDrawContent()); 74 EXPECT_EQ(1000, delegated_renderer_layer_->NumDescendantsThatDrawContent());
74 EXPECT_EQ(1001, layer_before_->NumDescendantsThatDrawContent()); 75 EXPECT_EQ(1001, layer_before_->NumDescendantsThatDrawContent());
75 EXPECT_EQ(1002, root_layer_->NumDescendantsThatDrawContent()); 76 EXPECT_EQ(1002, root_layer_->NumDescendantsThatDrawContent());
76 } 77 }
77 78
78 } // namespace 79 } // namespace
79 } // namespace cc 80 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/delegated_renderer_layer.cc ('k') | cc/layers/heads_up_display_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698