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

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

Issue 249613002: [DevTools] Interactive test for DevTools touch emulation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Close devtools Created 6 years, 8 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 | « chrome/test/data/devtools/touch_emulation.html ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/touch_emulator.h" 5 #include "content/browser/renderer_host/input/touch_emulator.h"
6 6
7 #include "content/browser/renderer_host/input/motion_event_web.h" 7 #include "content/browser/renderer_host/input/motion_event_web.h"
8 #include "content/browser/renderer_host/input/web_input_event_util.h" 8 #include "content/browser/renderer_host/input/web_input_event_util.h"
9 #include "content/public/common/content_client.h" 9 #include "content/public/common/content_client.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 bool TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) { 325 bool TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) {
326 if (mouse_event.type != WebInputEvent::MouseDown && 326 if (mouse_event.type != WebInputEvent::MouseDown &&
327 mouse_event.type != WebInputEvent::MouseMove && 327 mouse_event.type != WebInputEvent::MouseMove &&
328 mouse_event.type != WebInputEvent::MouseUp) { 328 mouse_event.type != WebInputEvent::MouseUp) {
329 return false; 329 return false;
330 } 330 }
331 331
332 touch_event_.touchesLength = 1; 332 touch_event_.touchesLength = 1;
333 touch_event_.timeStampSeconds = mouse_event.timeStampSeconds; 333 touch_event_.timeStampSeconds = mouse_event.timeStampSeconds;
334 if (!touch_event_.timeStampSeconds) {
jdduke (slow) 2014/04/23 16:35:53 Why not have the tests fill the timeStampSeconds?
dgozman 2014/04/23 17:27:20 I would like that too, but interactive test issues
335 // Gesture detector does not tolerate null timestamps generated in tests.
336 touch_event_.timeStampSeconds =
337 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
338 }
334 touch_event_.modifiers = mouse_event.modifiers; 339 touch_event_.modifiers = mouse_event.modifiers;
335 340
336 WebTouchPoint& point = touch_event_.touches[0]; 341 WebTouchPoint& point = touch_event_.touches[0];
337 point.id = 0; 342 point.id = 0;
338 point.radiusX = point.radiusY = 1.f; 343 point.radiusX = point.radiusY = 1.f;
339 point.force = 1.f; 344 point.force = 1.f;
340 point.rotationAngle = 0.f; 345 point.rotationAngle = 0.f;
341 point.position.x = mouse_event.x; 346 point.position.x = mouse_event.x;
342 point.screenPosition.x = mouse_event.globalX; 347 point.screenPosition.x = mouse_event.globalX;
343 point.position.y = mouse_event.y; 348 point.position.y = mouse_event.y;
(...skipping 18 matching lines...) Expand all
362 NOTREACHED(); 367 NOTREACHED();
363 } 368 }
364 return true; 369 return true;
365 } 370 }
366 371
367 bool TouchEmulator::InPinchGestureMode() const { 372 bool TouchEmulator::InPinchGestureMode() const {
368 return shift_pressed_ && allow_pinch_; 373 return shift_pressed_ && allow_pinch_;
369 } 374 }
370 375
371 } // namespace content 376 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/data/devtools/touch_emulation.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698