| 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" |
| 11 #include "cc/test/test_task_graph_runner.h" |
| 11 #include "cc/trees/layer_tree_host_common.h" | 12 #include "cc/trees/layer_tree_host_common.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/gfx/transform.h" | 15 #include "ui/gfx/transform.h" |
| 15 | 16 |
| 16 using ::testing::Mock; | 17 using ::testing::Mock; |
| 17 using ::testing::_; | 18 using ::testing::_; |
| 18 using ::testing::AtLeast; | 19 using ::testing::AtLeast; |
| 19 using ::testing::AnyNumber; | 20 using ::testing::AnyNumber; |
| 20 | 21 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 scoped_refptr<TestLayer> second = TestLayer::Create(settings); | 108 scoped_refptr<TestLayer> second = TestLayer::Create(settings); |
| 108 scoped_refptr<TestLayer> third = TestLayer::Create(settings); | 109 scoped_refptr<TestLayer> third = TestLayer::Create(settings); |
| 109 scoped_refptr<TestLayer> fourth = TestLayer::Create(settings); | 110 scoped_refptr<TestLayer> fourth = TestLayer::Create(settings); |
| 110 | 111 |
| 111 root_layer->AddChild(first); | 112 root_layer->AddChild(first); |
| 112 root_layer->AddChild(second); | 113 root_layer->AddChild(second); |
| 113 root_layer->AddChild(third); | 114 root_layer->AddChild(third); |
| 114 root_layer->AddChild(fourth); | 115 root_layer->AddChild(fourth); |
| 115 | 116 |
| 116 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 117 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
| 117 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); | 118 TestTaskGraphRunner task_graph_runner; |
| 119 scoped_ptr<FakeLayerTreeHost> host = |
| 120 FakeLayerTreeHost::Create(&client, &task_graph_runner); |
| 118 host->SetRootLayer(root_layer); | 121 host->SetRootLayer(root_layer); |
| 119 | 122 |
| 120 RenderSurfaceLayerList render_surface_layer_list; | 123 RenderSurfaceLayerList render_surface_layer_list; |
| 121 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 124 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 122 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); | 125 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); |
| 123 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 126 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 124 | 127 |
| 125 IterateFrontToBack(&render_surface_layer_list); | 128 IterateFrontToBack(&render_surface_layer_list); |
| 126 EXPECT_COUNT(root_layer, 5, -1, 4); | 129 EXPECT_COUNT(root_layer, 5, -1, 4); |
| 127 EXPECT_COUNT(first, -1, -1, 3); | 130 EXPECT_COUNT(first, -1, -1, 3); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 145 root_layer->AddChild(root1); | 148 root_layer->AddChild(root1); |
| 146 root_layer->AddChild(root2); | 149 root_layer->AddChild(root2); |
| 147 root_layer->AddChild(root3); | 150 root_layer->AddChild(root3); |
| 148 root2->AddChild(root21); | 151 root2->AddChild(root21); |
| 149 root2->AddChild(root22); | 152 root2->AddChild(root22); |
| 150 root2->AddChild(root23); | 153 root2->AddChild(root23); |
| 151 root22->AddChild(root221); | 154 root22->AddChild(root221); |
| 152 root23->AddChild(root231); | 155 root23->AddChild(root231); |
| 153 | 156 |
| 154 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 157 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
| 155 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); | 158 TestTaskGraphRunner task_graph_runner; |
| 159 scoped_ptr<FakeLayerTreeHost> host = |
| 160 FakeLayerTreeHost::Create(&client, &task_graph_runner); |
| 156 host->SetRootLayer(root_layer); | 161 host->SetRootLayer(root_layer); |
| 157 | 162 |
| 158 RenderSurfaceLayerList render_surface_layer_list; | 163 RenderSurfaceLayerList render_surface_layer_list; |
| 159 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 164 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 160 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); | 165 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); |
| 161 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 166 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 162 | 167 |
| 163 IterateFrontToBack(&render_surface_layer_list); | 168 IterateFrontToBack(&render_surface_layer_list); |
| 164 EXPECT_COUNT(root_layer, 9, -1, 8); | 169 EXPECT_COUNT(root_layer, 9, -1, 8); |
| 165 EXPECT_COUNT(root1, -1, -1, 7); | 170 EXPECT_COUNT(root1, -1, -1, 7); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 192 root2->SetForceRenderSurface(true); // Force the layer to own a new surface. | 197 root2->SetForceRenderSurface(true); // Force the layer to own a new surface. |
| 193 root2->AddChild(root21); | 198 root2->AddChild(root21); |
| 194 root2->AddChild(root22); | 199 root2->AddChild(root22); |
| 195 root2->AddChild(root23); | 200 root2->AddChild(root23); |
| 196 root22->SetOpacity(0.5f); | 201 root22->SetOpacity(0.5f); |
| 197 root22->AddChild(root221); | 202 root22->AddChild(root221); |
| 198 root23->SetOpacity(0.5f); | 203 root23->SetOpacity(0.5f); |
| 199 root23->AddChild(root231); | 204 root23->AddChild(root231); |
| 200 | 205 |
| 201 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 206 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
| 202 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); | 207 TestTaskGraphRunner task_graph_runner; |
| 208 scoped_ptr<FakeLayerTreeHost> host = |
| 209 FakeLayerTreeHost::Create(&client, &task_graph_runner); |
| 203 host->SetRootLayer(root_layer); | 210 host->SetRootLayer(root_layer); |
| 204 | 211 |
| 205 RenderSurfaceLayerList render_surface_layer_list; | 212 RenderSurfaceLayerList render_surface_layer_list; |
| 206 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 213 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 207 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); | 214 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); |
| 208 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 215 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 209 | 216 |
| 210 IterateFrontToBack(&render_surface_layer_list); | 217 IterateFrontToBack(&render_surface_layer_list); |
| 211 EXPECT_COUNT(root_layer, 14, -1, 13); | 218 EXPECT_COUNT(root_layer, 14, -1, 13); |
| 212 EXPECT_COUNT(root1, -1, -1, 12); | 219 EXPECT_COUNT(root1, -1, -1, 12); |
| 213 EXPECT_COUNT(root2, 10, 11, -1); | 220 EXPECT_COUNT(root2, 10, 11, -1); |
| 214 EXPECT_COUNT(root21, -1, -1, 9); | 221 EXPECT_COUNT(root21, -1, -1, 9); |
| 215 EXPECT_COUNT(root22, 7, 8, 6); | 222 EXPECT_COUNT(root22, 7, 8, 6); |
| 216 EXPECT_COUNT(root221, -1, -1, 5); | 223 EXPECT_COUNT(root221, -1, -1, 5); |
| 217 EXPECT_COUNT(root23, 3, 4, 2); | 224 EXPECT_COUNT(root23, 3, 4, 2); |
| 218 EXPECT_COUNT(root231, -1, -1, 1); | 225 EXPECT_COUNT(root231, -1, -1, 1); |
| 219 EXPECT_COUNT(root3, -1, -1, 0); | 226 EXPECT_COUNT(root3, -1, -1, 0); |
| 220 } | 227 } |
| 221 | 228 |
| 222 } // namespace | 229 } // namespace |
| 223 } // namespace cc | 230 } // namespace cc |
| OLD | NEW |