| 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 <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 mouse_event.y = point.y(); | 379 mouse_event.y = point.y(); |
| 380 mouse_event.clickCount = 1; | 380 mouse_event.clickCount = 1; |
| 381 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 381 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 382 impl->OnMessageReceived( | 382 impl->OnMessageReceived( |
| 383 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); | 383 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); |
| 384 mouse_event.type = WebInputEvent::MouseUp; | 384 mouse_event.type = WebInputEvent::MouseUp; |
| 385 impl->OnMessageReceived( | 385 impl->OnMessageReceived( |
| 386 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); | 386 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); |
| 387 } | 387 } |
| 388 | 388 |
| 389 |
| 390 bool RenderViewTest::SimulateElementRightClick(const std::string& element_id) { |
| 391 gfx::Rect bounds = GetElementBounds(element_id); |
| 392 if (bounds.IsEmpty()) |
| 393 return false; |
| 394 SimulatePointRightClick(bounds.CenterPoint()); |
| 395 return true; |
| 396 } |
| 397 |
| 398 void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) { |
| 399 WebMouseEvent mouse_event; |
| 400 mouse_event.type = WebInputEvent::MouseDown; |
| 401 mouse_event.button = WebMouseEvent::ButtonRight; |
| 402 mouse_event.x = point.x(); |
| 403 mouse_event.y = point.y(); |
| 404 mouse_event.clickCount = 1; |
| 405 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 406 impl->OnMessageReceived( |
| 407 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); |
| 408 mouse_event.type = WebInputEvent::MouseUp; |
| 409 impl->OnMessageReceived( |
| 410 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); |
| 411 } |
| 412 |
| 389 void RenderViewTest::SimulateRectTap(const gfx::Rect& rect) { | 413 void RenderViewTest::SimulateRectTap(const gfx::Rect& rect) { |
| 390 WebGestureEvent gesture_event; | 414 WebGestureEvent gesture_event; |
| 391 gesture_event.x = rect.CenterPoint().x(); | 415 gesture_event.x = rect.CenterPoint().x(); |
| 392 gesture_event.y = rect.CenterPoint().y(); | 416 gesture_event.y = rect.CenterPoint().y(); |
| 393 gesture_event.data.tap.tapCount = 1; | 417 gesture_event.data.tap.tapCount = 1; |
| 394 gesture_event.data.tap.width = rect.width(); | 418 gesture_event.data.tap.width = rect.width(); |
| 395 gesture_event.data.tap.height = rect.height(); | 419 gesture_event.data.tap.height = rect.height(); |
| 396 gesture_event.type = WebInputEvent::GestureTap; | 420 gesture_event.type = WebInputEvent::GestureTap; |
| 397 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 421 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 398 impl->OnMessageReceived( | 422 impl->OnMessageReceived( |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 574 |
| 551 impl->GetMainRenderFrame()->OnNavigate(common_params, StartNavigationParams(), | 575 impl->GetMainRenderFrame()->OnNavigate(common_params, StartNavigationParams(), |
| 552 request_params); | 576 request_params); |
| 553 | 577 |
| 554 // The load actually happens asynchronously, so we pump messages to process | 578 // The load actually happens asynchronously, so we pump messages to process |
| 555 // the pending continuation. | 579 // the pending continuation. |
| 556 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 580 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
| 557 } | 581 } |
| 558 | 582 |
| 559 } // namespace content | 583 } // namespace content |
| OLD | NEW |