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/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
10 #include "cc/layers/picture_layer.h" | 10 #include "cc/layers/picture_layer.h" |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 expected_no_scroll_layer_impl = root_scroll_layer_impl; | 559 expected_no_scroll_layer_impl = root_scroll_layer_impl; |
560 } else { | 560 } else { |
561 expected_scroll_layer_impl = root_scroll_layer_impl; | 561 expected_scroll_layer_impl = root_scroll_layer_impl; |
562 expected_no_scroll_layer_impl = child_layer_impl; | 562 expected_no_scroll_layer_impl = child_layer_impl; |
563 } | 563 } |
564 | 564 |
565 EXPECT_VECTOR_EQ(gfx::Vector2d(), root_impl->ScrollDelta()); | 565 EXPECT_VECTOR_EQ(gfx::Vector2d(), root_impl->ScrollDelta()); |
566 EXPECT_VECTOR_EQ(gfx::Vector2d(), | 566 EXPECT_VECTOR_EQ(gfx::Vector2d(), |
567 expected_no_scroll_layer_impl->ScrollDelta()); | 567 expected_no_scroll_layer_impl->ScrollDelta()); |
568 | 568 |
569 // Ensure device scale factor is affecting the layers. | 569 // Ensure device scale factor matches the active tree. |
570 EXPECT_FLOAT_EQ(device_scale_factor_, | 570 EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor()); |
571 root_scroll_layer_impl->HighResTiling()->contents_scale()); | |
572 | |
573 EXPECT_FLOAT_EQ(device_scale_factor_, | |
574 child_layer_impl->HighResTiling()->contents_scale()); | |
575 | |
576 switch (impl->active_tree()->source_frame_number()) { | 571 switch (impl->active_tree()->source_frame_number()) { |
577 case 0: { | 572 case 0: { |
578 // Gesture scroll on impl thread. | 573 // Gesture scroll on impl thread. |
579 InputHandler::ScrollStatus status = impl->ScrollBegin( | 574 InputHandler::ScrollStatus status = impl->ScrollBegin( |
580 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() - | 575 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() - |
581 gfx::Vector2dF(0.5f, 0.5f)), | 576 gfx::Vector2dF(0.5f, 0.5f)), |
582 InputHandler::Gesture); | 577 InputHandler::Gesture); |
583 EXPECT_EQ(InputHandler::ScrollStarted, status); | 578 EXPECT_EQ(InputHandler::ScrollStarted, status); |
584 impl->ScrollBy(gfx::Point(), scroll_amount_); | 579 impl->ScrollBy(gfx::Point(), scroll_amount_); |
585 impl->ScrollEnd(); | 580 impl->ScrollEnd(); |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 RunTest(true, false, true); | 1215 RunTest(true, false, true); |
1221 } | 1216 } |
1222 | 1217 |
1223 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1218 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
1224 scroll_destroy_whole_tree_ = true; | 1219 scroll_destroy_whole_tree_ = true; |
1225 RunTest(true, false, true); | 1220 RunTest(true, false, true); |
1226 } | 1221 } |
1227 | 1222 |
1228 } // namespace | 1223 } // namespace |
1229 } // namespace cc | 1224 } // namespace cc |
OLD | NEW |