OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <queue> | 5 #include <queue> |
6 #include <set> | 6 #include <set> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 302 } |
303 | 303 |
304 ~LeftMouseClick() { | 304 ~LeftMouseClick() { |
305 DCHECK(click_completed_); | 305 DCHECK(click_completed_); |
306 } | 306 } |
307 | 307 |
308 void Click(const gfx::Point& point, int duration_ms) { | 308 void Click(const gfx::Point& point, int duration_ms) { |
309 DCHECK(click_completed_); | 309 DCHECK(click_completed_); |
310 click_completed_ = false; | 310 click_completed_ = false; |
311 mouse_event_.setType(blink::WebInputEvent::MouseDown); | 311 mouse_event_.setType(blink::WebInputEvent::MouseDown); |
312 mouse_event_.x = point.x(); | 312 mouse_event_.position.x = point.x(); |
313 mouse_event_.y = point.y(); | 313 mouse_event_.position.y = point.y(); |
314 const gfx::Rect offset = web_contents_->GetContainerBounds(); | 314 const gfx::Rect offset = web_contents_->GetContainerBounds(); |
315 mouse_event_.globalX = point.x() + offset.x(); | 315 mouse_event_.screenPosition.x = point.x() + offset.x(); |
316 mouse_event_.globalY = point.y() + offset.y(); | 316 mouse_event_.screenPosition.y = point.y() + offset.y(); |
317 mouse_event_.clickCount = 1; | 317 mouse_event_.clickCount = 1; |
318 web_contents_->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( | 318 web_contents_->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( |
319 mouse_event_); | 319 mouse_event_); |
320 | 320 |
321 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 321 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
322 FROM_HERE, base::Bind(&LeftMouseClick::SendMouseUp, | 322 FROM_HERE, base::Bind(&LeftMouseClick::SendMouseUp, |
323 base::Unretained(this)), | 323 base::Unretained(this)), |
324 base::TimeDelta::FromMilliseconds(duration_ms)); | 324 base::TimeDelta::FromMilliseconds(duration_ms)); |
325 } | 325 } |
326 | 326 |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 if (listener) { | 774 if (listener) { |
775 ASSERT_TRUE(listener->WaitUntilSatisfied()); | 775 ASSERT_TRUE(listener->WaitUntilSatisfied()); |
776 } | 776 } |
777 } | 777 } |
778 | 778 |
779 void OpenContextMenu(content::WebContents* web_contents) { | 779 void OpenContextMenu(content::WebContents* web_contents) { |
780 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 780 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
781 blink::WebInputEvent::NoModifiers, | 781 blink::WebInputEvent::NoModifiers, |
782 blink::WebInputEvent::TimeStampForTesting); | 782 blink::WebInputEvent::TimeStampForTesting); |
783 mouse_event.button = blink::WebMouseEvent::Button::Right; | 783 mouse_event.button = blink::WebMouseEvent::Button::Right; |
784 mouse_event.x = 1; | 784 mouse_event.position.x = 1; |
785 mouse_event.y = 1; | 785 mouse_event.position.y = 1; |
786 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( | 786 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( |
787 mouse_event); | 787 mouse_event); |
788 mouse_event.setType(blink::WebInputEvent::MouseUp); | 788 mouse_event.setType(blink::WebInputEvent::MouseUp); |
789 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( | 789 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( |
790 mouse_event); | 790 mouse_event); |
791 } | 791 } |
792 | 792 |
793 content::WebContents* GetGuestWebContents() { | 793 content::WebContents* GetGuestWebContents() { |
794 return guest_web_contents_; | 794 return guest_web_contents_; |
795 } | 795 } |
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3452 web_contents, ui::AX_EVENT_HOVER); | 3452 web_contents, ui::AX_EVENT_HOVER); |
3453 WebContentsAccessibilityEventWatcher guest_event_watcher( | 3453 WebContentsAccessibilityEventWatcher guest_event_watcher( |
3454 guest_web_contents, ui::AX_EVENT_HOVER); | 3454 guest_web_contents, ui::AX_EVENT_HOVER); |
3455 | 3455 |
3456 // Send an accessibility touch event to the main WebContents, but | 3456 // Send an accessibility touch event to the main WebContents, but |
3457 // positioned on top of the button inside the inner WebView. | 3457 // positioned on top of the button inside the inner WebView. |
3458 blink::WebMouseEvent accessibility_touch_event( | 3458 blink::WebMouseEvent accessibility_touch_event( |
3459 blink::WebInputEvent::MouseMove, | 3459 blink::WebInputEvent::MouseMove, |
3460 blink::WebInputEvent::IsTouchAccessibility, | 3460 blink::WebInputEvent::IsTouchAccessibility, |
3461 blink::WebInputEvent::TimeStampForTesting); | 3461 blink::WebInputEvent::TimeStampForTesting); |
3462 accessibility_touch_event.x = 95; | 3462 accessibility_touch_event.position.x = 95; |
3463 accessibility_touch_event.y = 55; | 3463 accessibility_touch_event.position.y = 55; |
3464 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( | 3464 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( |
3465 accessibility_touch_event); | 3465 accessibility_touch_event); |
3466 | 3466 |
3467 // Ensure that we got just a single hover event on the guest WebContents, | 3467 // Ensure that we got just a single hover event on the guest WebContents, |
3468 // and that it was fired on a button. | 3468 // and that it was fired on a button. |
3469 guest_event_watcher.Wait(); | 3469 guest_event_watcher.Wait(); |
3470 ui::AXNodeData hit_node = guest_event_watcher.node_data(); | 3470 ui::AXNodeData hit_node = guest_event_watcher.node_data(); |
3471 EXPECT_EQ(1U, guest_event_watcher.count()); | 3471 EXPECT_EQ(1U, guest_event_watcher.count()); |
3472 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit_node.role); | 3472 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit_node.role); |
3473 EXPECT_EQ(0U, main_event_watcher.count()); | 3473 EXPECT_EQ(0U, main_event_watcher.count()); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4008 ClosingChromeSignInShouldNotCrash) { | 4008 ClosingChromeSignInShouldNotCrash) { |
4009 GURL signin_url{"chrome://chrome-signin"}; | 4009 GURL signin_url{"chrome://chrome-signin"}; |
4010 | 4010 |
4011 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED); | 4011 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED); |
4012 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED); | 4012 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED); |
4013 WaitForWebViewInDom(); | 4013 WaitForWebViewInDom(); |
4014 | 4014 |
4015 chrome::CloseTab(browser()); | 4015 chrome::CloseTab(browser()); |
4016 } | 4016 } |
4017 #endif | 4017 #endif |
OLD | NEW |