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

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

Issue 1456953003: Revert of Calculate paint invalidation rect for scrollbars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 #include "platform/scroll/ScrollableArea.h" 6 #include "platform/scroll/ScrollableArea.h"
7 7
8 #include "platform/TestingPlatformSupport.h" 8 #include "platform/TestingPlatformSupport.h"
9 #include "public/platform/Platform.h" 9 #include "public/platform/Platform.h"
10 #include "public/platform/WebScheduler.h" 10 #include "public/platform/WebScheduler.h"
11 #include "public/platform/WebThread.h" 11 #include "public/platform/WebThread.h"
12 #include <gmock/gmock.h> 12 #include <gmock/gmock.h>
13 #include <gtest/gtest.h> 13 #include <gtest/gtest.h>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class MockScrollableArea : public NoBaseWillBeGarbageCollectedFinalized<MockScro llableArea>, public ScrollableArea { 17 class MockScrollableArea : public NoBaseWillBeGarbageCollectedFinalized<MockScro llableArea>, public ScrollableArea {
18 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MockScrollableArea); 18 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MockScrollableArea);
19 public: 19 public:
20 static PassOwnPtrWillBeRawPtr<MockScrollableArea> create(const IntPoint& max imumScrollPosition) 20 static PassOwnPtrWillBeRawPtr<MockScrollableArea> create(const IntPoint& max imumScrollPosition)
21 { 21 {
22 return adoptPtrWillBeNoop(new MockScrollableArea(maximumScrollPosition)) ; 22 return adoptPtrWillBeNoop(new MockScrollableArea(maximumScrollPosition)) ;
23 } 23 }
24 24
25 MOCK_CONST_METHOD0(isActive, bool()); 25 MOCK_CONST_METHOD0(isActive, bool());
26 MOCK_CONST_METHOD1(scrollSize, int(ScrollbarOrientation)); 26 MOCK_CONST_METHOD1(scrollSize, int(ScrollbarOrientation));
27 MOCK_METHOD2(invalidateScrollbar, void(Scrollbar*, const IntRect&));
27 MOCK_CONST_METHOD0(isScrollCornerVisible, bool()); 28 MOCK_CONST_METHOD0(isScrollCornerVisible, bool());
28 MOCK_CONST_METHOD0(scrollCornerRect, IntRect()); 29 MOCK_CONST_METHOD0(scrollCornerRect, IntRect());
29 MOCK_METHOD0(scrollControlWasSetNeedsPaintInvalidation, void()); 30 MOCK_METHOD2(invalidateScrollbarRect, void(Scrollbar*, const IntRect&));
31 MOCK_METHOD1(invalidateScrollCornerRect, void(const IntRect&));
30 MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*()); 32 MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*());
31 MOCK_CONST_METHOD1(visibleContentRect, IntRect(IncludeScrollbarsInRect)); 33 MOCK_CONST_METHOD1(visibleContentRect, IntRect(IncludeScrollbarsInRect));
32 MOCK_CONST_METHOD0(contentsSize, IntSize()); 34 MOCK_CONST_METHOD0(contentsSize, IntSize());
33 MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool()); 35 MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool());
34 MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect()); 36 MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect());
35 37
36 bool userInputScrollable(ScrollbarOrientation) const override { return true; } 38 bool userInputScrollable(ScrollbarOrientation) const override { return true; }
37 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; } 39 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; }
38 void setScrollOffset(const IntPoint& offset, ScrollType) override { m_scroll Position = offset.shrunkTo(m_maximumScrollPosition); } 40 void setScrollOffset(const IntPoint& offset, ScrollType) override { m_scroll Position = offset.shrunkTo(m_maximumScrollPosition); }
39 IntPoint scrollPosition() const override { return m_scrollPosition; } 41 IntPoint scrollPosition() const override { return m_scrollPosition; }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 }; 119 };
118 120
119 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) 121 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync)
120 { 122 {
121 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea:: create(IntPoint(0, 100)); 123 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea:: create(IntPoint(0, 100));
122 scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll); 124 scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll);
123 EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y()); 125 EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y());
124 } 126 }
125 127
126 } // namespace blink 128 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp ('k') | third_party/WebKit/Source/platform/scroll/Scrollbar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698