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

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

Powered by Google App Engine
This is Rietveld 408576698