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> |
| 8 |
7 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
8 #include "cc/trees/layer_tree_host_common.h" | 10 #include "cc/trees/layer_tree_host_common.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "ui/gfx/transform.h" | 13 #include "ui/gfx/transform.h" |
12 | 14 |
13 using ::testing::Mock; | 15 using ::testing::Mock; |
14 using ::testing::_; | 16 using ::testing::_; |
15 using ::testing::AtLeast; | 17 using ::testing::AtLeast; |
16 using ::testing::AnyNumber; | 18 using ::testing::AnyNumber; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 EXPECT_COUNT(second, -1, -1, 3); | 153 EXPECT_COUNT(second, -1, -1, 3); |
152 EXPECT_COUNT(third, -1, -1, 4); | 154 EXPECT_COUNT(third, -1, -1, 4); |
153 EXPECT_COUNT(fourth, -1, -1, 5); | 155 EXPECT_COUNT(fourth, -1, -1, 5); |
154 | 156 |
155 IterateFrontToBack(&render_surface_layerList); | 157 IterateFrontToBack(&render_surface_layerList); |
156 EXPECT_COUNT(root_layer, 5, -1, 4); | 158 EXPECT_COUNT(root_layer, 5, -1, 4); |
157 EXPECT_COUNT(first, -1, -1, 3); | 159 EXPECT_COUNT(first, -1, -1, 3); |
158 EXPECT_COUNT(second, -1, -1, 2); | 160 EXPECT_COUNT(second, -1, -1, 2); |
159 EXPECT_COUNT(third, -1, -1, 1); | 161 EXPECT_COUNT(third, -1, -1, 1); |
160 EXPECT_COUNT(fourth, -1, -1, 0); | 162 EXPECT_COUNT(fourth, -1, -1, 0); |
161 | |
162 } | 163 } |
163 | 164 |
164 TEST(LayerIteratorTest, ComplexTree) { | 165 TEST(LayerIteratorTest, ComplexTree) { |
165 scoped_refptr<TestLayer> root_layer = TestLayer::Create(); | 166 scoped_refptr<TestLayer> root_layer = TestLayer::Create(); |
166 scoped_refptr<TestLayer> root1 = TestLayer::Create(); | 167 scoped_refptr<TestLayer> root1 = TestLayer::Create(); |
167 scoped_refptr<TestLayer> root2 = TestLayer::Create(); | 168 scoped_refptr<TestLayer> root2 = TestLayer::Create(); |
168 scoped_refptr<TestLayer> root3 = TestLayer::Create(); | 169 scoped_refptr<TestLayer> root3 = TestLayer::Create(); |
169 scoped_refptr<TestLayer> root21 = TestLayer::Create(); | 170 scoped_refptr<TestLayer> root21 = TestLayer::Create(); |
170 scoped_refptr<TestLayer> root22 = TestLayer::Create(); | 171 scoped_refptr<TestLayer> root22 = TestLayer::Create(); |
171 scoped_refptr<TestLayer> root23 = TestLayer::Create(); | 172 scoped_refptr<TestLayer> root23 = TestLayer::Create(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 IterateFrontToBack(&render_surface_layerList); | 207 IterateFrontToBack(&render_surface_layerList); |
207 EXPECT_COUNT(root_layer, 9, -1, 8); | 208 EXPECT_COUNT(root_layer, 9, -1, 8); |
208 EXPECT_COUNT(root1, -1, -1, 7); | 209 EXPECT_COUNT(root1, -1, -1, 7); |
209 EXPECT_COUNT(root2, -1, -1, 6); | 210 EXPECT_COUNT(root2, -1, -1, 6); |
210 EXPECT_COUNT(root21, -1, -1, 5); | 211 EXPECT_COUNT(root21, -1, -1, 5); |
211 EXPECT_COUNT(root22, -1, -1, 4); | 212 EXPECT_COUNT(root22, -1, -1, 4); |
212 EXPECT_COUNT(root221, -1, -1, 3); | 213 EXPECT_COUNT(root221, -1, -1, 3); |
213 EXPECT_COUNT(root23, -1, -1, 2); | 214 EXPECT_COUNT(root23, -1, -1, 2); |
214 EXPECT_COUNT(root231, -1, -1, 1); | 215 EXPECT_COUNT(root231, -1, -1, 1); |
215 EXPECT_COUNT(root3, -1, -1, 0); | 216 EXPECT_COUNT(root3, -1, -1, 0); |
216 | |
217 } | 217 } |
218 | 218 |
219 TEST(LayerIteratorTest, ComplexTreeMultiSurface) { | 219 TEST(LayerIteratorTest, ComplexTreeMultiSurface) { |
220 scoped_refptr<TestLayer> root_layer = TestLayer::Create(); | 220 scoped_refptr<TestLayer> root_layer = TestLayer::Create(); |
221 scoped_refptr<TestLayer> root1 = TestLayer::Create(); | 221 scoped_refptr<TestLayer> root1 = TestLayer::Create(); |
222 scoped_refptr<TestLayer> root2 = TestLayer::Create(); | 222 scoped_refptr<TestLayer> root2 = TestLayer::Create(); |
223 scoped_refptr<TestLayer> root3 = TestLayer::Create(); | 223 scoped_refptr<TestLayer> root3 = TestLayer::Create(); |
224 scoped_refptr<TestLayer> root21 = TestLayer::Create(); | 224 scoped_refptr<TestLayer> root21 = TestLayer::Create(); |
225 scoped_refptr<TestLayer> root22 = TestLayer::Create(); | 225 scoped_refptr<TestLayer> root22 = TestLayer::Create(); |
226 scoped_refptr<TestLayer> root23 = TestLayer::Create(); | 226 scoped_refptr<TestLayer> root23 = TestLayer::Create(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 EXPECT_COUNT(root21, -1, -1, 9); | 272 EXPECT_COUNT(root21, -1, -1, 9); |
273 EXPECT_COUNT(root22, 7, 8, 6); | 273 EXPECT_COUNT(root22, 7, 8, 6); |
274 EXPECT_COUNT(root221, -1, -1, 5); | 274 EXPECT_COUNT(root221, -1, -1, 5); |
275 EXPECT_COUNT(root23, 3, 4, 2); | 275 EXPECT_COUNT(root23, 3, 4, 2); |
276 EXPECT_COUNT(root231, -1, -1, 1); | 276 EXPECT_COUNT(root231, -1, -1, 1); |
277 EXPECT_COUNT(root3, -1, -1, 0); | 277 EXPECT_COUNT(root3, -1, -1, 0); |
278 } | 278 } |
279 | 279 |
280 } // namespace | 280 } // namespace |
281 } // namespace cc | 281 } // namespace cc |
OLD | NEW |