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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h

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: native_theme_base edits 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/ScrollbarTestSuite.h
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h b/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0551daf066d52202c4f3b69dc25e1e0a12e284a
--- /dev/null
+++ b/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h
@@ -0,0 +1,106 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
jbroman 2016/05/13 17:35:49 This file is not listed in the build files; please
Bret 2016/05/13 22:11:00 Done. The other test support files like ScrollbarT
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ScrollbarTestSuite_h
+#define ScrollbarTestSuite_h
+
+#include "platform/heap/GarbageCollected.h"
+#include "platform/scroll/ScrollableArea.h"
+#include "platform/scroll/Scrollbar.h"
+#include "platform/scroll/ScrollbarThemeMock.h"
+#include "platform/testing/TestingPlatformSupport.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace blink {
+
+class MockScrollableArea : public GarbageCollectedFinalized<MockScrollableArea>, public ScrollableArea {
+ USING_GARBAGE_COLLECTED_MIXIN(MockScrollableArea);
+
+public:
+ static MockScrollableArea* create()
+ {
+ return new MockScrollableArea();
+ }
+
+ static MockScrollableArea* create(const IntPoint& maximumScrollPosition)
+ {
+ MockScrollableArea* mock = create();
+ mock->setMaximumScrollPosition(maximumScrollPosition);
+ return mock;
+ }
+
+ 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_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; }
+ void scrollControlWasSetNeedsPaintInvalidation() {}
+
+ using ScrollableArea::horizontalScrollbarNeedsPaintInvalidation;
+ using ScrollableArea::verticalScrollbarNeedsPaintInvalidation;
+ using ScrollableArea::clearNeedsPaintInvalidationForScrollControls;
+
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ ScrollableArea::trace(visitor);
+ }
+
+private:
+ void setMaximumScrollPosition(const IntPoint& maximumScrollPosition)
+ {
+ m_maximumScrollPosition = maximumScrollPosition;
+ }
+
+ explicit MockScrollableArea()
+ : m_maximumScrollPosition(IntPoint(0, 100))
+ {
+ }
+
+ IntPoint m_scrollPosition;
+ IntPoint m_maximumScrollPosition;
+};
+
+class ScrollbarTestSuite : public testing::Test {
+public:
+ ScrollbarTestSuite() {}
+
+ 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;
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698