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

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

Issue 22527005: Fix pinch gestures with nonscrollable root layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Also update InputHandlerProxy tests Created 7 years, 4 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 | « content/renderer/gpu/input_handler_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 VERIFY_AND_RESET_MOCKS(); 231 VERIFY_AND_RESET_MOCKS();
232 232
233 gesture_.type = WebInputEvent::GestureScrollUpdate; 233 gesture_.type = WebInputEvent::GestureScrollUpdate;
234 gesture_.data.scrollUpdate.deltaY = 40; 234 gesture_.data.scrollUpdate.deltaY = 40;
235 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 235 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
236 236
237 VERIFY_AND_RESET_MOCKS(); 237 VERIFY_AND_RESET_MOCKS();
238 238
239 gesture_.type = WebInputEvent::GestureScrollEnd; 239 gesture_.type = WebInputEvent::GestureScrollEnd;
240 gesture_.data.scrollUpdate.deltaY = 0; 240 gesture_.data.scrollUpdate.deltaY = 0;
241 EXPECT_CALL(mock_input_handler_, ScrollEnd()).WillOnce(testing::Return());
241 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 242 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
242 } 243 }
243 244
244 TEST_F(InputHandlerProxyTest, GestureScrollIgnored) { 245 TEST_F(InputHandlerProxyTest, GestureScrollIgnored) {
245 // We shouldn't handle the GestureScrollBegin. 246 // We shouldn't handle the GestureScrollBegin.
246 // Instead, we should get a DROP_EVENT result, indicating 247 // Instead, we should get a DROP_EVENT result, indicating
247 // that we could determine that there's nothing that could scroll or otherwise 248 // that we could determine that there's nothing that could scroll or otherwise
248 // react to this gesture sequence and thus we should drop the whole gesture 249 // react to this gesture sequence and thus we should drop the whole gesture
249 // sequence on the floor. 250 // sequence on the floor, except for the ScrollEnd.
250 expected_disposition_ = InputHandlerProxy::DROP_EVENT; 251 expected_disposition_ = InputHandlerProxy::DROP_EVENT;
251 VERIFY_AND_RESET_MOCKS(); 252 VERIFY_AND_RESET_MOCKS();
252 253
253 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 254 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
254 .WillOnce(testing::Return(cc::InputHandler::ScrollIgnored)); 255 .WillOnce(testing::Return(cc::InputHandler::ScrollIgnored));
255 256
256 gesture_.type = WebInputEvent::GestureScrollBegin; 257 gesture_.type = WebInputEvent::GestureScrollBegin;
257 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 258 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
259
260 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
261 gesture_.type = WebInputEvent::GestureScrollEnd;
262 EXPECT_CALL(mock_input_handler_, ScrollEnd()).WillOnce(testing::Return());
263 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
258 } 264 }
259 265
260 TEST_F(InputHandlerProxyTest, GesturePinch) { 266 TEST_F(InputHandlerProxyTest, GesturePinch) {
261 // We shouldn't send any events to the widget for this gesture. 267 // We shouldn't send any events to the widget for this gesture.
262 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 268 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
263 VERIFY_AND_RESET_MOCKS(); 269 VERIFY_AND_RESET_MOCKS();
264 270
265 gesture_.type = WebInputEvent::GesturePinchBegin; 271 gesture_.type = WebInputEvent::GesturePinchBegin;
266 EXPECT_CALL(mock_input_handler_, PinchGestureBegin()); 272 EXPECT_CALL(mock_input_handler_, PinchGestureBegin());
267 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 273 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 EXPECT_CALL(mock_input_handler_, PinchGestureEnd()); 358 EXPECT_CALL(mock_input_handler_, PinchGestureEnd());
353 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 359 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
354 360
355 // After the pinch gesture ends, they should go to back to the main 361 // After the pinch gesture ends, they should go to back to the main
356 // thread. 362 // thread.
357 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; 363 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
358 VERIFY_AND_RESET_MOCKS(); 364 VERIFY_AND_RESET_MOCKS();
359 365
360 gesture_.type = WebInputEvent::GestureScrollEnd; 366 gesture_.type = WebInputEvent::GestureScrollEnd;
361 gesture_.data.scrollUpdate.deltaY = 0; 367 gesture_.data.scrollUpdate.deltaY = 0;
368 EXPECT_CALL(mock_input_handler_, ScrollEnd())
369 .WillOnce(testing::Return());
362 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 370 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
363 } 371 }
364 372
365 TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchpad) { 373 TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchpad) {
366 // We shouldn't send any events to the widget for this gesture. 374 // We shouldn't send any events to the widget for this gesture.
367 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 375 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
368 VERIFY_AND_RESET_MOCKS(); 376 VERIFY_AND_RESET_MOCKS();
369 377
370 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 378 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
371 .WillOnce(testing::Return(cc::InputHandler::ScrollStarted)); 379 .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 testing::Property(&gfx::Vector2dF::y, testing::Eq(0)))) 1012 testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
1005 .WillOnce(testing::Return(true)); 1013 .WillOnce(testing::Return(true));
1006 EXPECT_CALL(mock_input_handler_, ScrollEnd()); 1014 EXPECT_CALL(mock_input_handler_, ScrollEnd());
1007 time += base::TimeDelta::FromMilliseconds(100); 1015 time += base::TimeDelta::FromMilliseconds(100);
1008 input_handler_->Animate(time); 1016 input_handler_->Animate(time);
1009 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); 1017 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
1010 } 1018 }
1011 1019
1012 } // namespace 1020 } // namespace
1013 } // namespace content 1021 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/input_handler_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698