| 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( |
| 30 ScrollbarPart(const ScrollbarThemeClient&, float, float)); | 30 invalidateOnThumbPositionChange, |
| 31 ScrollbarPart(const ScrollbarThemeClient&, float, float, bool)); |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 } // namespace | 34 } // namespace |
| 34 | 35 |
| 35 using ScrollableAreaTest = testing::Test; | 36 using ScrollableAreaTest = testing::Test; |
| 36 | 37 |
| 37 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) { | 38 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) { |
| 38 ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> | 39 ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> |
| 39 platform; | 40 platform; |
| 40 | 41 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 MockScrollableArea::create(ScrollOffset(100, 100)); | 262 MockScrollableArea::create(ScrollOffset(100, 100)); |
| 262 scrollableArea->setScrollOrigin(IntPoint(20, 30)); | 263 scrollableArea->setScrollOrigin(IntPoint(20, 30)); |
| 263 scrollableArea->didScroll(gfx::ScrollOffset(40, 51)); | 264 scrollableArea->didScroll(gfx::ScrollOffset(40, 51)); |
| 264 | 265 |
| 265 // After calling didScroll, the new offset should account for scroll origin. | 266 // After calling didScroll, the new offset should account for scroll origin. |
| 266 EXPECT_EQ(20, scrollableArea->scrollOffsetInt().width()); | 267 EXPECT_EQ(20, scrollableArea->scrollOffsetInt().width()); |
| 267 EXPECT_EQ(21, scrollableArea->scrollOffsetInt().height()); | 268 EXPECT_EQ(21, scrollableArea->scrollOffsetInt().height()); |
| 268 } | 269 } |
| 269 | 270 |
| 270 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |