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

Side by Side Diff: content/public/test/render_view_test.cc

Issue 13931009: Add latency info to input events sent to RenderWidget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « content/content_browser.gypi ('k') | content/renderer/gpu/input_event_filter_unittest.cc » ('j') | 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) 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 "content/public/test/render_view_test.h" 5 #include "content/public/test/render_view_test.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/common/input_messages.h" 8 #include "content/common/input_messages.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/public/browser/native_web_keyboard_event.h" 10 #include "content/public/browser/native_web_keyboard_event.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 210
211 void RenderViewTest::SendNativeKeyEvent( 211 void RenderViewTest::SendNativeKeyEvent(
212 const NativeWebKeyboardEvent& key_event) { 212 const NativeWebKeyboardEvent& key_event) {
213 SendWebKeyboardEvent(key_event); 213 SendWebKeyboardEvent(key_event);
214 } 214 }
215 215
216 void RenderViewTest::SendWebKeyboardEvent( 216 void RenderViewTest::SendWebKeyboardEvent(
217 const WebKit::WebKeyboardEvent& key_event) { 217 const WebKit::WebKeyboardEvent& key_event) {
218 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 218 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
219 impl->OnMessageReceived(InputMsg_HandleInputEvent(0, &key_event, false)); 219 impl->OnMessageReceived(
220 InputMsg_HandleInputEvent(0, &key_event, cc::LatencyInfo(), false));
220 } 221 }
221 222
222 void RenderViewTest::SendWebMouseEvent( 223 void RenderViewTest::SendWebMouseEvent(
223 const WebKit::WebMouseEvent& mouse_event) { 224 const WebKit::WebMouseEvent& mouse_event) {
224 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 225 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
225 impl->OnMessageReceived( 226 impl->OnMessageReceived(
226 InputMsg_HandleInputEvent(0, &mouse_event, false)); 227 InputMsg_HandleInputEvent(0, &mouse_event, cc::LatencyInfo(), false));
227 } 228 }
228 229
229 const char* const kGetCoordinatesScript = 230 const char* const kGetCoordinatesScript =
230 "(function() {" 231 "(function() {"
231 " function GetCoordinates(elem) {" 232 " function GetCoordinates(elem) {"
232 " if (!elem)" 233 " if (!elem)"
233 " return [ 0, 0];" 234 " return [ 0, 0];"
234 " var coordinates = [ elem.offsetLeft, elem.offsetTop];" 235 " var coordinates = [ elem.offsetLeft, elem.offsetTop];"
235 " var parent_coordinates = GetCoordinates(elem.offsetParent);" 236 " var parent_coordinates = GetCoordinates(elem.offsetParent);"
236 " coordinates[0] += parent_coordinates[0];" 237 " coordinates[0] += parent_coordinates[0];"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 gfx::Rect bounds = GetElementBounds(element_id); 276 gfx::Rect bounds = GetElementBounds(element_id);
276 if (bounds.IsEmpty()) 277 if (bounds.IsEmpty())
277 return false; 278 return false;
278 WebMouseEvent mouse_event; 279 WebMouseEvent mouse_event;
279 mouse_event.type = WebInputEvent::MouseDown; 280 mouse_event.type = WebInputEvent::MouseDown;
280 mouse_event.button = WebMouseEvent::ButtonLeft; 281 mouse_event.button = WebMouseEvent::ButtonLeft;
281 mouse_event.x = bounds.CenterPoint().x(); 282 mouse_event.x = bounds.CenterPoint().x();
282 mouse_event.y = bounds.CenterPoint().y(); 283 mouse_event.y = bounds.CenterPoint().y();
283 mouse_event.clickCount = 1; 284 mouse_event.clickCount = 1;
284 scoped_ptr<IPC::Message> input_message( 285 scoped_ptr<IPC::Message> input_message(
285 new InputMsg_HandleInputEvent(0, &mouse_event, false)); 286 new InputMsg_HandleInputEvent(0, &mouse_event, cc::LatencyInfo(), false));
286 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 287 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
287 impl->OnMessageReceived(*input_message); 288 impl->OnMessageReceived(*input_message);
288 return true; 289 return true;
289 } 290 }
290 291
291 void RenderViewTest::SetFocused(const WebKit::WebNode& node) { 292 void RenderViewTest::SetFocused(const WebKit::WebNode& node) {
292 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 293 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
293 impl->focusedNodeChanged(node); 294 impl->focusedNodeChanged(node);
294 } 295 }
295 296
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 363
363 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); 364 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params);
364 OnMessageReceived(navigate_message); 365 OnMessageReceived(navigate_message);
365 366
366 // The load actually happens asynchronously, so we pump messages to process 367 // The load actually happens asynchronously, so we pump messages to process
367 // the pending continuation. 368 // the pending continuation.
368 ProcessPendingMessages(); 369 ProcessPendingMessages();
369 } 370 }
370 371
371 } // namespace content 372 } // namespace content
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | content/renderer/gpu/input_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698