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

Side by Side Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 20356003: Provided batched input delivery with a BufferedInputRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review 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
OLDNEW
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/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/memory/shared_memory.h" 7 #include "base/memory/shared_memory.h"
8 #include "base/timer/timer.h" 8 #include "base/timer/timer.h"
9 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/renderer_host/backing_store.h" 10 #include "content/browser/renderer_host/backing_store.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 sent_wheel_event_(false), 138 sent_wheel_event_(false),
139 sent_keyboard_event_(false), 139 sent_keyboard_event_(false),
140 sent_gesture_event_(false), 140 sent_gesture_event_(false),
141 send_touch_event_not_cancelled_(false), 141 send_touch_event_not_cancelled_(false),
142 message_received_(false), 142 message_received_(false),
143 client_(client) { 143 client_(client) {
144 } 144 }
145 virtual ~MockInputRouter() {} 145 virtual ~MockInputRouter() {}
146 146
147 // InputRouter 147 // InputRouter
148 virtual bool SendInput(IPC::Message* message) OVERRIDE { 148 virtual void Flush() OVERRIDE {
149 flush_called_ = true;
150 }
151 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE {
149 send_event_called_ = true; 152 send_event_called_ = true;
150
151 // SendInput takes ownership of message
152 delete message;
153
154 return true; 153 return true;
155 } 154 }
156 virtual void SendMouseEvent( 155 virtual void SendMouseEvent(
157 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE { 156 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE {
158 if (client_->OnSendMouseEvent(mouse_event)) 157 if (client_->OnSendMouseEvent(mouse_event))
159 sent_mouse_event_ = true; 158 sent_mouse_event_ = true;
160 } 159 }
161 virtual void SendWheelEvent( 160 virtual void SendWheelEvent(
162 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE { 161 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE {
163 if (client_->OnSendWheelEvent(wheel_event)) 162 if (client_->OnSendWheelEvent(wheel_event))
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return true; 195 return true;
197 } 196 }
198 virtual bool HasQueuedGestureEvents() const OVERRIDE { return true; } 197 virtual bool HasQueuedGestureEvents() const OVERRIDE { return true; }
199 198
200 // IPC::Listener 199 // IPC::Listener
201 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { 200 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
202 message_received_ = true; 201 message_received_ = true;
203 return false; 202 return false;
204 } 203 }
205 204
205 bool flush_called_;
206 bool send_event_called_; 206 bool send_event_called_;
207 bool sent_mouse_event_; 207 bool sent_mouse_event_;
208 bool sent_wheel_event_; 208 bool sent_wheel_event_;
209 bool sent_keyboard_event_; 209 bool sent_keyboard_event_;
210 bool sent_gesture_event_; 210 bool sent_gesture_event_;
211 bool send_touch_event_not_cancelled_; 211 bool send_touch_event_not_cancelled_;
212 bool message_received_; 212 bool message_received_;
213 213
214 private: 214 private:
215 InputRouterClient* client_; 215 InputRouterClient* client_;
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 2568
2569 TEST_F(RenderWidgetHostTest, InputRouterReceivesHasTouchEventHandlers) { 2569 TEST_F(RenderWidgetHostTest, InputRouterReceivesHasTouchEventHandlers) {
2570 host_->SetupForInputRouterTest(); 2570 host_->SetupForInputRouterTest();
2571 2571
2572 host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); 2572 host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true));
2573 2573
2574 EXPECT_TRUE(host_->mock_input_router()->message_received_); 2574 EXPECT_TRUE(host_->mock_input_router()->message_received_);
2575 } 2575 }
2576 2576
2577 } // namespace content 2577 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698