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

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

Issue 1215973002: Oilpan: improve ScrollableArea handling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review-induced improvements Created 5 years, 6 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
« no previous file with comments | « Source/platform/scroll/ScrollableArea.cpp ('k') | Source/platform/scroll/Scrollbar.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scroll/ScrollableAreaTest.cpp
diff --git a/Source/platform/scroll/ScrollableAreaTest.cpp b/Source/platform/scroll/ScrollableAreaTest.cpp
index 92a897122a9f1b0323489eb95fc07f677942c127..5d25c0a12fa23b879816461be50ac5f1515ce599 100644
--- a/Source/platform/scroll/ScrollableAreaTest.cpp
+++ b/Source/platform/scroll/ScrollableAreaTest.cpp
@@ -14,10 +14,13 @@
namespace blink {
-class MockScrollableArea : public ScrollableArea {
+class MockScrollableArea : public NoBaseWillBeGarbageCollectedFinalized<MockScrollableArea>, public ScrollableArea {
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MockScrollableArea);
public:
- MockScrollableArea(const IntPoint& maximumScrollPosition)
- : m_maximumScrollPosition(maximumScrollPosition) { }
+ static PassOwnPtrWillBeRawPtr<MockScrollableArea> create(const IntPoint& maximumScrollPosition)
+ {
+ return adoptPtrWillBeNoop(new MockScrollableArea(maximumScrollPosition));
+ }
MOCK_CONST_METHOD0(isActive, bool());
MOCK_CONST_METHOD1(scrollSize, int(ScrollbarOrientation));
@@ -43,7 +46,15 @@ public:
bool scrollAnimatorEnabled() const override { return false; }
int pageStep(ScrollbarOrientation) const override { return 0; }
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ ScrollableArea::trace(visitor);
+ }
+
private:
+ explicit MockScrollableArea(const IntPoint& maximumScrollPosition)
+ : m_maximumScrollPosition(maximumScrollPosition) { }
+
IntPoint m_scrollPosition;
IntPoint m_maximumScrollPosition;
};
@@ -113,9 +124,9 @@ private:
TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync)
{
- MockScrollableArea scrollableArea(IntPoint(0, 100));
- scrollableArea.setScrollPosition(IntPoint(0, 10000), CompositorScroll);
- EXPECT_EQ(100.0, scrollableArea.scrollAnimator()->currentPosition().y());
+ OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(IntPoint(0, 100));
+ scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll);
+ EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y());
}
} // namespace blink
« no previous file with comments | « Source/platform/scroll/ScrollableArea.cpp ('k') | Source/platform/scroll/Scrollbar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698