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

Side by Side Diff: Source/platform/mac/ScrollElasticityControllerTest.mm

Issue 400543004: Rename WebCore namespace to blink in Platform (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/mac/ScrollElasticityController.mm ('k') | Source/platform/mac/ThemeMac.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <gtest/gtest.h> 6 #include <gtest/gtest.h>
7 7
8 #include "platform/geometry/IntPoint.h" 8 #include "platform/geometry/IntPoint.h"
9 #include "platform/geometry/IntSize.h" 9 #include "platform/geometry/IntSize.h"
10 #include "platform/mac/ScrollElasticityController.h" 10 #include "platform/mac/ScrollElasticityController.h"
11 #include "platform/PlatformWheelEvent.h" 11 #include "platform/PlatformWheelEvent.h"
12 12
13 namespace WebCore { 13 namespace blink {
14 14
15 class MockScrollElasticityControllerClient : public ScrollElasticityControllerCl ient { 15 class MockScrollElasticityControllerClient : public ScrollElasticityControllerCl ient {
16 public: 16 public:
17 MockScrollElasticityControllerClient() : m_pinned(true), m_stretchX(0.0f) {} 17 MockScrollElasticityControllerClient() : m_pinned(true), m_stretchX(0.0f) {}
18 18
19 virtual bool allowsHorizontalStretching() OVERRIDE { return true; } 19 virtual bool allowsHorizontalStretching() OVERRIDE { return true; }
20 virtual bool allowsVerticalStretching() OVERRIDE { return true; } 20 virtual bool allowsVerticalStretching() OVERRIDE { return true; }
21 // The amount that the view is stretched past the normal allowable bounds. 21 // The amount that the view is stretched past the normal allowable bounds.
22 // The "overhang" amount. 22 // The "overhang" amount.
23 virtual IntSize stretchAmount() OVERRIDE { return IntSize(m_stretchX, 0); } 23 virtual IntSize stretchAmount() OVERRIDE { return IntSize(m_stretchX, 0); }
24 virtual bool pinnedInDirection(const FloatSize&) OVERRIDE { return m_pinned; } 24 virtual bool pinnedInDirection(const FloatSize&) OVERRIDE { return m_pinned; }
25 virtual bool canScrollHorizontally() OVERRIDE { return true; } 25 virtual bool canScrollHorizontally() OVERRIDE { return true; }
26 virtual bool canScrollVertically() OVERRIDE { return true; } 26 virtual bool canScrollVertically() OVERRIDE { return true; }
27 27
28 // Return the absolute scroll position, not relative to the scroll origin. 28 // Return the absolute scroll position, not relative to the scroll origin.
29 virtual WebCore::IntPoint absoluteScrollPosition() OVERRIDE { return IntPoin t(m_stretchX, 0); } 29 virtual blink::IntPoint absoluteScrollPosition() OVERRIDE { return IntPoint( m_stretchX, 0); }
30 30
31 virtual void immediateScrollBy(const FloatSize& size) OVERRIDE { m_stretchX += size.width(); } 31 virtual void immediateScrollBy(const FloatSize& size) OVERRIDE { m_stretchX += size.width(); }
32 virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize& size) OVERRIDE { m_stretchX += size.width(); } 32 virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize& size) OVERRIDE { m_stretchX += size.width(); }
33 virtual void startSnapRubberbandTimer() OVERRIDE {} 33 virtual void startSnapRubberbandTimer() OVERRIDE {}
34 virtual void stopSnapRubberbandTimer() OVERRIDE {} 34 virtual void stopSnapRubberbandTimer() OVERRIDE {}
35 virtual void adjustScrollPositionToBoundsIfNecessary() OVERRIDE {} 35 virtual void adjustScrollPositionToBoundsIfNecessary() OVERRIDE {}
36 36
37 void reset() { m_stretchX = 0; } 37 void reset() { m_stretchX = 0; }
38 38
39 bool m_pinned; 39 bool m_pinned;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // The PlatformWheelEventPhaseMayBegin event should never be handled. 163 // The PlatformWheelEventPhaseMayBegin event should never be handled.
164 EXPECT_FALSE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheel EventPhaseMayBegin, deltaNone)); 164 EXPECT_FALSE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheel EventPhaseMayBegin, deltaNone));
165 165
166 // TODO(erikchen): This logic is incorrect. The zero delta event should not have been handled. crbug.com/375512 166 // TODO(erikchen): This logic is incorrect. The zero delta event should not have been handled. crbug.com/375512
167 EXPECT_TRUE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheelE ventPhaseBegan, deltaNone)); 167 EXPECT_TRUE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheelE ventPhaseBegan, deltaNone));
168 EXPECT_FALSE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheel EventPhaseChanged, deltaNone)); 168 EXPECT_FALSE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheel EventPhaseChanged, deltaNone));
169 EXPECT_TRUE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheelE ventPhaseChanged, deltaLeft)); 169 EXPECT_TRUE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheelE ventPhaseChanged, deltaLeft));
170 EXPECT_TRUE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheelE ventPhaseEnded, deltaNone)); 170 EXPECT_TRUE(handleWheelEvent(AllowRubberband, DisallowScroll, PlatformWheelE ventPhaseEnded, deltaNone));
171 } 171 }
172 172
173 } // namespace WebCore 173 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/mac/ScrollElasticityController.mm ('k') | Source/platform/mac/ThemeMac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698