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

Side by Side Diff: content/browser/renderer_host/input/mock_input_ack_handler.cc

Issue 250923004: Synthesize ctrl-wheel events on touchpad pinch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ensure scales never coalesce to 0 or Infinity Created 6 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser/renderer_host/input/mock_input_ack_handler.h" 5 #include "content/browser/renderer_host/input/mock_input_ack_handler.h"
6 6
7 #include "content/browser/renderer_host/input/input_router.h" 7 #include "content/browser/renderer_host/input/input_router.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 using base::TimeDelta; 10 using base::TimeDelta;
11 using blink::WebGestureEvent; 11 using blink::WebGestureEvent;
12 using blink::WebInputEvent; 12 using blink::WebInputEvent;
13 using blink::WebMouseEvent; 13 using blink::WebMouseEvent;
14 using blink::WebMouseWheelEvent; 14 using blink::WebMouseWheelEvent;
15 using blink::WebTouchEvent; 15 using blink::WebTouchEvent;
16 using blink::WebTouchPoint; 16 using blink::WebTouchPoint;
17 17
18 namespace content { 18 namespace content {
19 19
20 MockInputAckHandler::MockInputAckHandler() 20 MockInputAckHandler::MockInputAckHandler()
21 : input_router_(NULL), 21 : input_router_(NULL),
22 ack_count_(0), 22 ack_count_(0),
23 unexpected_event_ack_called_(false), 23 unexpected_event_ack_called_(false),
24 ack_state_(INPUT_EVENT_ACK_STATE_UNKNOWN) {} 24 ack_event_type_(WebInputEvent::Undefined),
25 ack_state_(INPUT_EVENT_ACK_STATE_UNKNOWN) {
26 }
25 27
26 MockInputAckHandler::~MockInputAckHandler() {} 28 MockInputAckHandler::~MockInputAckHandler() {}
27 29
28 void MockInputAckHandler::OnKeyboardEventAck( 30 void MockInputAckHandler::OnKeyboardEventAck(
29 const NativeWebKeyboardEvent& event, 31 const NativeWebKeyboardEvent& event,
30 InputEventAckState ack_result) { 32 InputEventAckState ack_result) {
31 VLOG(1) << __FUNCTION__ << " called!"; 33 VLOG(1) << __FUNCTION__ << " called!";
32 acked_key_event_ = event; 34 acked_key_event_ = event;
33 RecordAckCalled(ack_result); 35 RecordAckCalled(event.type, ack_result);
34 } 36 }
35 37
36 void MockInputAckHandler::OnWheelEventAck( 38 void MockInputAckHandler::OnWheelEventAck(
37 const MouseWheelEventWithLatencyInfo& event, 39 const MouseWheelEventWithLatencyInfo& event,
38 InputEventAckState ack_result) { 40 InputEventAckState ack_result) {
39 VLOG(1) << __FUNCTION__ << " called!"; 41 VLOG(1) << __FUNCTION__ << " called!";
40 acked_wheel_event_ = event.event; 42 acked_wheel_event_ = event.event;
41 RecordAckCalled(ack_result); 43 RecordAckCalled(event.event.type, ack_result);
42 } 44 }
43 45
44 void MockInputAckHandler::OnTouchEventAck( 46 void MockInputAckHandler::OnTouchEventAck(
45 const TouchEventWithLatencyInfo& event, 47 const TouchEventWithLatencyInfo& event,
46 InputEventAckState ack_result) { 48 InputEventAckState ack_result) {
47 VLOG(1) << __FUNCTION__ << " called!"; 49 VLOG(1) << __FUNCTION__ << " called!";
48 acked_touch_event_ = event; 50 acked_touch_event_ = event;
49 RecordAckCalled(ack_result); 51 RecordAckCalled(event.event.type, ack_result);
50 if (touch_followup_event_) 52 if (touch_followup_event_)
51 input_router_->SendTouchEvent(*touch_followup_event_); 53 input_router_->SendTouchEvent(*touch_followup_event_);
52 if (gesture_followup_event_) 54 if (gesture_followup_event_)
53 input_router_->SendGestureEvent(*gesture_followup_event_); 55 input_router_->SendGestureEvent(*gesture_followup_event_);
54 } 56 }
55 57
56 void MockInputAckHandler::OnGestureEventAck( 58 void MockInputAckHandler::OnGestureEventAck(
57 const GestureEventWithLatencyInfo& event, 59 const GestureEventWithLatencyInfo& event,
58 InputEventAckState ack_result) { 60 InputEventAckState ack_result) {
59 VLOG(1) << __FUNCTION__ << " called!"; 61 VLOG(1) << __FUNCTION__ << " called!";
60 acked_gesture_event_ = event.event; 62 acked_gesture_event_ = event.event;
61 RecordAckCalled(ack_result); 63 RecordAckCalled(event.event.type, ack_result);
62 } 64 }
63 65
64 void MockInputAckHandler::OnUnexpectedEventAck(UnexpectedEventAckType type) { 66 void MockInputAckHandler::OnUnexpectedEventAck(UnexpectedEventAckType type) {
65 VLOG(1) << __FUNCTION__ << " called!"; 67 VLOG(1) << __FUNCTION__ << " called!";
66 unexpected_event_ack_called_ = true; 68 unexpected_event_ack_called_ = true;
67 } 69 }
68 70
69 size_t MockInputAckHandler::GetAndResetAckCount() { 71 size_t MockInputAckHandler::GetAndResetAckCount() {
70 size_t ack_count = ack_count_; 72 size_t ack_count = ack_count_;
71 ack_count_ = 0; 73 ack_count_ = 0;
72 return ack_count; 74 return ack_count;
73 } 75 }
74 76
75 void MockInputAckHandler::RecordAckCalled(InputEventAckState ack_result) { 77 void MockInputAckHandler::RecordAckCalled(blink::WebInputEvent::Type type,
78 InputEventAckState ack_result) {
79 ack_event_type_ = type;
76 ++ack_count_; 80 ++ack_count_;
77 ack_state_ = ack_result; 81 ack_state_ = ack_result;
78 } 82 }
79 83
80 } // namespace content 84 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698