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