| 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/GraphicsLayer.h" | 7 #include "platform/graphics/GraphicsLayer.h" |
| 8 #include "platform/scroll/ScrollbarTheme.h" | 8 #include "platform/scroll/ScrollbarTheme.h" |
| 9 #include "platform/scroll/ScrollbarThemeMock.h" | 9 #include "platform/scroll/ScrollbarThemeMock.h" |
| 10 #include "platform/testing/TestingPlatformSupport.h" | 10 #include "platform/testing/TestingPlatformSupport.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 MockGraphicsLayer graphicsLayer(&graphicsLayerClient); | 170 MockGraphicsLayer graphicsLayer(&graphicsLayerClient); |
| 171 graphicsLayer.setDrawsContent(true); | 171 graphicsLayer.setDrawsContent(true); |
| 172 graphicsLayer.setSize(FloatSize(111, 222)); | 172 graphicsLayer.setSize(FloatSize(111, 222)); |
| 173 | 173 |
| 174 EXPECT_CALL(*scrollableArea, layerForHorizontalScrollbar()).WillRepeatedly(R
eturn(&graphicsLayer)); | 174 EXPECT_CALL(*scrollableArea, layerForHorizontalScrollbar()).WillRepeatedly(R
eturn(&graphicsLayer)); |
| 175 | 175 |
| 176 RefPtrWillBeRawPtr<Scrollbar> scrollbar = Scrollbar::create(scrollableArea.g
et(), HorizontalScrollbar, RegularScrollbar, nullptr); | 176 RefPtrWillBeRawPtr<Scrollbar> scrollbar = Scrollbar::create(scrollableArea.g
et(), HorizontalScrollbar, RegularScrollbar, nullptr); |
| 177 graphicsLayer.resetTrackedPaintInvalidations(); | 177 graphicsLayer.resetTrackedPaintInvalidations(); |
| 178 scrollbar->setNeedsPaintInvalidation(NoPart); | 178 scrollbar->setNeedsPaintInvalidation(NoPart); |
| 179 EXPECT_TRUE(graphicsLayer.hasTrackedPaintInvalidations()); | 179 EXPECT_TRUE(graphicsLayer.hasTrackedPaintInvalidations()); |
| 180 |
| 181 // Forced GC in order to finalize objects depending on the mock object. |
| 182 Heap::collectAllGarbage(); |
| 180 } | 183 } |
| 181 | 184 |
| 182 TEST_F(ScrollableAreaTest, InvalidatesNonCompositedScrollbarsWhenThumbMoves) | 185 TEST_F(ScrollableAreaTest, InvalidatesNonCompositedScrollbarsWhenThumbMoves) |
| 183 { | 186 { |
| 184 ScrollbarThemeWithMockInvalidation theme; | 187 ScrollbarThemeWithMockInvalidation theme; |
| 185 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::
create(IntPoint(100, 100)); | 188 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::
create(IntPoint(100, 100)); |
| 186 RefPtrWillBeRawPtr<Scrollbar> horizontalScrollbar = Scrollbar::createForTest
ing(scrollableArea.get(), HorizontalScrollbar, RegularScrollbar, &theme); | 189 RefPtrWillBeRawPtr<Scrollbar> horizontalScrollbar = Scrollbar::createForTest
ing(scrollableArea.get(), HorizontalScrollbar, RegularScrollbar, &theme); |
| 187 RefPtrWillBeRawPtr<Scrollbar> verticalScrollbar = Scrollbar::createForTestin
g(scrollableArea.get(), VerticalScrollbar, RegularScrollbar, &theme); | 190 RefPtrWillBeRawPtr<Scrollbar> verticalScrollbar = Scrollbar::createForTestin
g(scrollableArea.get(), VerticalScrollbar, RegularScrollbar, &theme); |
| 188 EXPECT_CALL(*scrollableArea, horizontalScrollbar()).WillRepeatedly(Return(ho
rizontalScrollbar.get())); | 191 EXPECT_CALL(*scrollableArea, horizontalScrollbar()).WillRepeatedly(Return(ho
rizontalScrollbar.get())); |
| 189 EXPECT_CALL(*scrollableArea, verticalScrollbar()).WillRepeatedly(Return(vert
icalScrollbar.get())); | 192 EXPECT_CALL(*scrollableArea, verticalScrollbar()).WillRepeatedly(Return(vert
icalScrollbar.get())); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 EXPECT_FALSE(horizontalScrollbar->trackNeedsRepaint()); | 274 EXPECT_FALSE(horizontalScrollbar->trackNeedsRepaint()); |
| 272 EXPECT_FALSE(horizontalScrollbar->thumbNeedsRepaint()); | 275 EXPECT_FALSE(horizontalScrollbar->thumbNeedsRepaint()); |
| 273 EXPECT_FALSE(verticalScrollbar->trackNeedsRepaint()); | 276 EXPECT_FALSE(verticalScrollbar->trackNeedsRepaint()); |
| 274 EXPECT_FALSE(verticalScrollbar->thumbNeedsRepaint()); | 277 EXPECT_FALSE(verticalScrollbar->thumbNeedsRepaint()); |
| 275 | 278 |
| 276 // Forced GC in order to finalize objects depending on the mock object. | 279 // Forced GC in order to finalize objects depending on the mock object. |
| 277 Heap::collectAllGarbage(); | 280 Heap::collectAllGarbage(); |
| 278 } | 281 } |
| 279 | 282 |
| 280 } // namespace blink | 283 } // namespace blink |
| OLD | NEW |