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_render_view_host.h" | 5 #include "content/browser/renderer_host/test_render_view_host.h" |
6 | 6 |
7 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 7 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
8 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 8 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
9 #include "content/browser/renderer_host/test_backing_store.h" | 9 #include "content/browser/renderer_host/test_backing_store.h" |
10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
11 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
12 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
14 #include "content/public/browser/storage_partition.h" | 14 #include "content/public/browser/storage_partition.h" |
15 #include "content/public/common/content_client.h" | 15 #include "content/public/common/content_client.h" |
16 #include "content/public/common/page_state.h" | 16 #include "content/public/common/page_state.h" |
17 #include "content/public/common/password_form.h" | 17 #include "content/public/common/password_form.h" |
18 #include "content/test/test_web_contents.h" | 18 #include "content/test/test_web_contents.h" |
19 #include "media/base/video_frame.h" | 19 #include "media/base/video_frame.h" |
20 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
21 #include "webkit/common/dom_storage/dom_storage_types.h" | 21 #include "webkit/common/dom_storage/dom_storage_types.h" |
22 #include "webkit/common/webpreferences.h" | 22 #include "webkit/common/webpreferences.h" |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 namespace { | 26 namespace { |
27 // Normally this is done by the NavigationController, but we'll fake it out | |
28 // here for testing. | |
29 SessionStorageNamespaceImpl* CreateSessionStorageNamespace( | |
30 SiteInstance* instance) { | |
31 RenderProcessHost* process_host = instance->GetProcess(); | |
32 DOMStorageContext* dom_storage_context = | |
33 BrowserContext::GetStoragePartition(process_host->GetBrowserContext(), | |
34 instance)->GetDOMStorageContext(); | |
35 return new SessionStorageNamespaceImpl( | |
36 static_cast<DOMStorageContextImpl*>(dom_storage_context)); | |
37 } | |
38 | 27 |
39 const int64 kFrameId = 13UL; | 28 const int64 kFrameId = 13UL; |
40 | 29 |
41 } // namespace | 30 } // namespace |
42 | 31 |
43 | 32 |
44 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, | 33 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, |
45 int page_id, | 34 int page_id, |
46 const GURL& url, | 35 const GURL& url, |
47 PageTransition transition) { | 36 PageTransition transition) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 RenderViewHostDelegate* delegate, | 240 RenderViewHostDelegate* delegate, |
252 RenderWidgetHostDelegate* widget_delegate, | 241 RenderWidgetHostDelegate* widget_delegate, |
253 int routing_id, | 242 int routing_id, |
254 int main_frame_routing_id, | 243 int main_frame_routing_id, |
255 bool swapped_out) | 244 bool swapped_out) |
256 : RenderViewHostImpl(instance, | 245 : RenderViewHostImpl(instance, |
257 delegate, | 246 delegate, |
258 widget_delegate, | 247 widget_delegate, |
259 routing_id, | 248 routing_id, |
260 main_frame_routing_id, | 249 main_frame_routing_id, |
261 swapped_out, | 250 swapped_out), |
262 CreateSessionStorageNamespace(instance)), | |
263 render_view_created_(false), | 251 render_view_created_(false), |
264 delete_counter_(NULL), | 252 delete_counter_(NULL), |
265 simulate_fetch_via_proxy_(false), | 253 simulate_fetch_via_proxy_(false), |
266 simulate_history_list_was_cleared_(false), | 254 simulate_history_list_was_cleared_(false), |
267 contents_mime_type_("text/html") { | 255 contents_mime_type_("text/html") { |
268 // TestRenderWidgetHostView installs itself into this->view_ in its | 256 // TestRenderWidgetHostView installs itself into this->view_ in its |
269 // constructor, and deletes itself when TestRenderWidgetHostView::Destroy() is | 257 // constructor, and deletes itself when TestRenderWidgetHostView::Destroy() is |
270 // called. | 258 // called. |
271 new TestRenderWidgetHostView(this); | 259 new TestRenderWidgetHostView(this); |
272 | 260 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 413 |
426 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { | 414 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { |
427 return static_cast<TestRenderViewHost*>(active_rvh()); | 415 return static_cast<TestRenderViewHost*>(active_rvh()); |
428 } | 416 } |
429 | 417 |
430 TestWebContents* RenderViewHostImplTestHarness::contents() { | 418 TestWebContents* RenderViewHostImplTestHarness::contents() { |
431 return static_cast<TestWebContents*>(web_contents()); | 419 return static_cast<TestWebContents*>(web_contents()); |
432 } | 420 } |
433 | 421 |
434 } // namespace content | 422 } // namespace content |
OLD | NEW |