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_proxy.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" |
11 #include "cc/test/test_task_graph_runner.h" | 11 #include "cc/test/test_task_graph_runner.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 class ScrollStateTest : public testing::Test {}; | 17 class ScrollStateTest : public testing::Test {}; |
18 | 18 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 EXPECT_FALSE(scrollState.FullyConsumed()); | 50 EXPECT_FALSE(scrollState.FullyConsumed()); |
51 | 51 |
52 scrollState.ConsumeDelta(scrollState.delta_x(), scrollState.delta_y()); | 52 scrollState.ConsumeDelta(scrollState.delta_x(), scrollState.delta_y()); |
53 EXPECT_TRUE(scrollState.delta_consumed_for_scroll_sequence()); | 53 EXPECT_TRUE(scrollState.delta_consumed_for_scroll_sequence()); |
54 EXPECT_TRUE(scrollState.FullyConsumed()); | 54 EXPECT_TRUE(scrollState.FullyConsumed()); |
55 } | 55 } |
56 | 56 |
57 TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) { | 57 TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) { |
58 ScrollState scrollState(0, 0, 0, 0, false, false, false); | 58 ScrollState scrollState(0, 0, 0, 0, false, false, false); |
59 | 59 |
60 FakeImplProxy proxy; | 60 FakeImplTaskRunnerProvider task_runner_provider; |
61 TestSharedBitmapManager shared_bitmap_manager; | 61 TestSharedBitmapManager shared_bitmap_manager; |
62 TestTaskGraphRunner task_graph_runner; | 62 TestTaskGraphRunner task_graph_runner; |
63 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 63 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
64 &task_graph_runner); | 64 &task_graph_runner); |
65 | 65 |
66 scoped_ptr<LayerImpl> layer_impl = | 66 scoped_ptr<LayerImpl> layer_impl = |
67 LayerImpl::Create(host_impl.active_tree(), 1); | 67 LayerImpl::Create(host_impl.active_tree(), 1); |
68 scrollState.set_current_native_scrolling_layer(layer_impl.get()); | 68 scrollState.set_current_native_scrolling_layer(layer_impl.get()); |
69 EXPECT_EQ(layer_impl, scrollState.current_native_scrolling_layer()); | 69 EXPECT_EQ(layer_impl, scrollState.current_native_scrolling_layer()); |
70 } | 70 } |
71 | 71 |
72 TEST_F(ScrollStateTest, FullyConsumed) { | 72 TEST_F(ScrollStateTest, FullyConsumed) { |
73 ScrollState scrollState(1, 3, 0, 0, 0, false, false); | 73 ScrollState scrollState(1, 3, 0, 0, 0, false, false); |
74 EXPECT_FALSE(scrollState.FullyConsumed()); | 74 EXPECT_FALSE(scrollState.FullyConsumed()); |
75 | 75 |
76 scrollState.ConsumeDelta(1, 3); | 76 scrollState.ConsumeDelta(1, 3); |
77 EXPECT_TRUE(scrollState.FullyConsumed()); | 77 EXPECT_TRUE(scrollState.FullyConsumed()); |
78 } | 78 } |
79 } // namespace cc | 79 } // namespace cc |
OLD | NEW |