OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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/layer_iterator.h" | 5 #include "cc/layers/layer_iterator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 virtual ~TestLayer() {} | 43 virtual ~TestLayer() {} |
44 | 44 |
45 bool draws_content_; | 45 bool draws_content_; |
46 }; | 46 }; |
47 | 47 |
48 #define EXPECT_COUNT(layer, target, contrib, itself) \ | 48 #define EXPECT_COUNT(layer, target, contrib, itself) \ |
49 EXPECT_EQ(target, layer->count_representing_target_surface_); \ | 49 EXPECT_EQ(target, layer->count_representing_target_surface_); \ |
50 EXPECT_EQ(contrib, layer->count_representing_contributing_surface_); \ | 50 EXPECT_EQ(contrib, layer->count_representing_contributing_surface_); \ |
51 EXPECT_EQ(itself, layer->count_representing_itself_); | 51 EXPECT_EQ(itself, layer->count_representing_itself_); |
52 | 52 |
53 typedef LayerIterator<Layer, | 53 typedef LayerIterator<Layer> FrontToBack; |
54 RenderSurfaceLayerList, | |
55 RenderSurface, | |
56 LayerIteratorActions::FrontToBack> FrontToBack; | |
57 | 54 |
58 void ResetCounts(RenderSurfaceLayerList* render_surface_layer_list) { | 55 void ResetCounts(RenderSurfaceLayerList* render_surface_layer_list) { |
59 for (unsigned surface_index = 0; | 56 for (unsigned surface_index = 0; |
60 surface_index < render_surface_layer_list->size(); | 57 surface_index < render_surface_layer_list->size(); |
61 ++surface_index) { | 58 ++surface_index) { |
62 TestLayer* render_surface_layer = static_cast<TestLayer*>( | 59 TestLayer* render_surface_layer = static_cast<TestLayer*>( |
63 render_surface_layer_list->at(surface_index)); | 60 render_surface_layer_list->at(surface_index)); |
64 RenderSurface* render_surface = render_surface_layer->render_surface(); | 61 RenderSurface* render_surface = render_surface_layer->render_surface(); |
65 | 62 |
66 render_surface_layer->count_representing_target_surface_ = -1; | 63 render_surface_layer->count_representing_target_surface_ = -1; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 EXPECT_COUNT(root21, -1, -1, 9); | 208 EXPECT_COUNT(root21, -1, -1, 9); |
212 EXPECT_COUNT(root22, 7, 8, 6); | 209 EXPECT_COUNT(root22, 7, 8, 6); |
213 EXPECT_COUNT(root221, -1, -1, 5); | 210 EXPECT_COUNT(root221, -1, -1, 5); |
214 EXPECT_COUNT(root23, 3, 4, 2); | 211 EXPECT_COUNT(root23, 3, 4, 2); |
215 EXPECT_COUNT(root231, -1, -1, 1); | 212 EXPECT_COUNT(root231, -1, -1, 1); |
216 EXPECT_COUNT(root3, -1, -1, 0); | 213 EXPECT_COUNT(root3, -1, -1, 0); |
217 } | 214 } |
218 | 215 |
219 } // namespace | 216 } // namespace |
220 } // namespace cc | 217 } // namespace cc |
OLD | NEW |