Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp

Issue 1911973002: Fix scrollbar buttons at hidpi when enable-use-zoom-for-dsf is on. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
index 4c1e682fc9232538067494d2628e20f204b85d21..8d079f6f34083282fec2d59fe6c859b675af797f 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
@@ -6,6 +6,7 @@
#include "platform/graphics/Color.h"
#include "platform/graphics/GraphicsLayer.h"
+#include "platform/scroll/ScrollbarTestSuite.h"
#include "platform/scroll/ScrollbarTheme.h"
#include "platform/scroll/ScrollbarThemeMock.h"
#include "platform/testing/FakeGraphicsLayer.h"
@@ -22,78 +23,15 @@ namespace {
using testing::_;
using testing::Return;
-class MockScrollableArea : public GarbageCollectedFinalized<MockScrollableArea>, public ScrollableArea {
- USING_GARBAGE_COLLECTED_MIXIN(MockScrollableArea);
+class ScrollbarThemeWithMockInvalidation : public ScrollbarThemeMock {
public:
- static MockScrollableArea* create(const IntPoint& maximumScrollPosition)
- {
- return new MockScrollableArea(maximumScrollPosition);
- }
-
- MOCK_CONST_METHOD0(visualRectForScrollbarParts, LayoutRect());
- MOCK_CONST_METHOD0(isActive, bool());
- MOCK_CONST_METHOD1(scrollSize, int(ScrollbarOrientation));
- MOCK_CONST_METHOD0(isScrollCornerVisible, bool());
- MOCK_CONST_METHOD0(scrollCornerRect, IntRect());
- MOCK_CONST_METHOD0(horizontalScrollbar, Scrollbar*());
- MOCK_CONST_METHOD0(verticalScrollbar, Scrollbar*());
- MOCK_METHOD0(scrollControlWasSetNeedsPaintInvalidation, void());
- MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*());
- MOCK_CONST_METHOD1(visibleContentRect, IntRect(IncludeScrollbarsInRect));
- MOCK_CONST_METHOD0(contentsSize, IntSize());
- MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect());
- MOCK_CONST_METHOD0(layerForHorizontalScrollbar, GraphicsLayer*());
- MOCK_CONST_METHOD0(layerForVerticalScrollbar, GraphicsLayer*());
-
- bool userInputScrollable(ScrollbarOrientation) const override { return true; }
- bool scrollbarsCanBeActive () const override { return true; }
- bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; }
- void setScrollOffset(const DoublePoint& offset, ScrollType) override { m_scrollPosition = flooredIntPoint(offset).shrunkTo(m_maximumScrollPosition); }
- IntPoint scrollPosition() const override { return m_scrollPosition; }
- IntPoint minimumScrollPosition() const override { return IntPoint(); }
- IntPoint maximumScrollPosition() const override { return m_maximumScrollPosition; }
- int visibleHeight() const override { return 768; }
- int visibleWidth() const override { return 1024; }
- bool scrollAnimatorEnabled() const override { return false; }
- int pageStep(ScrollbarOrientation) const override { return 0; }
-
- using ScrollableArea::horizontalScrollbarNeedsPaintInvalidation;
- using ScrollableArea::verticalScrollbarNeedsPaintInvalidation;
- using ScrollableArea::clearNeedsPaintInvalidationForScrollControls;
-
- DEFINE_INLINE_VIRTUAL_TRACE()
- {
- ScrollableArea::trace(visitor);
- }
-
-private:
- explicit MockScrollableArea(const IntPoint& maximumScrollPosition)
- : m_maximumScrollPosition(maximumScrollPosition) { }
-
- IntPoint m_scrollPosition;
- IntPoint m_maximumScrollPosition;
+ MOCK_CONST_METHOD0(shouldRepaintAllPartsOnInvalidation, bool());
+ MOCK_CONST_METHOD3(invalidateOnThumbPositionChange, ScrollbarPart(const ScrollbarThemeClient&, float, float));
};
} // namespace
-class ScrollableAreaTest : public testing::Test {
-public:
- ScrollableAreaTest() { }
-
- void SetUp() override
- {
- TestingPlatformSupport::Config config;
- config.compositorSupport = Platform::current()->compositorSupport();
- m_fakePlatform = adoptPtr(new TestingPlatformSupportWithMockScheduler(config));
- }
-
- void TearDown() override
- {
- m_fakePlatform = nullptr;
- }
-
-private:
- OwnPtr<TestingPlatformSupportWithMockScheduler> m_fakePlatform;
+class ScrollableAreaTest : public ScrollbarTestSuite {
};
TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync)
@@ -103,16 +41,6 @@ TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync)
EXPECT_EQ(100.0, scrollableArea->scrollAnimator().currentPosition().y());
}
-namespace {
-
-class ScrollbarThemeWithMockInvalidation : public ScrollbarThemeMock {
-public:
- MOCK_CONST_METHOD0(shouldRepaintAllPartsOnInvalidation, bool());
- MOCK_CONST_METHOD3(invalidateOnThumbPositionChange, ScrollbarPart(const ScrollbarThemeClient&, float, float));
-};
-
-} // namespace
-
TEST_F(ScrollableAreaTest, ScrollbarTrackAndThumbRepaint)
{
ScrollbarThemeWithMockInvalidation theme;
« no previous file with comments | « third_party/WebKit/Source/platform/blink_platform.gypi ('k') | third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698