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

Side by Side Diff: Source/platform/scroll/ScrollableAreaTest.cpp

Issue 1158673006: Replace various ScrollableArea scroll methods with setScrollPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Build fix 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 unified diff | Download patch
« no previous file with comments | « Source/platform/scroll/ScrollableArea.cpp ('k') | Source/platform/scroll/Scrollbar.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 6
7 #include "platform/scroll/ScrollableArea.h" 7 #include "platform/scroll/ScrollableArea.h"
8 8
9 #include "platform/TestingPlatformSupport.h" 9 #include "platform/TestingPlatformSupport.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
(...skipping 20 matching lines...) Expand all
31 MOCK_METHOD1(invalidateScrollCornerRect, void(const IntRect&)); 31 MOCK_METHOD1(invalidateScrollCornerRect, void(const IntRect&));
32 MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*()); 32 MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*());
33 MOCK_CONST_METHOD0(minimumScrollPosition, IntPoint()); 33 MOCK_CONST_METHOD0(minimumScrollPosition, IntPoint());
34 MOCK_CONST_METHOD1(visibleContentRect, IntRect(IncludeScrollbarsInRect)); 34 MOCK_CONST_METHOD1(visibleContentRect, IntRect(IncludeScrollbarsInRect));
35 MOCK_CONST_METHOD0(contentsSize, IntSize()); 35 MOCK_CONST_METHOD0(contentsSize, IntSize());
36 MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool()); 36 MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool());
37 MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect()); 37 MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect());
38 38
39 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu rn true; } 39 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu rn true; }
40 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa lse; } 40 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa lse; }
41 virtual void setScrollOffset(const IntPoint& offset) override { m_scrollPosi tion = offset.shrunkTo(m_maximumScrollPosition); } 41 virtual void setScrollOffset(const IntPoint& offset, ScrollType) override { m_scrollPosition = offset.shrunkTo(m_maximumScrollPosition); }
42 virtual IntPoint scrollPosition() const override { return m_scrollPosition; } 42 virtual IntPoint scrollPosition() const override { return m_scrollPosition; }
43 virtual IntPoint maximumScrollPosition() const override { return m_maximumSc rollPosition; } 43 virtual IntPoint maximumScrollPosition() const override { return m_maximumSc rollPosition; }
44 virtual int visibleHeight() const override { return 768; } 44 virtual int visibleHeight() const override { return 768; }
45 virtual int visibleWidth() const override { return 1024; } 45 virtual int visibleWidth() const override { return 1024; }
46 virtual bool scrollAnimatorEnabled() const override { return false; } 46 virtual bool scrollAnimatorEnabled() const override { return false; }
47 virtual int pageStep(ScrollbarOrientation) const override { return 0; } 47 virtual int pageStep(ScrollbarOrientation) const override { return 0; }
48 48
49 private: 49 private:
50 IntPoint m_scrollPosition; 50 IntPoint m_scrollPosition;
51 IntPoint m_maximumScrollPosition; 51 IntPoint m_maximumScrollPosition;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 }; 115 };
116 116
117 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) 117 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync)
118 { 118 {
119 MockScrollableArea scrollableArea(IntPoint(0, 100)); 119 MockScrollableArea scrollableArea(IntPoint(0, 100));
120 scrollableArea.notifyScrollPositionChanged(IntPoint(0, 10000)); 120 scrollableArea.notifyScrollPositionChanged(IntPoint(0, 10000));
121 EXPECT_EQ(100.0, scrollableArea.scrollAnimator()->currentPosition().y()); 121 EXPECT_EQ(100.0, scrollableArea.scrollAnimator()->currentPosition().y());
122 } 122 }
123 123
124 } // unnamed namespace 124 } // unnamed namespace
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollableArea.cpp ('k') | Source/platform/scroll/Scrollbar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698