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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 expected_no_scroll_layer_ = root_scroll_layer_; | 503 expected_no_scroll_layer_ = root_scroll_layer_; |
504 } else { | 504 } else { |
505 expected_scroll_layer_ = root_scroll_layer_; | 505 expected_scroll_layer_ = root_scroll_layer_; |
506 expected_no_scroll_layer_ = child_layer_; | 506 expected_no_scroll_layer_ = child_layer_; |
507 } | 507 } |
508 | 508 |
509 expected_scroll_layer_->SetScrollOffset(initial_offset_); | 509 expected_scroll_layer_->SetScrollOffset(initial_offset_); |
510 | 510 |
511 layer_tree_host()->SetRootLayer(root_layer); | 511 layer_tree_host()->SetRootLayer(root_layer); |
512 LayerTreeTest::SetupTree(); | 512 LayerTreeTest::SetupTree(); |
| 513 fake_content_layer_client_.set_bounds(root_layer->bounds()); |
513 } | 514 } |
514 | 515 |
515 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 516 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
516 | 517 |
517 void WillCommit() override { | 518 void WillCommit() override { |
518 // Keep the test committing (otherwise the early out for no update | 519 // Keep the test committing (otherwise the early out for no update |
519 // will stall the test). | 520 // will stall the test). |
520 if (layer_tree_host()->source_frame_number() < 2) { | 521 if (layer_tree_host()->source_frame_number() < 2) { |
521 layer_tree_host()->SetNeedsCommit(); | 522 layer_tree_host()->SetNeedsCommit(); |
522 } | 523 } |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 layer_tree_host(), | 1144 layer_tree_host(), |
1144 layer_settings()); | 1145 layer_settings()); |
1145 | 1146 |
1146 Layer* outer_scroll_layer = | 1147 Layer* outer_scroll_layer = |
1147 layer_tree_host()->outer_viewport_scroll_layer(); | 1148 layer_tree_host()->outer_viewport_scroll_layer(); |
1148 | 1149 |
1149 Layer* root_scroll_layer = | 1150 Layer* root_scroll_layer = |
1150 CreateScrollLayer(outer_scroll_layer, &root_scroll_layer_client_); | 1151 CreateScrollLayer(outer_scroll_layer, &root_scroll_layer_client_); |
1151 CreateScrollLayer(outer_scroll_layer, &sibling_scroll_layer_client_); | 1152 CreateScrollLayer(outer_scroll_layer, &sibling_scroll_layer_client_); |
1152 CreateScrollLayer(root_scroll_layer, &child_scroll_layer_client_); | 1153 CreateScrollLayer(root_scroll_layer, &child_scroll_layer_client_); |
| 1154 fake_content_layer_client_.set_bounds(root_layer->bounds()); |
1153 } | 1155 } |
1154 | 1156 |
1155 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1157 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1156 | 1158 |
1157 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 1159 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
1158 LayerImpl* root = impl->OuterViewportScrollLayer(); | 1160 LayerImpl* root = impl->OuterViewportScrollLayer(); |
1159 switch (impl->active_tree()->source_frame_number()) { | 1161 switch (impl->active_tree()->source_frame_number()) { |
1160 case 0: | 1162 case 0: |
1161 root->child_at(0)->SetScrollDelta(gfx::Vector2dF(5, 5)); | 1163 root->child_at(0)->SetScrollDelta(gfx::Vector2dF(5, 5)); |
1162 root->child_at(0)->child_at(0)->SetScrollDelta(gfx::Vector2dF(5, 5)); | 1164 root->child_at(0)->child_at(0)->SetScrollDelta(gfx::Vector2dF(5, 5)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 RunTest(true, false); | 1223 RunTest(true, false); |
1222 } | 1224 } |
1223 | 1225 |
1224 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1226 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
1225 scroll_destroy_whole_tree_ = true; | 1227 scroll_destroy_whole_tree_ = true; |
1226 RunTest(true, false); | 1228 RunTest(true, false); |
1227 } | 1229 } |
1228 | 1230 |
1229 } // namespace | 1231 } // namespace |
1230 } // namespace cc | 1232 } // namespace cc |
OLD | NEW |