| 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 "platform/scroll/ScrollableArea.h" | 5 #include "platform/scroll/ScrollableArea.h" |
| 6 | 6 |
| 7 #include "platform/graphics/Color.h" | 7 #include "platform/graphics/Color.h" |
| 8 #include "platform/graphics/GraphicsLayer.h" | 8 #include "platform/graphics/GraphicsLayer.h" |
| 9 #include "platform/scroll/ScrollbarTestSuite.h" | 9 #include "platform/scroll/ScrollbarTestSuite.h" |
| 10 #include "platform/scroll/ScrollbarTheme.h" | 10 #include "platform/scroll/ScrollbarTheme.h" |
| 11 #include "platform/scroll/ScrollbarThemeMock.h" | 11 #include "platform/scroll/ScrollbarThemeMock.h" |
| 12 #include "platform/testing/FakeGraphicsLayer.h" | 12 #include "platform/testing/FakeGraphicsLayer.h" |
| 13 #include "platform/testing/FakeGraphicsLayerClient.h" | 13 #include "platform/testing/FakeGraphicsLayerClient.h" |
| 14 #include "platform/testing/TestingPlatformSupport.h" | 14 #include "platform/testing/TestingPlatformSupport.h" |
| 15 #include "public/platform/Platform.h" | 15 #include "public/platform/Platform.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 using testing::_; | 23 using ::testing::_; |
| 24 using testing::Return; | 24 using ::testing::Return; |
| 25 | 25 |
| 26 class ScrollbarThemeWithMockInvalidation : public ScrollbarThemeMock { | 26 class ScrollbarThemeWithMockInvalidation : public ScrollbarThemeMock { |
| 27 public: | 27 public: |
| 28 MOCK_CONST_METHOD0(ShouldRepaintAllPartsOnInvalidation, bool()); | 28 MOCK_CONST_METHOD0(ShouldRepaintAllPartsOnInvalidation, bool()); |
| 29 MOCK_CONST_METHOD3(InvalidateOnThumbPositionChange, | 29 MOCK_CONST_METHOD3(InvalidateOnThumbPositionChange, |
| 30 ScrollbarPart(const ScrollbarThemeClient&, float, float)); | 30 ScrollbarPart(const ScrollbarThemeClient&, float, float)); |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 using ScrollableAreaTest = testing::Test; | 35 using ScrollableAreaTest = ::testing::Test; |
| 36 | 36 |
| 37 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) { | 37 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) { |
| 38 ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> | 38 ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> |
| 39 platform; | 39 platform; |
| 40 | 40 |
| 41 MockScrollableArea* scrollable_area = | 41 MockScrollableArea* scrollable_area = |
| 42 MockScrollableArea::Create(ScrollOffset(0, 100)); | 42 MockScrollableArea::Create(ScrollOffset(0, 100)); |
| 43 scrollable_area->SetScrollOffset(ScrollOffset(0, 10000), kCompositorScroll); | 43 scrollable_area->SetScrollOffset(ScrollOffset(0, 10000), kCompositorScroll); |
| 44 EXPECT_EQ(100.0, | 44 EXPECT_EQ(100.0, |
| 45 scrollable_area->GetScrollAnimator().CurrentOffset().Height()); | 45 scrollable_area->GetScrollAnimator().CurrentOffset().Height()); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 MockScrollableArea::Create(ScrollOffset(100, 100)); | 262 MockScrollableArea::Create(ScrollOffset(100, 100)); |
| 263 scrollable_area->SetScrollOrigin(IntPoint(20, 30)); | 263 scrollable_area->SetScrollOrigin(IntPoint(20, 30)); |
| 264 scrollable_area->DidScroll(gfx::ScrollOffset(40, 51)); | 264 scrollable_area->DidScroll(gfx::ScrollOffset(40, 51)); |
| 265 | 265 |
| 266 // After calling didScroll, the new offset should account for scroll origin. | 266 // After calling didScroll, the new offset should account for scroll origin. |
| 267 EXPECT_EQ(20, scrollable_area->ScrollOffsetInt().Width()); | 267 EXPECT_EQ(20, scrollable_area->ScrollOffsetInt().Width()); |
| 268 EXPECT_EQ(21, scrollable_area->ScrollOffsetInt().Height()); | 268 EXPECT_EQ(21, scrollable_area->ScrollOffsetInt().Height()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |