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

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

Issue 315713002: Enable unified GR by default in Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix SimulateTapAt to include a non-zero timestamp on the touch events. Created 6 years, 6 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 | « no previous file | ui/events/gestures/gesture_recognizer_impl.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/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process/kill.h" 10 #include "base/process/kill.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 259 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
260 } 260 }
261 261
262 void SimulateTapAt(WebContents* web_contents, const gfx::Point& point) { 262 void SimulateTapAt(WebContents* web_contents, const gfx::Point& point) {
263 const double kTapDurationSeconds = 263 const double kTapDurationSeconds =
264 0.5 * (ui::GestureConfiguration:: 264 0.5 * (ui::GestureConfiguration::
265 min_touch_down_duration_in_seconds_for_click() + 265 min_touch_down_duration_in_seconds_for_click() +
266 ui::GestureConfiguration:: 266 ui::GestureConfiguration::
267 max_touch_down_duration_in_seconds_for_click()); 267 max_touch_down_duration_in_seconds_for_click());
268 SyntheticWebTouchEvent touch; 268 SyntheticWebTouchEvent touch;
269 touch.timeStampSeconds = 0; 269 touch.SetTimestamp(base::TimeTicks::Now() - base::TimeTicks());
Paweł Hajdan Jr. 2014/06/05 10:17:53 nit: Could you add a comment why we do this weird
tdresser 2014/06/05 12:05:08 Done.
270 touch.PressPoint(point.x(), point.y()); 270 touch.PressPoint(point.x(), point.y());
271 RenderWidgetHostImpl* widget_host = 271 RenderWidgetHostImpl* widget_host =
272 RenderWidgetHostImpl::From(web_contents->GetRenderViewHost()); 272 RenderWidgetHostImpl::From(web_contents->GetRenderViewHost());
273 widget_host->ForwardTouchEvent(touch); 273 widget_host->ForwardTouchEvent(touch);
274 touch.timeStampSeconds = kTapDurationSeconds; 274 touch.timeStampSeconds += kTapDurationSeconds;
275 touch.ReleasePoint(0); 275 touch.ReleasePoint(0);
276 widget_host->ForwardTouchEvent(touch); 276 widget_host->ForwardTouchEvent(touch);
277 } 277 }
278 278
279 void SimulateKeyPress(WebContents* web_contents, 279 void SimulateKeyPress(WebContents* web_contents,
280 ui::KeyboardCode key_code, 280 ui::KeyboardCode key_code,
281 bool control, 281 bool control,
282 bool shift, 282 bool shift,
283 bool alt, 283 bool alt,
284 bool command) { 284 bool command) {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 } 692 }
693 // The queue should not be empty, unless we were quit because of a timeout. 693 // The queue should not be empty, unless we were quit because of a timeout.
694 if (message_queue_.empty()) 694 if (message_queue_.empty())
695 return false; 695 return false;
696 *message = message_queue_.front(); 696 *message = message_queue_.front();
697 message_queue_.pop(); 697 message_queue_.pop();
698 return true; 698 return true;
699 } 699 }
700 700
701 } // namespace content 701 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/events/gestures/gesture_recognizer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698