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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 scroll_state.ConsumeDelta(scroll_state.delta_x(), scroll_state.delta_y()); | 56 scroll_state.ConsumeDelta(scroll_state.delta_x(), scroll_state.delta_y()); |
57 EXPECT_TRUE(scroll_state.delta_consumed_for_scroll_sequence()); | 57 EXPECT_TRUE(scroll_state.delta_consumed_for_scroll_sequence()); |
58 EXPECT_TRUE(scroll_state.FullyConsumed()); | 58 EXPECT_TRUE(scroll_state.FullyConsumed()); |
59 } | 59 } |
60 | 60 |
61 TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) { | 61 TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) { |
62 ScrollStateData scroll_state_data; | 62 ScrollStateData scroll_state_data; |
63 ScrollState scroll_state(scroll_state_data); | 63 ScrollState scroll_state(scroll_state_data); |
64 | 64 |
65 FakeImplTaskRunnerProvider task_runner_provider; | 65 FakeImplTaskRunnerProvider task_runner_provider; |
66 TestSharedBitmapManager shared_bitmap_manager; | |
67 TestTaskGraphRunner task_graph_runner; | 66 TestTaskGraphRunner task_graph_runner; |
68 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 67 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
69 &task_graph_runner); | |
70 | 68 |
71 std::unique_ptr<LayerImpl> layer_impl = | 69 std::unique_ptr<LayerImpl> layer_impl = |
72 LayerImpl::Create(host_impl.active_tree(), 1); | 70 LayerImpl::Create(host_impl.active_tree(), 1); |
73 ScrollNode* scroll_node = | 71 ScrollNode* scroll_node = |
74 host_impl.active_tree()->property_trees()->scroll_tree.Node( | 72 host_impl.active_tree()->property_trees()->scroll_tree.Node( |
75 layer_impl->scroll_tree_index()); | 73 layer_impl->scroll_tree_index()); |
76 scroll_state.set_current_native_scrolling_node(scroll_node); | 74 scroll_state.set_current_native_scrolling_node(scroll_node); |
77 EXPECT_EQ(scroll_node, scroll_state.current_native_scrolling_node()); | 75 EXPECT_EQ(scroll_node, scroll_state.current_native_scrolling_node()); |
78 } | 76 } |
79 | 77 |
80 TEST_F(ScrollStateTest, FullyConsumed) { | 78 TEST_F(ScrollStateTest, FullyConsumed) { |
81 ScrollStateData scroll_state_data; | 79 ScrollStateData scroll_state_data; |
82 scroll_state_data.delta_x = 1; | 80 scroll_state_data.delta_x = 1; |
83 scroll_state_data.delta_y = 3; | 81 scroll_state_data.delta_y = 3; |
84 ScrollState scroll_state(scroll_state_data); | 82 ScrollState scroll_state(scroll_state_data); |
85 | 83 |
86 EXPECT_FALSE(scroll_state.FullyConsumed()); | 84 EXPECT_FALSE(scroll_state.FullyConsumed()); |
87 scroll_state.ConsumeDelta(1, 3); | 85 scroll_state.ConsumeDelta(1, 3); |
88 EXPECT_TRUE(scroll_state.FullyConsumed()); | 86 EXPECT_TRUE(scroll_state.FullyConsumed()); |
89 } | 87 } |
90 } // namespace cc | 88 } // namespace cc |
OLD | NEW |