OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 sent_wheel_event_(false), | 115 sent_wheel_event_(false), |
116 sent_keyboard_event_(false), | 116 sent_keyboard_event_(false), |
117 sent_gesture_event_(false), | 117 sent_gesture_event_(false), |
118 send_touch_event_not_cancelled_(false), | 118 send_touch_event_not_cancelled_(false), |
119 message_received_(false), | 119 message_received_(false), |
120 client_(client) { | 120 client_(client) { |
121 } | 121 } |
122 virtual ~MockInputRouter() {} | 122 virtual ~MockInputRouter() {} |
123 | 123 |
124 // InputRouter | 124 // InputRouter |
125 virtual bool SendInput(IPC::Message* message) OVERRIDE { | 125 virtual void Flush() OVERRIDE { |
| 126 flush_called_ = true; |
| 127 } |
| 128 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE { |
126 send_event_called_ = true; | 129 send_event_called_ = true; |
127 | |
128 // SendInput takes ownership of message | |
129 delete message; | |
130 | |
131 return true; | 130 return true; |
132 } | 131 } |
133 virtual void SendMouseEvent( | 132 virtual void SendMouseEvent( |
134 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE { | 133 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE { |
135 if (client_->OnSendMouseEvent(mouse_event)) | 134 if (client_->OnSendMouseEvent(mouse_event)) |
136 sent_mouse_event_ = true; | 135 sent_mouse_event_ = true; |
137 } | 136 } |
138 virtual void SendWheelEvent( | 137 virtual void SendWheelEvent( |
139 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE { | 138 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE { |
140 if (client_->OnSendWheelEvent(wheel_event)) | 139 if (client_->OnSendWheelEvent(wheel_event)) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 return true; | 172 return true; |
174 } | 173 } |
175 virtual bool HasQueuedGestureEvents() const OVERRIDE { return true; } | 174 virtual bool HasQueuedGestureEvents() const OVERRIDE { return true; } |
176 | 175 |
177 // IPC::Listener | 176 // IPC::Listener |
178 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 177 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
179 message_received_ = true; | 178 message_received_ = true; |
180 return false; | 179 return false; |
181 } | 180 } |
182 | 181 |
| 182 bool flush_called_; |
183 bool send_event_called_; | 183 bool send_event_called_; |
184 bool sent_mouse_event_; | 184 bool sent_mouse_event_; |
185 bool sent_wheel_event_; | 185 bool sent_wheel_event_; |
186 bool sent_keyboard_event_; | 186 bool sent_keyboard_event_; |
187 bool sent_gesture_event_; | 187 bool sent_gesture_event_; |
188 bool send_touch_event_not_cancelled_; | 188 bool send_touch_event_not_cancelled_; |
189 bool message_received_; | 189 bool message_received_; |
190 | 190 |
191 private: | 191 private: |
192 InputRouterClient* client_; | 192 InputRouterClient* client_; |
(...skipping 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 | 2570 |
2571 TEST_F(RenderWidgetHostTest, InputRouterReceivesHasTouchEventHandlers) { | 2571 TEST_F(RenderWidgetHostTest, InputRouterReceivesHasTouchEventHandlers) { |
2572 host_->SetupForInputRouterTest(); | 2572 host_->SetupForInputRouterTest(); |
2573 | 2573 |
2574 host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); | 2574 host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); |
2575 | 2575 |
2576 EXPECT_TRUE(host_->mock_input_router()->message_received_); | 2576 EXPECT_TRUE(host_->mock_input_router()->message_received_); |
2577 } | 2577 } |
2578 | 2578 |
2579 } // namespace content | 2579 } // namespace content |
OLD | NEW |