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