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