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 "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
8 #include "content/public/browser/native_web_keyboard_event.h" | 8 #include "content/public/browser/native_web_keyboard_event.h" |
9 #include "content/public/common/renderer_preferences.h" | 9 #include "content/public/common/renderer_preferences.h" |
10 #include "content/renderer/render_thread_impl.h" | 10 #include "content/renderer/render_thread_impl.h" |
11 #include "content/renderer/render_view_impl.h" | 11 #include "content/renderer/render_view_impl.h" |
12 #include "content/renderer/renderer_main_platform_delegate.h" | 12 #include "content/renderer/renderer_main_platform_delegate.h" |
13 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 13 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
14 #include "content/test/mock_render_process.h" | 14 #include "content/test/mock_render_process.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 24 #include "ui/base/resource/resource_bundle.h" |
24 #include "webkit/dom_storage/dom_storage_types.h" | 25 #include "webkit/dom_storage/dom_storage_types.h" |
25 #include "webkit/glue/glue_serialize.h" | 26 #include "webkit/glue/glue_serialize.h" |
26 #include "webkit/glue/webkit_glue.h" | 27 #include "webkit/glue/webkit_glue.h" |
27 | 28 |
28 using WebKit::WebFrame; | 29 using WebKit::WebFrame; |
29 using WebKit::WebInputEvent; | 30 using WebKit::WebInputEvent; |
30 using WebKit::WebMouseEvent; | 31 using WebKit::WebMouseEvent; |
31 using WebKit::WebScriptController; | 32 using WebKit::WebScriptController; |
32 using WebKit::WebScriptSource; | 33 using WebKit::WebScriptSource; |
33 using WebKit::WebString; | 34 using WebKit::WebString; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 143 |
143 // Setting flags and really doing anything with WebKit is fairly fragile and | 144 // Setting flags and really doing anything with WebKit is fairly fragile and |
144 // hacky, but this is the world we live in... | 145 // hacky, but this is the world we live in... |
145 webkit_glue::SetJavaScriptFlags(" --expose-gc"); | 146 webkit_glue::SetJavaScriptFlags(" --expose-gc"); |
146 WebKit::initialize(webkit_platform_support_.Get()); | 147 WebKit::initialize(webkit_platform_support_.Get()); |
147 | 148 |
148 // Ensure that we register any necessary schemes when initializing WebKit, | 149 // Ensure that we register any necessary schemes when initializing WebKit, |
149 // since we are using a MockRenderThread. | 150 // since we are using a MockRenderThread. |
150 RenderThreadImpl::RegisterSchemes(); | 151 RenderThreadImpl::RegisterSchemes(); |
151 | 152 |
| 153 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
| 154 |
152 mock_process_.reset(new MockRenderProcess); | 155 mock_process_.reset(new MockRenderProcess); |
153 | 156 |
154 // This needs to pass the mock render thread to the view. | 157 // This needs to pass the mock render thread to the view. |
155 RenderViewImpl* view = RenderViewImpl::Create( | 158 RenderViewImpl* view = RenderViewImpl::Create( |
156 0, | 159 0, |
157 kOpenerId, | 160 kOpenerId, |
158 content::RendererPreferences(), | 161 content::RendererPreferences(), |
159 webkit_glue::WebPreferences(), | 162 webkit_glue::WebPreferences(), |
160 new SharedRenderViewCounter(0), | 163 new SharedRenderViewCounter(0), |
161 kRouteId, | 164 kRouteId, |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 361 |
359 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); | 362 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); |
360 OnMessageReceived(navigate_message); | 363 OnMessageReceived(navigate_message); |
361 | 364 |
362 // The load actually happens asynchronously, so we pump messages to process | 365 // The load actually happens asynchronously, so we pump messages to process |
363 // the pending continuation. | 366 // the pending continuation. |
364 ProcessPendingMessages(); | 367 ProcessPendingMessages(); |
365 } | 368 } |
366 | 369 |
367 } // namespace content | 370 } // namespace content |
OLD | NEW |