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

Side by Side Diff: content/public/test/render_view_test.cc

Issue 1631963002: Plumb firing passive event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners_2a
Patch Set: Renamed enum value as per wez@ request Created 4 years, 10 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 434
435 void RenderViewTest::SendNativeKeyEvent( 435 void RenderViewTest::SendNativeKeyEvent(
436 const NativeWebKeyboardEvent& key_event) { 436 const NativeWebKeyboardEvent& key_event) {
437 SendWebKeyboardEvent(key_event); 437 SendWebKeyboardEvent(key_event);
438 } 438 }
439 439
440 void RenderViewTest::SendWebKeyboardEvent( 440 void RenderViewTest::SendWebKeyboardEvent(
441 const blink::WebKeyboardEvent& key_event) { 441 const blink::WebKeyboardEvent& key_event) {
442 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 442 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
443 impl->OnMessageReceived( 443 impl->OnMessageReceived(
444 InputMsg_HandleInputEvent(0, &key_event, ui::LatencyInfo())); 444 InputMsg_HandleInputEvent(0, &key_event, ui::LatencyInfo(),
445 InputEventDispatchType::DISPATCH_TYPE_NORMAL));
445 } 446 }
446 447
447 void RenderViewTest::SendWebMouseEvent( 448 void RenderViewTest::SendWebMouseEvent(
448 const blink::WebMouseEvent& mouse_event) { 449 const blink::WebMouseEvent& mouse_event) {
449 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 450 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
450 impl->OnMessageReceived( 451 impl->OnMessageReceived(
451 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo())); 452 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(),
453 InputEventDispatchType::DISPATCH_TYPE_NORMAL));
452 } 454 }
453 455
454 const char* const kGetCoordinatesScript = 456 const char* const kGetCoordinatesScript =
455 "(function() {" 457 "(function() {"
456 " function GetCoordinates(elem) {" 458 " function GetCoordinates(elem) {"
457 " if (!elem)" 459 " if (!elem)"
458 " return [ 0, 0];" 460 " return [ 0, 0];"
459 " var coordinates = [ elem.offsetLeft, elem.offsetTop];" 461 " var coordinates = [ elem.offsetLeft, elem.offsetTop];"
460 " var parent_coordinates = GetCoordinates(elem.offsetParent);" 462 " var parent_coordinates = GetCoordinates(elem.offsetParent);"
461 " coordinates[0] += parent_coordinates[0];" 463 " coordinates[0] += parent_coordinates[0];"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 510
509 void RenderViewTest::SimulatePointClick(const gfx::Point& point) { 511 void RenderViewTest::SimulatePointClick(const gfx::Point& point) {
510 WebMouseEvent mouse_event; 512 WebMouseEvent mouse_event;
511 mouse_event.type = WebInputEvent::MouseDown; 513 mouse_event.type = WebInputEvent::MouseDown;
512 mouse_event.button = WebMouseEvent::ButtonLeft; 514 mouse_event.button = WebMouseEvent::ButtonLeft;
513 mouse_event.x = point.x(); 515 mouse_event.x = point.x();
514 mouse_event.y = point.y(); 516 mouse_event.y = point.y();
515 mouse_event.clickCount = 1; 517 mouse_event.clickCount = 1;
516 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 518 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
517 impl->OnMessageReceived( 519 impl->OnMessageReceived(
518 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo())); 520 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(),
521 InputEventDispatchType::DISPATCH_TYPE_NORMAL));
519 mouse_event.type = WebInputEvent::MouseUp; 522 mouse_event.type = WebInputEvent::MouseUp;
520 impl->OnMessageReceived( 523 impl->OnMessageReceived(
521 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo())); 524 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(),
525 InputEventDispatchType::DISPATCH_TYPE_NORMAL));
522 } 526 }
523 527
524 528
525 bool RenderViewTest::SimulateElementRightClick(const std::string& element_id) { 529 bool RenderViewTest::SimulateElementRightClick(const std::string& element_id) {
526 gfx::Rect bounds = GetElementBounds(element_id); 530 gfx::Rect bounds = GetElementBounds(element_id);
527 if (bounds.IsEmpty()) 531 if (bounds.IsEmpty())
528 return false; 532 return false;
529 SimulatePointRightClick(bounds.CenterPoint()); 533 SimulatePointRightClick(bounds.CenterPoint());
530 return true; 534 return true;
531 } 535 }
532 536
533 void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) { 537 void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) {
534 WebMouseEvent mouse_event; 538 WebMouseEvent mouse_event;
535 mouse_event.type = WebInputEvent::MouseDown; 539 mouse_event.type = WebInputEvent::MouseDown;
536 mouse_event.button = WebMouseEvent::ButtonRight; 540 mouse_event.button = WebMouseEvent::ButtonRight;
537 mouse_event.x = point.x(); 541 mouse_event.x = point.x();
538 mouse_event.y = point.y(); 542 mouse_event.y = point.y();
539 mouse_event.clickCount = 1; 543 mouse_event.clickCount = 1;
540 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 544 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
541 impl->OnMessageReceived( 545 impl->OnMessageReceived(
542 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo())); 546 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(),
547 InputEventDispatchType::DISPATCH_TYPE_NORMAL));
543 mouse_event.type = WebInputEvent::MouseUp; 548 mouse_event.type = WebInputEvent::MouseUp;
544 impl->OnMessageReceived( 549 impl->OnMessageReceived(
545 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo())); 550 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(),
551 InputEventDispatchType::DISPATCH_TYPE_NORMAL));
546 } 552 }
547 553
548 void RenderViewTest::SimulateRectTap(const gfx::Rect& rect) { 554 void RenderViewTest::SimulateRectTap(const gfx::Rect& rect) {
549 WebGestureEvent gesture_event; 555 WebGestureEvent gesture_event;
550 gesture_event.x = rect.CenterPoint().x(); 556 gesture_event.x = rect.CenterPoint().x();
551 gesture_event.y = rect.CenterPoint().y(); 557 gesture_event.y = rect.CenterPoint().y();
552 gesture_event.data.tap.tapCount = 1; 558 gesture_event.data.tap.tapCount = 1;
553 gesture_event.data.tap.width = rect.width(); 559 gesture_event.data.tap.width = rect.width();
554 gesture_event.data.tap.height = rect.height(); 560 gesture_event.data.tap.height = rect.height();
555 gesture_event.type = WebInputEvent::GestureTap; 561 gesture_event.type = WebInputEvent::GestureTap;
556 gesture_event.sourceDevice = blink::WebGestureDeviceTouchpad; 562 gesture_event.sourceDevice = blink::WebGestureDeviceTouchpad;
557 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 563 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
558 impl->OnMessageReceived( 564 impl->OnMessageReceived(
559 InputMsg_HandleInputEvent(0, &gesture_event, ui::LatencyInfo())); 565 InputMsg_HandleInputEvent(0, &gesture_event, ui::LatencyInfo(),
566 InputEventDispatchType::DISPATCH_TYPE_NORMAL));
560 impl->FocusChangeComplete(); 567 impl->FocusChangeComplete();
561 } 568 }
562 569
563 void RenderViewTest::SetFocused(const blink::WebNode& node) { 570 void RenderViewTest::SetFocused(const blink::WebNode& node) {
564 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 571 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
565 impl->focusedNodeChanged(blink::WebNode(), node); 572 impl->focusedNodeChanged(blink::WebNode(), node);
566 } 573 }
567 574
568 void RenderViewTest::Reload(const GURL& url) { 575 void RenderViewTest::Reload(const GURL& url) {
569 CommonNavigationParams common_params( 576 CommonNavigationParams common_params(
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 TestRenderFrame* frame = 722 TestRenderFrame* frame =
716 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); 723 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame());
717 frame->Navigate(common_params, StartNavigationParams(), request_params); 724 frame->Navigate(common_params, StartNavigationParams(), request_params);
718 725
719 // The load actually happens asynchronously, so we pump messages to process 726 // The load actually happens asynchronously, so we pump messages to process
720 // the pending continuation. 727 // the pending continuation.
721 FrameLoadWaiter(frame).Wait(); 728 FrameLoadWaiter(frame).Wait();
722 } 729 }
723 730
724 } // namespace content 731 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698