| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ScrollbarThemeAura.h" | 5 #include "platform/scroll/ScrollbarThemeAura.h" |
| 6 | 6 |
| 7 #include "platform/scroll/ScrollbarTestSuite.h" | 7 #include "platform/scroll/ScrollbarTestSuite.h" |
| 8 #include "platform/testing/TestingPlatformSupport.h" | 8 #include "platform/testing/TestingPlatformSupport.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 using testing::Return; | 12 using ::testing::Return; |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class ScrollbarThemeAuraButtonOverride final : public ScrollbarThemeAura { | 16 class ScrollbarThemeAuraButtonOverride final : public ScrollbarThemeAura { |
| 17 public: | 17 public: |
| 18 ScrollbarThemeAuraButtonOverride() : has_scrollbar_buttons_(true) {} | 18 ScrollbarThemeAuraButtonOverride() : has_scrollbar_buttons_(true) {} |
| 19 | 19 |
| 20 void SetHasScrollbarButtons(bool value) { has_scrollbar_buttons_ = value; } | 20 void SetHasScrollbarButtons(bool value) { has_scrollbar_buttons_ = value; } |
| 21 | 21 |
| 22 bool HasScrollbarButtons(ScrollbarOrientation unused) const override { | 22 bool HasScrollbarButtons(ScrollbarOrientation unused) const override { |
| 23 return has_scrollbar_buttons_; | 23 return has_scrollbar_buttons_; |
| 24 } | 24 } |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 bool has_scrollbar_buttons_; | 27 bool has_scrollbar_buttons_; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 using ScrollbarThemeAuraTest = testing::Test; | 32 using ScrollbarThemeAuraTest = ::testing::Test; |
| 33 | 33 |
| 34 TEST_F(ScrollbarThemeAuraTest, ButtonSizeHorizontal) { | 34 TEST_F(ScrollbarThemeAuraTest, ButtonSizeHorizontal) { |
| 35 ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> | 35 ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> |
| 36 platform; | 36 platform; |
| 37 | 37 |
| 38 MockScrollableArea* mock_scrollable_area = MockScrollableArea::Create(); | 38 MockScrollableArea* mock_scrollable_area = MockScrollableArea::Create(); |
| 39 ScrollbarThemeMock mock_theme; | 39 ScrollbarThemeMock mock_theme; |
| 40 Scrollbar* scrollbar = | 40 Scrollbar* scrollbar = |
| 41 Scrollbar::CreateForTesting(mock_scrollable_area, kHorizontalScrollbar, | 41 Scrollbar::CreateForTesting(mock_scrollable_area, kHorizontalScrollbar, |
| 42 kRegularScrollbar, &mock_theme); | 42 kRegularScrollbar, &mock_theme); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 scrollbar->SetFrameRect(IntRect(1, 2, 3, 4)); | 96 scrollbar->SetFrameRect(IntRect(1, 2, 3, 4)); |
| 97 IntSize size = theme.ButtonSize(*scrollbar); | 97 IntSize size = theme.ButtonSize(*scrollbar); |
| 98 EXPECT_EQ(0, size.Width()); | 98 EXPECT_EQ(0, size.Width()); |
| 99 EXPECT_EQ(0, size.Height()); | 99 EXPECT_EQ(0, size.Height()); |
| 100 | 100 |
| 101 ThreadState::Current()->CollectAllGarbage(); | 101 ThreadState::Current()->CollectAllGarbage(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |