| 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 "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 Loading... |
| 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 // Set the timestamp to the base::TimeDelta representing the current time. |
| 270 touch.SetTimestamp(base::TimeTicks::Now() - base::TimeTicks()); |
| 270 touch.PressPoint(point.x(), point.y()); | 271 touch.PressPoint(point.x(), point.y()); |
| 271 RenderWidgetHostImpl* widget_host = | 272 RenderWidgetHostImpl* widget_host = |
| 272 RenderWidgetHostImpl::From(web_contents->GetRenderViewHost()); | 273 RenderWidgetHostImpl::From(web_contents->GetRenderViewHost()); |
| 273 widget_host->ForwardTouchEvent(touch); | 274 widget_host->ForwardTouchEvent(touch); |
| 274 touch.timeStampSeconds = kTapDurationSeconds; | 275 touch.timeStampSeconds += kTapDurationSeconds; |
| 275 touch.ReleasePoint(0); | 276 touch.ReleasePoint(0); |
| 276 widget_host->ForwardTouchEvent(touch); | 277 widget_host->ForwardTouchEvent(touch); |
| 277 } | 278 } |
| 278 | 279 |
| 279 void SimulateKeyPress(WebContents* web_contents, | 280 void SimulateKeyPress(WebContents* web_contents, |
| 280 ui::KeyboardCode key_code, | 281 ui::KeyboardCode key_code, |
| 281 bool control, | 282 bool control, |
| 282 bool shift, | 283 bool shift, |
| 283 bool alt, | 284 bool alt, |
| 284 bool command) { | 285 bool command) { |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 } | 693 } |
| 693 // The queue should not be empty, unless we were quit because of a timeout. | 694 // The queue should not be empty, unless we were quit because of a timeout. |
| 694 if (message_queue_.empty()) | 695 if (message_queue_.empty()) |
| 695 return false; | 696 return false; |
| 696 *message = message_queue_.front(); | 697 *message = message_queue_.front(); |
| 697 message_queue_.pop(); | 698 message_queue_.pop(); |
| 698 return true; | 699 return true; |
| 699 } | 700 } |
| 700 | 701 |
| 701 } // namespace content | 702 } // namespace content |
| OLD | NEW |