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

Side by Side Diff: content/renderer/gpu/input_handler_proxy_unittest.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/gpu/input_handler_proxy.h" 5 #include "content/renderer/gpu/input_handler_proxy.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "content/renderer/gpu/input_handler_proxy_client.h" 9 #include "content/renderer/gpu/input_handler_proxy_client.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 12 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
13 #include "third_party/WebKit/public/platform/WebFloatSize.h" 13 #include "third_party/WebKit/public/platform/WebFloatSize.h"
14 #include "third_party/WebKit/public/platform/WebGestureCurve.h" 14 #include "third_party/WebKit/public/platform/WebGestureCurve.h"
15 #include "third_party/WebKit/public/platform/WebPoint.h" 15 #include "third_party/WebKit/public/platform/WebPoint.h"
16 #include "third_party/WebKit/public/web/WebInputEvent.h" 16 #include "third_party/WebKit/public/web/WebInputEvent.h"
17 #include "ui/events/latency_info.h" 17 #include "ui/events/latency_info.h"
18 18
19 using WebKit::WebActiveWheelFlingParameters; 19 using blink::WebActiveWheelFlingParameters;
20 using WebKit::WebFloatPoint; 20 using blink::WebFloatPoint;
21 using WebKit::WebFloatSize; 21 using blink::WebFloatSize;
22 using WebKit::WebGestureEvent; 22 using blink::WebGestureEvent;
23 using WebKit::WebInputEvent; 23 using blink::WebInputEvent;
24 using WebKit::WebMouseWheelEvent; 24 using blink::WebMouseWheelEvent;
25 using WebKit::WebPoint; 25 using blink::WebPoint;
26 using WebKit::WebSize; 26 using blink::WebSize;
27 27
28 namespace content { 28 namespace content {
29 namespace { 29 namespace {
30 30
31 class MockInputHandler : public cc::InputHandler { 31 class MockInputHandler : public cc::InputHandler {
32 public: 32 public:
33 MockInputHandler() {} 33 MockInputHandler() {}
34 virtual ~MockInputHandler() {} 34 virtual ~MockInputHandler() {}
35 35
36 MOCK_METHOD0(PinchGestureBegin, void()); 36 MOCK_METHOD0(PinchGestureBegin, void());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 cc::LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) 72 cc::LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate)
73 OVERRIDE {} 73 OVERRIDE {}
74 74
75 virtual void OnRootLayerDelegatedScrollOffsetChanged() OVERRIDE {} 75 virtual void OnRootLayerDelegatedScrollOffsetChanged() OVERRIDE {}
76 76
77 DISALLOW_COPY_AND_ASSIGN(MockInputHandler); 77 DISALLOW_COPY_AND_ASSIGN(MockInputHandler);
78 }; 78 };
79 79
80 // A simple WebGestureCurve implementation that flings at a constant velocity 80 // A simple WebGestureCurve implementation that flings at a constant velocity
81 // indefinitely. 81 // indefinitely.
82 class FakeWebGestureCurve : public WebKit::WebGestureCurve { 82 class FakeWebGestureCurve : public blink::WebGestureCurve {
83 public: 83 public:
84 FakeWebGestureCurve(const WebKit::WebFloatPoint& velocity, 84 FakeWebGestureCurve(const blink::WebFloatPoint& velocity,
85 const WebKit::WebSize& cumulative_scroll) 85 const blink::WebSize& cumulative_scroll)
86 : velocity_(velocity), cumulative_scroll_(cumulative_scroll) {} 86 : velocity_(velocity), cumulative_scroll_(cumulative_scroll) {}
87 87
88 virtual ~FakeWebGestureCurve() {} 88 virtual ~FakeWebGestureCurve() {}
89 89
90 // Returns false if curve has finished and can no longer be applied. 90 // Returns false if curve has finished and can no longer be applied.
91 virtual bool apply(double time, WebKit::WebGestureCurveTarget* target) { 91 virtual bool apply(double time, blink::WebGestureCurveTarget* target) {
92 WebKit::WebSize displacement(velocity_.x * time, velocity_.y * time); 92 blink::WebSize displacement(velocity_.x * time, velocity_.y * time);
93 WebKit::WebFloatSize increment( 93 blink::WebFloatSize increment(
94 displacement.width - cumulative_scroll_.width, 94 displacement.width - cumulative_scroll_.width,
95 displacement.height - cumulative_scroll_.height); 95 displacement.height - cumulative_scroll_.height);
96 cumulative_scroll_ = displacement; 96 cumulative_scroll_ = displacement;
97 // scrollBy() could delete this curve if the animation is over, so don't 97 // scrollBy() could delete this curve if the animation is over, so don't
98 // touch any member variables after making that call. 98 // touch any member variables after making that call.
99 target->scrollBy(increment); 99 target->scrollBy(increment);
100 return true; 100 return true;
101 } 101 }
102 102
103 private: 103 private:
104 WebKit::WebFloatPoint velocity_; 104 blink::WebFloatPoint velocity_;
105 WebKit::WebSize cumulative_scroll_; 105 blink::WebSize cumulative_scroll_;
106 106
107 DISALLOW_COPY_AND_ASSIGN(FakeWebGestureCurve); 107 DISALLOW_COPY_AND_ASSIGN(FakeWebGestureCurve);
108 }; 108 };
109 109
110 class MockInputHandlerProxyClient 110 class MockInputHandlerProxyClient
111 : public content::InputHandlerProxyClient { 111 : public content::InputHandlerProxyClient {
112 public: 112 public:
113 MockInputHandlerProxyClient() {} 113 MockInputHandlerProxyClient() {}
114 virtual ~MockInputHandlerProxyClient() {} 114 virtual ~MockInputHandlerProxyClient() {}
115 115
116 virtual void WillShutdown() OVERRIDE {} 116 virtual void WillShutdown() OVERRIDE {}
117 117
118 MOCK_METHOD1(TransferActiveWheelFlingAnimation, 118 MOCK_METHOD1(TransferActiveWheelFlingAnimation,
119 void(const WebActiveWheelFlingParameters&)); 119 void(const WebActiveWheelFlingParameters&));
120 120
121 virtual WebKit::WebGestureCurve* CreateFlingAnimationCurve( 121 virtual blink::WebGestureCurve* CreateFlingAnimationCurve(
122 int deviceSource, 122 int deviceSource,
123 const WebFloatPoint& velocity, 123 const WebFloatPoint& velocity,
124 const WebSize& cumulative_scroll) OVERRIDE { 124 const WebSize& cumulative_scroll) OVERRIDE {
125 return new FakeWebGestureCurve(velocity, cumulative_scroll); 125 return new FakeWebGestureCurve(velocity, cumulative_scroll);
126 } 126 }
127 127
128 virtual void DidOverscroll(const cc::DidOverscrollParams& params) {} 128 virtual void DidOverscroll(const cc::DidOverscrollParams& params) {}
129 129
130 private: 130 private:
131 DISALLOW_COPY_AND_ASSIGN(MockInputHandlerProxyClient); 131 DISALLOW_COPY_AND_ASSIGN(MockInputHandlerProxyClient);
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 testing::Property(&gfx::Vector2dF::y, testing::Eq(0)))) 1012 testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
1013 .WillOnce(testing::Return(true)); 1013 .WillOnce(testing::Return(true));
1014 EXPECT_CALL(mock_input_handler_, ScrollEnd()); 1014 EXPECT_CALL(mock_input_handler_, ScrollEnd());
1015 time += base::TimeDelta::FromMilliseconds(100); 1015 time += base::TimeDelta::FromMilliseconds(100);
1016 input_handler_->Animate(time); 1016 input_handler_->Animate(time);
1017 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); 1017 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
1018 } 1018 }
1019 1019
1020 } // namespace 1020 } // namespace
1021 } // namespace content 1021 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/input_handler_proxy_client.h ('k') | content/renderer/gpu/input_handler_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698