| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/input/scroll_state.h" | 5 #include "cc/input/scroll_state.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer_impl.h" | 7 #include "cc/layers/layer_impl.h" |
| 8 #include "cc/test/fake_impl_task_runner_provider.h" | 8 #include "cc/test/fake_impl_task_runner_provider.h" |
| 9 #include "cc/test/fake_layer_tree_host_impl.h" | 9 #include "cc/test/fake_layer_tree_host_impl.h" |
| 10 #include "cc/test/test_shared_bitmap_manager.h" | 10 #include "cc/test/test_shared_bitmap_manager.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) { | 60 TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) { |
| 61 ScrollStateData scroll_state_data; | 61 ScrollStateData scroll_state_data; |
| 62 ScrollState scroll_state(scroll_state_data); | 62 ScrollState scroll_state(scroll_state_data); |
| 63 | 63 |
| 64 FakeImplTaskRunnerProvider task_runner_provider; | 64 FakeImplTaskRunnerProvider task_runner_provider; |
| 65 TestSharedBitmapManager shared_bitmap_manager; | 65 TestSharedBitmapManager shared_bitmap_manager; |
| 66 TestTaskGraphRunner task_graph_runner; | 66 TestTaskGraphRunner task_graph_runner; |
| 67 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 67 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 68 &task_graph_runner); | 68 &task_graph_runner); |
| 69 | 69 |
| 70 scoped_ptr<LayerImpl> layer_impl = | 70 std::unique_ptr<LayerImpl> layer_impl = |
| 71 LayerImpl::Create(host_impl.active_tree(), 1); | 71 LayerImpl::Create(host_impl.active_tree(), 1); |
| 72 ScrollNode* scroll_node = | 72 ScrollNode* scroll_node = |
| 73 host_impl.active_tree()->property_trees()->scroll_tree.Node( | 73 host_impl.active_tree()->property_trees()->scroll_tree.Node( |
| 74 layer_impl->scroll_tree_index()); | 74 layer_impl->scroll_tree_index()); |
| 75 scroll_state.set_current_native_scrolling_node(scroll_node); | 75 scroll_state.set_current_native_scrolling_node(scroll_node); |
| 76 EXPECT_EQ(scroll_node, scroll_state.current_native_scrolling_node()); | 76 EXPECT_EQ(scroll_node, scroll_state.current_native_scrolling_node()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 TEST_F(ScrollStateTest, FullyConsumed) { | 79 TEST_F(ScrollStateTest, FullyConsumed) { |
| 80 ScrollStateData scroll_state_data; | 80 ScrollStateData scroll_state_data; |
| 81 scroll_state_data.delta_x = 1; | 81 scroll_state_data.delta_x = 1; |
| 82 scroll_state_data.delta_y = 3; | 82 scroll_state_data.delta_y = 3; |
| 83 ScrollState scroll_state(scroll_state_data); | 83 ScrollState scroll_state(scroll_state_data); |
| 84 | 84 |
| 85 EXPECT_FALSE(scroll_state.FullyConsumed()); | 85 EXPECT_FALSE(scroll_state.FullyConsumed()); |
| 86 scroll_state.ConsumeDelta(1, 3); | 86 scroll_state.ConsumeDelta(1, 3); |
| 87 EXPECT_TRUE(scroll_state.FullyConsumed()); | 87 EXPECT_TRUE(scroll_state.FullyConsumed()); |
| 88 } | 88 } |
| 89 } // namespace cc | 89 } // namespace cc |
| OLD | NEW |