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

Side by Side Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 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
OLDNEW
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
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_.setPositionInWidget(point.x(), point.y());
313 mouse_event_.y = point.y();
314 const gfx::Rect offset = web_contents_->GetContainerBounds(); 313 const gfx::Rect offset = web_contents_->GetContainerBounds();
315 mouse_event_.globalX = point.x() + offset.x(); 314 mouse_event_.setPositionInScreen(point.x() + offset.x(),
316 mouse_event_.globalY = point.y() + offset.y(); 315 point.y() + offset.y());
317 mouse_event_.clickCount = 1; 316 mouse_event_.clickCount = 1;
318 web_contents_->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( 317 web_contents_->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(
319 mouse_event_); 318 mouse_event_);
320 319
321 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 320 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
322 FROM_HERE, base::Bind(&LeftMouseClick::SendMouseUp, 321 FROM_HERE, base::Bind(&LeftMouseClick::SendMouseUp,
323 base::Unretained(this)), 322 base::Unretained(this)),
324 base::TimeDelta::FromMilliseconds(duration_ms)); 323 base::TimeDelta::FromMilliseconds(duration_ms));
325 } 324 }
326 325
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (listener) { 773 if (listener) {
775 ASSERT_TRUE(listener->WaitUntilSatisfied()); 774 ASSERT_TRUE(listener->WaitUntilSatisfied());
776 } 775 }
777 } 776 }
778 777
779 void OpenContextMenu(content::WebContents* web_contents) { 778 void OpenContextMenu(content::WebContents* web_contents) {
780 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 779 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
781 blink::WebInputEvent::NoModifiers, 780 blink::WebInputEvent::NoModifiers,
782 blink::WebInputEvent::TimeStampForTesting); 781 blink::WebInputEvent::TimeStampForTesting);
783 mouse_event.button = blink::WebMouseEvent::Button::Right; 782 mouse_event.button = blink::WebMouseEvent::Button::Right;
784 mouse_event.x = 1; 783 mouse_event.setPositionInWidget(1, 1);
785 mouse_event.y = 1;
786 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( 784 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(
787 mouse_event); 785 mouse_event);
788 mouse_event.setType(blink::WebInputEvent::MouseUp); 786 mouse_event.setType(blink::WebInputEvent::MouseUp);
789 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( 787 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(
790 mouse_event); 788 mouse_event);
791 } 789 }
792 790
793 content::WebContents* GetGuestWebContents() { 791 content::WebContents* GetGuestWebContents() {
794 return guest_web_contents_; 792 return guest_web_contents_;
795 } 793 }
(...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after
3449 web_contents, ui::AX_EVENT_HOVER); 3447 web_contents, ui::AX_EVENT_HOVER);
3450 WebContentsAccessibilityEventWatcher guest_event_watcher( 3448 WebContentsAccessibilityEventWatcher guest_event_watcher(
3451 guest_web_contents, ui::AX_EVENT_HOVER); 3449 guest_web_contents, ui::AX_EVENT_HOVER);
3452 3450
3453 // Send an accessibility touch event to the main WebContents, but 3451 // Send an accessibility touch event to the main WebContents, but
3454 // positioned on top of the button inside the inner WebView. 3452 // positioned on top of the button inside the inner WebView.
3455 blink::WebMouseEvent accessibility_touch_event( 3453 blink::WebMouseEvent accessibility_touch_event(
3456 blink::WebInputEvent::MouseMove, 3454 blink::WebInputEvent::MouseMove,
3457 blink::WebInputEvent::IsTouchAccessibility, 3455 blink::WebInputEvent::IsTouchAccessibility,
3458 blink::WebInputEvent::TimeStampForTesting); 3456 blink::WebInputEvent::TimeStampForTesting);
3459 accessibility_touch_event.x = 95; 3457 accessibility_touch_event.setPositionInWidget(95, 55);
3460 accessibility_touch_event.y = 55;
3461 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( 3458 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(
3462 accessibility_touch_event); 3459 accessibility_touch_event);
3463 3460
3464 // Ensure that we got just a single hover event on the guest WebContents, 3461 // Ensure that we got just a single hover event on the guest WebContents,
3465 // and that it was fired on a button. 3462 // and that it was fired on a button.
3466 guest_event_watcher.Wait(); 3463 guest_event_watcher.Wait();
3467 ui::AXNodeData hit_node = guest_event_watcher.node_data(); 3464 ui::AXNodeData hit_node = guest_event_watcher.node_data();
3468 EXPECT_EQ(1U, guest_event_watcher.count()); 3465 EXPECT_EQ(1U, guest_event_watcher.count());
3469 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit_node.role); 3466 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit_node.role);
3470 EXPECT_EQ(0U, main_event_watcher.count()); 3467 EXPECT_EQ(0U, main_event_watcher.count());
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
4002 ClosingChromeSignInShouldNotCrash) { 3999 ClosingChromeSignInShouldNotCrash) {
4003 GURL signin_url{"chrome://chrome-signin"}; 4000 GURL signin_url{"chrome://chrome-signin"};
4004 4001
4005 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED); 4002 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED);
4006 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED); 4003 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED);
4007 WaitForWebViewInDom(); 4004 WaitForWebViewInDom();
4008 4005
4009 chrome::CloseTab(browser()); 4006 chrome::CloseTab(browser());
4010 } 4007 }
4011 #endif 4008 #endif
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.cc ('k') | chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698