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 "core/page/scrolling/ScrollState.h" | 5 #include "core/page/scrolling/ScrollState.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "wtf/PtrUtil.h" |
| 11 #include <memory> |
10 | 12 |
11 namespace blink { | 13 namespace blink { |
12 | 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 ScrollState* CreateScrollState(double deltaX, double deltaY, bool beginning, boo
l ending) | 17 ScrollState* CreateScrollState(double deltaX, double deltaY, bool beginning, boo
l ending) |
16 { | 18 { |
17 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); | 19 std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStat
eData()); |
18 scrollStateData->delta_x = deltaX; | 20 scrollStateData->delta_x = deltaX; |
19 scrollStateData->delta_y = deltaY; | 21 scrollStateData->delta_y = deltaY; |
20 scrollStateData->is_beginning = beginning; | 22 scrollStateData->is_beginning = beginning; |
21 scrollStateData->is_ending = ending; | 23 scrollStateData->is_ending = ending; |
22 return ScrollState::create(std::move(scrollStateData)); | 24 return ScrollState::create(std::move(scrollStateData)); |
23 } | 25 } |
24 | 26 |
25 class ScrollStateTest : public testing::Test { | 27 class ScrollStateTest : public testing::Test { |
26 }; | 28 }; |
27 | 29 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 ScrollState* scrollState = CreateScrollState(0, 0, false, false); | 80 ScrollState* scrollState = CreateScrollState(0, 0, false, false); |
79 ScrollState* scrollStateEnd = CreateScrollState(0, 0, false, true); | 81 ScrollState* scrollStateEnd = CreateScrollState(0, 0, false, true); |
80 EXPECT_FALSE(scrollStateBegin->fullyConsumed()); | 82 EXPECT_FALSE(scrollStateBegin->fullyConsumed()); |
81 EXPECT_TRUE(scrollState->fullyConsumed()); | 83 EXPECT_TRUE(scrollState->fullyConsumed()); |
82 EXPECT_FALSE(scrollStateEnd->fullyConsumed()); | 84 EXPECT_FALSE(scrollStateEnd->fullyConsumed()); |
83 } | 85 } |
84 | 86 |
85 } // namespace | 87 } // namespace |
86 | 88 |
87 } // namespace blink | 89 } // namespace blink |
OLD | NEW |