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

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

Issue 2006643004: Fix scrollbar buttons on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test 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/ScrollbarThemeAuraTest.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAuraTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAuraTest.cpp
index 110ca2f089883c4dea2818522ca7350d0aa72097..ecc121bfe60a8ea93e80569c65ebbb5579d800df 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAuraTest.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAuraTest.cpp
@@ -10,6 +10,25 @@ namespace blink {
using testing::Return;
+namespace {
+
+class ScrollbarThemeAuraButtonOverride : public ScrollbarThemeAura {
esprehn 2016/05/23 23:11:19 final
Bret 2016/05/23 23:44:06 Done.
+public:
+ ScrollbarThemeAuraButtonOverride()
+ : m_hasScrollbarButtons(true)
+ {
+ }
+
+ bool m_hasScrollbarButtons;
esprehn 2016/05/23 23:11:19 no m_ if it's public, but can we just use a setter
Bret 2016/05/23 23:44:06 Sure. Done.
+
+ bool hasScrollbarButtons() const override
+ {
+ return m_hasScrollbarButtons;
+ }
+};
+
+} // namespace
+
class ScrollbarThemeAuraTest : public ScrollbarTestSuite {
};
@@ -19,7 +38,7 @@ TEST_F(ScrollbarThemeAuraTest, ButtonSizeHorizontal)
ScrollbarThemeMock mockTheme;
Scrollbar* scrollbar = Scrollbar::createForTesting(
mockScrollableArea, HorizontalScrollbar, RegularScrollbar, &mockTheme);
- ScrollbarThemeAura theme;
+ ScrollbarThemeAuraButtonOverride theme;
IntRect scrollbarSizeNormalDimensions(11, 22, 444, 66);
scrollbar->setFrameRect(scrollbarSizeNormalDimensions);
@@ -42,7 +61,7 @@ TEST_F(ScrollbarThemeAuraTest, ButtonSizeVertical)
ScrollbarThemeMock mockTheme;
Scrollbar* scrollbar = Scrollbar::createForTesting(
mockScrollableArea, VerticalScrollbar, RegularScrollbar, &mockTheme);
- ScrollbarThemeAura theme;
+ ScrollbarThemeAuraButtonOverride theme;
IntRect scrollbarSizeNormalDimensions(11, 22, 44, 666);
scrollbar->setFrameRect(scrollbarSizeNormalDimensions);
@@ -59,4 +78,21 @@ TEST_F(ScrollbarThemeAuraTest, ButtonSizeVertical)
ThreadHeap::collectAllGarbage();
}
+TEST_F(ScrollbarThemeAuraTest, NoButtonsReturnsSize0)
+{
+ MockScrollableArea* mockScrollableArea = MockScrollableArea::create();
+ ScrollbarThemeMock mockTheme;
+ Scrollbar* scrollbar = Scrollbar::createForTesting(
+ mockScrollableArea, VerticalScrollbar, RegularScrollbar, &mockTheme);
+ ScrollbarThemeAuraButtonOverride theme;
+ theme.m_hasScrollbarButtons = false;
+
+ scrollbar->setFrameRect(IntRect(1, 2, 3, 4));
+ IntSize size = theme.buttonSize(*scrollbar);
+ EXPECT_EQ(0, size.width());
+ EXPECT_EQ(0, size.height());
+
+ ThreadHeap::collectAllGarbage();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698