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/browser/renderer_host/test_backing_store.h" | 5 #include "content/browser/renderer_host/test_backing_store.h" |
| 6 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 7 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
6 #include "content/browser/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
7 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
8 #include "content/browser/web_contents/navigation_controller_impl.h" | 10 #include "content/browser/web_contents/navigation_controller_impl.h" |
9 #include "content/browser/web_contents/test_web_contents.h" | 11 #include "content/browser/web_contents/test_web_contents.h" |
10 #include "content/common/view_messages.h" | 12 #include "content/common/view_messages.h" |
| 13 #include "content/public/browser/browser_context.h" |
11 #include "content/public/browser/navigation_controller.h" | 14 #include "content/public/browser/navigation_controller.h" |
12 #include "content/public/common/content_client.h" | 15 #include "content/public/common/content_client.h" |
13 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
14 #include "webkit/dom_storage/dom_storage_types.h" | 17 #include "webkit/dom_storage/dom_storage_types.h" |
15 #include "webkit/forms/password_form.h" | 18 #include "webkit/forms/password_form.h" |
16 #include "webkit/glue/webkit_glue.h" | 19 #include "webkit/glue/webkit_glue.h" |
17 #include "webkit/glue/webpreferences.h" | 20 #include "webkit/glue/webpreferences.h" |
18 | 21 |
19 using content::NativeWebKeyboardEvent; | 22 using content::NativeWebKeyboardEvent; |
20 using webkit::forms::PasswordForm; | 23 using webkit::forms::PasswordForm; |
21 | 24 |
22 namespace content { | 25 namespace content { |
23 | 26 |
| 27 namespace { |
| 28 // Normally this is done by the NavigationController, but we'll fake it out |
| 29 // here for testing. |
| 30 SessionStorageNamespaceImpl* CreateSessionStorageNamespace( |
| 31 SiteInstance* instance) { |
| 32 RenderProcessHost* process_host = instance->GetProcess(); |
| 33 DOMStorageContext* dom_storage_context = |
| 34 BrowserContext::GetDOMStorageContext(process_host->GetBrowserContext(), |
| 35 process_host->GetID()); |
| 36 return new SessionStorageNamespaceImpl( |
| 37 static_cast<DOMStorageContextImpl*>(dom_storage_context)); |
| 38 } |
| 39 } // namespace |
| 40 |
| 41 |
24 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, | 42 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, |
25 int page_id, | 43 int page_id, |
26 const GURL& url, | 44 const GURL& url, |
27 PageTransition transition) { | 45 PageTransition transition) { |
28 params->page_id = page_id; | 46 params->page_id = page_id; |
29 params->url = url; | 47 params->url = url; |
30 params->referrer = Referrer(); | 48 params->referrer = Referrer(); |
31 params->transition = transition; | 49 params->transition = transition; |
32 params->redirects = std::vector<GURL>(); | 50 params->redirects = std::vector<GURL>(); |
33 params->should_update_history = false; | 51 params->should_update_history = false; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 SiteInstance* instance, | 246 SiteInstance* instance, |
229 RenderViewHostDelegate* delegate, | 247 RenderViewHostDelegate* delegate, |
230 RenderWidgetHostDelegate* widget_delegate, | 248 RenderWidgetHostDelegate* widget_delegate, |
231 int routing_id, | 249 int routing_id, |
232 bool swapped_out) | 250 bool swapped_out) |
233 : RenderViewHostImpl(instance, | 251 : RenderViewHostImpl(instance, |
234 delegate, | 252 delegate, |
235 widget_delegate, | 253 widget_delegate, |
236 routing_id, | 254 routing_id, |
237 swapped_out, | 255 swapped_out, |
238 NULL), | 256 CreateSessionStorageNamespace(instance)), |
239 render_view_created_(false), | 257 render_view_created_(false), |
240 delete_counter_(NULL), | 258 delete_counter_(NULL), |
241 simulate_fetch_via_proxy_(false), | 259 simulate_fetch_via_proxy_(false), |
242 contents_mime_type_("text/html") { | 260 contents_mime_type_("text/html") { |
243 // For normal RenderViewHosts, this is freed when |Shutdown()| is | 261 // For normal RenderViewHosts, this is freed when |Shutdown()| is |
244 // called. For TestRenderViewHost, the view is explicitly | 262 // called. For TestRenderViewHost, the view is explicitly |
245 // deleted in the destructor below, because | 263 // deleted in the destructor below, because |
246 // TestRenderWidgetHostView::Destroy() doesn't |delete this|. | 264 // TestRenderWidgetHostView::Destroy() doesn't |delete this|. |
247 SetView(new TestRenderWidgetHostView(this)); | 265 SetView(new TestRenderWidgetHostView(this)); |
248 } | 266 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 382 |
365 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { | 383 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { |
366 return static_cast<TestRenderViewHost*>(active_rvh()); | 384 return static_cast<TestRenderViewHost*>(active_rvh()); |
367 } | 385 } |
368 | 386 |
369 TestWebContents* RenderViewHostImplTestHarness::contents() { | 387 TestWebContents* RenderViewHostImplTestHarness::contents() { |
370 return static_cast<TestWebContents*>(web_contents()); | 388 return static_cast<TestWebContents*>(web_contents()); |
371 } | 389 } |
372 | 390 |
373 } // namespace content | 391 } // namespace content |
OLD | NEW |