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 "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "content/common/dom_storage/dom_storage_types.h" | 8 #include "content/common/dom_storage/dom_storage_types.h" |
9 #include "content/common/frame_messages.h" | 9 #include "content/common/frame_messages.h" |
10 #include "content/common/input_messages.h" | 10 #include "content/common/input_messages.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 33 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
34 #include "third_party/WebKit/public/web/WebScriptSource.h" | 34 #include "third_party/WebKit/public/web/WebScriptSource.h" |
35 #include "third_party/WebKit/public/web/WebView.h" | 35 #include "third_party/WebKit/public/web/WebView.h" |
36 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
37 #include "v8/include/v8.h" | 37 #include "v8/include/v8.h" |
38 | 38 |
39 #if defined(OS_MACOSX) | 39 #if defined(OS_MACOSX) |
40 #include "base/mac/scoped_nsautorelease_pool.h" | 40 #include "base/mac/scoped_nsautorelease_pool.h" |
41 #endif | 41 #endif |
42 | 42 |
43 using blink::WebGestureEvent; | |
43 using blink::WebInputEvent; | 44 using blink::WebInputEvent; |
44 using blink::WebLocalFrame; | 45 using blink::WebLocalFrame; |
45 using blink::WebMouseEvent; | 46 using blink::WebMouseEvent; |
46 using blink::WebScriptSource; | 47 using blink::WebScriptSource; |
47 using blink::WebString; | 48 using blink::WebString; |
48 using blink::WebURLRequest; | 49 using blink::WebURLRequest; |
49 | 50 |
50 namespace { | 51 namespace { |
51 const int32 kOpenerId = -2; | 52 const int32 kOpenerId = -2; |
52 const int32 kRouteId = 5; | 53 const int32 kRouteId = 5; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 mouse_event.y = point.y(); | 335 mouse_event.y = point.y(); |
335 mouse_event.clickCount = 1; | 336 mouse_event.clickCount = 1; |
336 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 337 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
337 impl->OnMessageReceived( | 338 impl->OnMessageReceived( |
338 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); | 339 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); |
339 mouse_event.type = WebInputEvent::MouseUp; | 340 mouse_event.type = WebInputEvent::MouseUp; |
340 impl->OnMessageReceived( | 341 impl->OnMessageReceived( |
341 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); | 342 InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); |
342 } | 343 } |
343 | 344 |
345 void RenderViewTest::SimulateRectTap(const gfx::Rect& rect) { | |
346 WebGestureEvent gesture_event; | |
347 gesture_event.x = rect.CenterPoint().x(); | |
348 gesture_event.y = rect.CenterPoint().y(); | |
349 gesture_event.data.tap.tapCount = 1; | |
350 gesture_event.data.tap.width = rect.width(); | |
351 gesture_event.data.tap.height = rect.height(); | |
352 gesture_event.type = WebInputEvent::GestureTap; | |
353 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | |
354 impl->OnMessageReceived( | |
355 InputMsg_HandleInputEvent(0, &gesture_event, ui::LatencyInfo(), false)); | |
356 impl->FocusChangeComplete(); | |
please use gerrit instead
2015/01/28 22:43:40
I haven't figured out how to trigger FocusChangeCo
| |
357 } | |
358 | |
344 void RenderViewTest::SetFocused(const blink::WebNode& node) { | 359 void RenderViewTest::SetFocused(const blink::WebNode& node) { |
345 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 360 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
346 impl->focusedNodeChanged(blink::WebNode(), node); | 361 impl->focusedNodeChanged(blink::WebNode(), node); |
347 } | 362 } |
348 | 363 |
349 void RenderViewTest::Reload(const GURL& url) { | 364 void RenderViewTest::Reload(const GURL& url) { |
350 FrameMsg_Navigate_Params params; | 365 FrameMsg_Navigate_Params params; |
351 params.common_params.url = url; | 366 params.common_params.url = url; |
352 params.common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; | 367 params.common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; |
353 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 368 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), | 454 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), |
440 navigate_params); | 455 navigate_params); |
441 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); | 456 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); |
442 | 457 |
443 // The load actually happens asynchronously, so we pump messages to process | 458 // The load actually happens asynchronously, so we pump messages to process |
444 // the pending continuation. | 459 // the pending continuation. |
445 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 460 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
446 } | 461 } |
447 | 462 |
448 } // namespace content | 463 } // namespace content |
OLD | NEW |