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

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

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Truncated to int on input, git cl format 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 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3452 web_contents, ui::AX_EVENT_HOVER); 3450 web_contents, ui::AX_EVENT_HOVER);
3453 WebContentsAccessibilityEventWatcher guest_event_watcher( 3451 WebContentsAccessibilityEventWatcher guest_event_watcher(
3454 guest_web_contents, ui::AX_EVENT_HOVER); 3452 guest_web_contents, ui::AX_EVENT_HOVER);
3455 3453
3456 // Send an accessibility touch event to the main WebContents, but 3454 // Send an accessibility touch event to the main WebContents, but
3457 // positioned on top of the button inside the inner WebView. 3455 // positioned on top of the button inside the inner WebView.
3458 blink::WebMouseEvent accessibility_touch_event( 3456 blink::WebMouseEvent accessibility_touch_event(
3459 blink::WebInputEvent::MouseMove, 3457 blink::WebInputEvent::MouseMove,
3460 blink::WebInputEvent::IsTouchAccessibility, 3458 blink::WebInputEvent::IsTouchAccessibility,
3461 blink::WebInputEvent::TimeStampForTesting); 3459 blink::WebInputEvent::TimeStampForTesting);
3462 accessibility_touch_event.x = 95; 3460 accessibility_touch_event.setPositionInWidget(95, 55);
3463 accessibility_touch_event.y = 55;
3464 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( 3461 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(
3465 accessibility_touch_event); 3462 accessibility_touch_event);
3466 3463
3467 // Ensure that we got just a single hover event on the guest WebContents, 3464 // Ensure that we got just a single hover event on the guest WebContents,
3468 // and that it was fired on a button. 3465 // and that it was fired on a button.
3469 guest_event_watcher.Wait(); 3466 guest_event_watcher.Wait();
3470 ui::AXNodeData hit_node = guest_event_watcher.node_data(); 3467 ui::AXNodeData hit_node = guest_event_watcher.node_data();
3471 EXPECT_EQ(1U, guest_event_watcher.count()); 3468 EXPECT_EQ(1U, guest_event_watcher.count());
3472 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit_node.role); 3469 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit_node.role);
3473 EXPECT_EQ(0U, main_event_watcher.count()); 3470 EXPECT_EQ(0U, main_event_watcher.count());
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
4008 ClosingChromeSignInShouldNotCrash) { 4005 ClosingChromeSignInShouldNotCrash) {
4009 GURL signin_url{"chrome://chrome-signin"}; 4006 GURL signin_url{"chrome://chrome-signin"};
4010 4007
4011 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED); 4008 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED);
4012 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED); 4009 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED);
4013 WaitForWebViewInDom(); 4010 WaitForWebViewInDom();
4014 4011
4015 chrome::CloseTab(browser()); 4012 chrome::CloseTab(browser());
4016 } 4013 }
4017 #endif 4014 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698