OLD | NEW |
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 Loading... |
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.position.x = point.x(); |
453 mouse_event.y = point.y(); | 453 mouse_event.position.y = point.y(); |
454 mouse_event.clickCount = 1; | 454 mouse_event.clickCount = 1; |
455 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 455 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
456 impl->OnMessageReceived(InputMsg_HandleInputEvent( | 456 impl->OnMessageReceived(InputMsg_HandleInputEvent( |
457 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), | 457 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), |
458 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); | 458 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); |
459 mouse_event.setType(WebInputEvent::MouseUp); | 459 mouse_event.setType(WebInputEvent::MouseUp); |
460 impl->OnMessageReceived(InputMsg_HandleInputEvent( | 460 impl->OnMessageReceived(InputMsg_HandleInputEvent( |
461 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), | 461 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), |
462 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); | 462 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); |
463 } | 463 } |
464 | 464 |
465 | 465 |
466 bool RenderViewTest::SimulateElementRightClick(const std::string& element_id) { | 466 bool RenderViewTest::SimulateElementRightClick(const std::string& element_id) { |
467 gfx::Rect bounds = GetElementBounds(element_id); | 467 gfx::Rect bounds = GetElementBounds(element_id); |
468 if (bounds.IsEmpty()) | 468 if (bounds.IsEmpty()) |
469 return false; | 469 return false; |
470 SimulatePointRightClick(bounds.CenterPoint()); | 470 SimulatePointRightClick(bounds.CenterPoint()); |
471 return true; | 471 return true; |
472 } | 472 } |
473 | 473 |
474 void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) { | 474 void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) { |
475 WebMouseEvent mouse_event(WebInputEvent::MouseDown, | 475 WebMouseEvent mouse_event(WebInputEvent::MouseDown, |
476 WebInputEvent::NoModifiers, | 476 WebInputEvent::NoModifiers, |
477 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); | 477 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
478 mouse_event.button = WebMouseEvent::Button::Right; | 478 mouse_event.button = WebMouseEvent::Button::Right; |
479 mouse_event.x = point.x(); | 479 mouse_event.position.x = point.x(); |
480 mouse_event.y = point.y(); | 480 mouse_event.position.y = point.y(); |
481 mouse_event.clickCount = 1; | 481 mouse_event.clickCount = 1; |
482 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 482 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
483 impl->OnMessageReceived(InputMsg_HandleInputEvent( | 483 impl->OnMessageReceived(InputMsg_HandleInputEvent( |
484 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), | 484 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), |
485 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); | 485 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); |
486 mouse_event.setType(WebInputEvent::MouseUp); | 486 mouse_event.setType(WebInputEvent::MouseUp); |
487 impl->OnMessageReceived(InputMsg_HandleInputEvent( | 487 impl->OnMessageReceived(InputMsg_HandleInputEvent( |
488 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), | 488 0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(), |
489 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); | 489 InputEventDispatchType::DISPATCH_TYPE_BLOCKING)); |
490 } | 490 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 669 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
670 frame->Navigate(common_params, StartNavigationParams(), request_params); | 670 frame->Navigate(common_params, StartNavigationParams(), request_params); |
671 | 671 |
672 // The load actually happens asynchronously, so we pump messages to process | 672 // The load actually happens asynchronously, so we pump messages to process |
673 // the pending continuation. | 673 // the pending continuation. |
674 FrameLoadWaiter(frame).Wait(); | 674 FrameLoadWaiter(frame).Wait(); |
675 view_->GetWebView()->updateAllLifecyclePhases(); | 675 view_->GetWebView()->updateAllLifecyclePhases(); |
676 } | 676 } |
677 | 677 |
678 } // namespace content | 678 } // namespace content |
OLD | NEW |