| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "third_party/WebKit/public/web/WebScriptSource.h" | 43 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 44 #include "third_party/WebKit/public/web/WebView.h" | 44 #include "third_party/WebKit/public/web/WebView.h" |
| 45 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
| 46 #include "ui/events/keycodes/keyboard_codes.h" | 46 #include "ui/events/keycodes/keyboard_codes.h" |
| 47 #include "v8/include/v8.h" | 47 #include "v8/include/v8.h" |
| 48 | 48 |
| 49 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
| 50 #include "base/mac/scoped_nsautorelease_pool.h" | 50 #include "base/mac/scoped_nsautorelease_pool.h" |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 #if defined(OS_WIN) |
| 54 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h" |
| 55 #include "content/test/dwrite_font_fake_sender_win.h" |
| 56 #endif |
| 57 |
| 53 using blink::WebGestureEvent; | 58 using blink::WebGestureEvent; |
| 54 using blink::WebInputEvent; | 59 using blink::WebInputEvent; |
| 55 using blink::WebLocalFrame; | 60 using blink::WebLocalFrame; |
| 56 using blink::WebMouseEvent; | 61 using blink::WebMouseEvent; |
| 57 using blink::WebScriptSource; | 62 using blink::WebScriptSource; |
| 58 using blink::WebString; | 63 using blink::WebString; |
| 59 using blink::WebURLRequest; | 64 using blink::WebURLRequest; |
| 60 | 65 |
| 61 namespace { | 66 namespace { |
| 62 | 67 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // because it uses blink internally. | 214 // because it uses blink internally. |
| 210 blink::initialize(blink_platform_impl_.Get()); | 215 blink::initialize(blink_platform_impl_.Get()); |
| 211 | 216 |
| 212 content_client_.reset(CreateContentClient()); | 217 content_client_.reset(CreateContentClient()); |
| 213 content_browser_client_.reset(CreateContentBrowserClient()); | 218 content_browser_client_.reset(CreateContentBrowserClient()); |
| 214 content_renderer_client_.reset(CreateContentRendererClient()); | 219 content_renderer_client_.reset(CreateContentRendererClient()); |
| 215 SetContentClient(content_client_.get()); | 220 SetContentClient(content_client_.get()); |
| 216 SetBrowserClientForTesting(content_browser_client_.get()); | 221 SetBrowserClientForTesting(content_browser_client_.get()); |
| 217 SetRendererClientForTesting(content_renderer_client_.get()); | 222 SetRendererClientForTesting(content_renderer_client_.get()); |
| 218 | 223 |
| 224 #if defined(OS_WIN) |
| 225 // This needs to happen sometime before PlatformInitialize. |
| 226 // This isn't actually necessary for most tests: most tests are able to |
| 227 // connect to their browser process which runs the real proxy host. However, |
| 228 // some tests route IPCs to MockRenderThread, which is unable to process the |
| 229 // font IPCs, causing all font loading to fail. |
| 230 SetDWriteFontProxySenderForTesting(CreateFakeCollectionSender()); |
| 231 #endif |
| 232 |
| 219 // Subclasses can set render_thread_ with their own implementation before | 233 // Subclasses can set render_thread_ with their own implementation before |
| 220 // calling RenderViewTest::SetUp(). | 234 // calling RenderViewTest::SetUp(). |
| 221 if (!render_thread_) | 235 if (!render_thread_) |
| 222 render_thread_.reset(new MockRenderThread()); | 236 render_thread_.reset(new MockRenderThread()); |
| 223 render_thread_->set_routing_id(kRouteId); | 237 render_thread_->set_routing_id(kRouteId); |
| 224 render_thread_->set_new_window_routing_id(kNewWindowRouteId); | 238 render_thread_->set_new_window_routing_id(kNewWindowRouteId); |
| 225 render_thread_->set_new_window_main_frame_widget_routing_id( | 239 render_thread_->set_new_window_main_frame_widget_routing_id( |
| 226 kNewFrameWidgetRouteId); | 240 kNewFrameWidgetRouteId); |
| 227 render_thread_->set_new_frame_routing_id(kNewFrameRouteId); | 241 render_thread_->set_new_frame_routing_id(kNewFrameRouteId); |
| 228 | 242 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 TestRenderFrame* frame = | 637 TestRenderFrame* frame = |
| 624 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 638 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
| 625 frame->Navigate(common_params, StartNavigationParams(), request_params); | 639 frame->Navigate(common_params, StartNavigationParams(), request_params); |
| 626 | 640 |
| 627 // The load actually happens asynchronously, so we pump messages to process | 641 // The load actually happens asynchronously, so we pump messages to process |
| 628 // the pending continuation. | 642 // the pending continuation. |
| 629 FrameLoadWaiter(frame).Wait(); | 643 FrameLoadWaiter(frame).Wait(); |
| 630 } | 644 } |
| 631 | 645 |
| 632 } // namespace content | 646 } // namespace content |
| OLD | NEW |