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 <stddef.h> | 7 #include <stddef.h> |
8 #include <tuple> | 8 #include <tuple> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 524 } |
525 | 525 |
526 void SimulateMouseClickAt(WebContents* web_contents, | 526 void SimulateMouseClickAt(WebContents* web_contents, |
527 int modifiers, | 527 int modifiers, |
528 blink::WebMouseEvent::Button button, | 528 blink::WebMouseEvent::Button button, |
529 const gfx::Point& point) { | 529 const gfx::Point& point) { |
530 blink::WebMouseEvent mouse_event( | 530 blink::WebMouseEvent mouse_event( |
531 blink::WebInputEvent::MouseDown, modifiers, | 531 blink::WebInputEvent::MouseDown, modifiers, |
532 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); | 532 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
533 mouse_event.button = button; | 533 mouse_event.button = button; |
534 mouse_event.x = point.x(); | 534 mouse_event.position.x = point.x(); |
535 mouse_event.y = point.y(); | 535 mouse_event.position.y = point.y(); |
536 // Mac needs globalX/globalY for events to plugins. | 536 // Mac needs screenPosition for events to plugins. |
537 gfx::Rect offset = web_contents->GetContainerBounds(); | 537 gfx::Rect offset = web_contents->GetContainerBounds(); |
538 mouse_event.globalX = point.x() + offset.x(); | 538 mouse_event.screenPosition.x = point.x() + offset.x(); |
539 mouse_event.globalY = point.y() + offset.y(); | 539 mouse_event.screenPosition.y = point.y() + offset.y(); |
540 mouse_event.clickCount = 1; | 540 mouse_event.clickCount = 1; |
541 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( | 541 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( |
542 mouse_event); | 542 mouse_event); |
543 mouse_event.setType(blink::WebInputEvent::MouseUp); | 543 mouse_event.setType(blink::WebInputEvent::MouseUp); |
544 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( | 544 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( |
545 mouse_event); | 545 mouse_event); |
546 } | 546 } |
547 | 547 |
548 void SimulateMouseEvent(WebContents* web_contents, | 548 void SimulateMouseEvent(WebContents* web_contents, |
549 blink::WebInputEvent::Type type, | 549 blink::WebInputEvent::Type type, |
550 const gfx::Point& point) { | 550 const gfx::Point& point) { |
551 blink::WebMouseEvent mouse_event( | 551 blink::WebMouseEvent mouse_event( |
552 type, blink::WebInputEvent::NoModifiers, | 552 type, blink::WebInputEvent::NoModifiers, |
553 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); | 553 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
554 mouse_event.x = point.x(); | 554 mouse_event.position.x = point.x(); |
555 mouse_event.y = point.y(); | 555 mouse_event.position.y = point.y(); |
556 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( | 556 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( |
557 mouse_event); | 557 mouse_event); |
558 } | 558 } |
559 | 559 |
560 void SimulateMouseWheelEvent(WebContents* web_contents, | 560 void SimulateMouseWheelEvent(WebContents* web_contents, |
561 const gfx::Point& point, | 561 const gfx::Point& point, |
562 const gfx::Vector2d& delta) { | 562 const gfx::Vector2d& delta) { |
563 blink::WebMouseWheelEvent wheel_event( | 563 blink::WebMouseWheelEvent wheel_event( |
564 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, | 564 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, |
565 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); | 565 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
566 | 566 |
567 wheel_event.x = point.x(); | 567 wheel_event.position.x = point.x(); |
568 wheel_event.y = point.y(); | 568 wheel_event.position.y = point.y(); |
569 wheel_event.deltaX = delta.x(); | 569 wheel_event.deltaX = delta.x(); |
570 wheel_event.deltaY = delta.y(); | 570 wheel_event.deltaY = delta.y(); |
571 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( | 571 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( |
572 web_contents->GetRenderViewHost()->GetWidget()); | 572 web_contents->GetRenderViewHost()->GetWidget()); |
573 widget_host->ForwardWheelEvent(wheel_event); | 573 widget_host->ForwardWheelEvent(wheel_event); |
574 } | 574 } |
575 | 575 |
576 void SimulateGestureScrollSequence(WebContents* web_contents, | 576 void SimulateGestureScrollSequence(WebContents* web_contents, |
577 const gfx::Point& point, | 577 const gfx::Point& point, |
578 const gfx::Vector2dF& delta) { | 578 const gfx::Vector2dF& delta) { |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 bool user_gesture, | 1874 bool user_gesture, |
1875 bool last_unlocked_by_target, | 1875 bool last_unlocked_by_target, |
1876 bool privileged) { | 1876 bool privileged) { |
1877 IPC::IpcSecurityTestUtil::PwnMessageReceived( | 1877 IPC::IpcSecurityTestUtil::PwnMessageReceived( |
1878 process->GetChannel(), | 1878 process->GetChannel(), |
1879 ViewHostMsg_LockMouse(routing_id, user_gesture, last_unlocked_by_target, | 1879 ViewHostMsg_LockMouse(routing_id, user_gesture, last_unlocked_by_target, |
1880 privileged)); | 1880 privileged)); |
1881 } | 1881 } |
1882 | 1882 |
1883 } // namespace content | 1883 } // namespace content |
OLD | NEW |