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

Side by Side Diff: content/public/test/render_view_test.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 (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/render_view_test.h" 5 #include "content/public/test/render_view_test.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cctype> 9 #include <cctype>
10 10
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 return false; 442 return false;
443 SimulatePointClick(bounds.CenterPoint()); 443 SimulatePointClick(bounds.CenterPoint());
444 return true; 444 return true;
445 } 445 }
446 446
447 void RenderViewTest::SimulatePointClick(const gfx::Point& point) { 447 void RenderViewTest::SimulatePointClick(const gfx::Point& point) {
448 WebMouseEvent mouse_event(WebInputEvent::MouseDown, 448 WebMouseEvent mouse_event(WebInputEvent::MouseDown,
449 WebInputEvent::NoModifiers, 449 WebInputEvent::NoModifiers,
450 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); 450 ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
451 mouse_event.button = WebMouseEvent::Button::Left; 451 mouse_event.button = WebMouseEvent::Button::Left;
452 mouse_event.x = point.x(); 452 mouse_event.setPositionInWidget(point.x(), point.y());
453 mouse_event.y = point.y();
454 mouse_event.clickCount = 1; 453 mouse_event.clickCount = 1;
455 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 454 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
456 impl->OnMessageReceived(InputMsg_HandleInputEvent( 455 impl->OnMessageReceived(InputMsg_HandleInputEvent(
457 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), 456 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(),
458 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); 457 InputEventDispatchType::DISPATCH_TYPE_BLOCKING));
459 mouse_event.setType(WebInputEvent::MouseUp); 458 mouse_event.setType(WebInputEvent::MouseUp);
460 impl->OnMessageReceived(InputMsg_HandleInputEvent( 459 impl->OnMessageReceived(InputMsg_HandleInputEvent(
461 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), 460 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(),
462 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); 461 InputEventDispatchType::DISPATCH_TYPE_BLOCKING));
463 } 462 }
464 463
465 464
466 bool RenderViewTest::SimulateElementRightClick(const std::string& element_id) { 465 bool RenderViewTest::SimulateElementRightClick(const std::string& element_id) {
467 gfx::Rect bounds = GetElementBounds(element_id); 466 gfx::Rect bounds = GetElementBounds(element_id);
468 if (bounds.IsEmpty()) 467 if (bounds.IsEmpty())
469 return false; 468 return false;
470 SimulatePointRightClick(bounds.CenterPoint()); 469 SimulatePointRightClick(bounds.CenterPoint());
471 return true; 470 return true;
472 } 471 }
473 472
474 void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) { 473 void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) {
475 WebMouseEvent mouse_event(WebInputEvent::MouseDown, 474 WebMouseEvent mouse_event(WebInputEvent::MouseDown,
476 WebInputEvent::NoModifiers, 475 WebInputEvent::NoModifiers,
477 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); 476 ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
478 mouse_event.button = WebMouseEvent::Button::Right; 477 mouse_event.button = WebMouseEvent::Button::Right;
479 mouse_event.x = point.x(); 478 mouse_event.setPositionInWidget(point.x(), point.y());
480 mouse_event.y = point.y();
481 mouse_event.clickCount = 1; 479 mouse_event.clickCount = 1;
482 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 480 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
483 impl->OnMessageReceived(InputMsg_HandleInputEvent( 481 impl->OnMessageReceived(InputMsg_HandleInputEvent(
484 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), 482 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(),
485 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); 483 InputEventDispatchType::DISPATCH_TYPE_BLOCKING));
486 mouse_event.setType(WebInputEvent::MouseUp); 484 mouse_event.setType(WebInputEvent::MouseUp);
487 impl->OnMessageReceived(InputMsg_HandleInputEvent( 485 impl->OnMessageReceived(InputMsg_HandleInputEvent(
488 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), 486 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(),
489 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); 487 InputEventDispatchType::DISPATCH_TYPE_BLOCKING));
490 } 488 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); 667 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame());
670 frame->Navigate(common_params, StartNavigationParams(), request_params); 668 frame->Navigate(common_params, StartNavigationParams(), request_params);
671 669
672 // The load actually happens asynchronously, so we pump messages to process 670 // The load actually happens asynchronously, so we pump messages to process
673 // the pending continuation. 671 // the pending continuation.
674 FrameLoadWaiter(frame).Wait(); 672 FrameLoadWaiter(frame).Wait();
675 view_->GetWebView()->updateAllLifecyclePhases(); 673 view_->GetWebView()->updateAllLifecyclePhases();
676 } 674 }
677 675
678 } // namespace content 676 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.cc ('k') | content/renderer/gpu/gpu_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698