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/test/test_renderer_host.h" | 5 #include "content/test/test_renderer_host.h" |
6 | 6 |
7 #include "content/browser/renderer_host/render_view_host_factory.h" | 7 #include "content/browser/renderer_host/render_view_host_factory.h" |
8 #include "content/browser/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
9 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
10 #include "content/browser/web_contents/navigation_entry_impl.h" | 10 #include "content/browser/web_contents/navigation_entry_impl.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 explicit TestRenderViewHostFactory( | 37 explicit TestRenderViewHostFactory( |
38 content::RenderProcessHostFactory* rph_factory); | 38 content::RenderProcessHostFactory* rph_factory); |
39 virtual ~TestRenderViewHostFactory(); | 39 virtual ~TestRenderViewHostFactory(); |
40 | 40 |
41 virtual void set_render_process_host_factory( | 41 virtual void set_render_process_host_factory( |
42 content::RenderProcessHostFactory* rph_factory); | 42 content::RenderProcessHostFactory* rph_factory); |
43 virtual content::RenderViewHost* CreateRenderViewHost( | 43 virtual content::RenderViewHost* CreateRenderViewHost( |
44 content::SiteInstance* instance, | 44 content::SiteInstance* instance, |
45 content::RenderViewHostDelegate* delegate, | 45 content::RenderViewHostDelegate* delegate, |
46 int routing_id, | 46 int routing_id, |
| 47 bool swapped_out, |
47 content::SessionStorageNamespace* session_storage) OVERRIDE; | 48 content::SessionStorageNamespace* session_storage) OVERRIDE; |
48 | 49 |
49 private: | 50 private: |
50 // This is a bit of a hack. With the current design of the site instances / | 51 // This is a bit of a hack. With the current design of the site instances / |
51 // browsing instances, it's difficult to pass a RenderProcessHostFactory | 52 // browsing instances, it's difficult to pass a RenderProcessHostFactory |
52 // around properly. | 53 // around properly. |
53 // | 54 // |
54 // Instead, we set it right before we create a new RenderViewHost, which | 55 // Instead, we set it right before we create a new RenderViewHost, which |
55 // happens before the RenderProcessHost is created. This way, the instance | 56 // happens before the RenderProcessHost is created. This way, the instance |
56 // has the correct factory and creates our special RenderProcessHosts. | 57 // has the correct factory and creates our special RenderProcessHosts. |
(...skipping 14 matching lines...) Expand all Loading... |
71 | 72 |
72 void TestRenderViewHostFactory::set_render_process_host_factory( | 73 void TestRenderViewHostFactory::set_render_process_host_factory( |
73 content::RenderProcessHostFactory* rph_factory) { | 74 content::RenderProcessHostFactory* rph_factory) { |
74 render_process_host_factory_ = rph_factory; | 75 render_process_host_factory_ = rph_factory; |
75 } | 76 } |
76 | 77 |
77 content::RenderViewHost* TestRenderViewHostFactory::CreateRenderViewHost( | 78 content::RenderViewHost* TestRenderViewHostFactory::CreateRenderViewHost( |
78 SiteInstance* instance, | 79 SiteInstance* instance, |
79 RenderViewHostDelegate* delegate, | 80 RenderViewHostDelegate* delegate, |
80 int routing_id, | 81 int routing_id, |
| 82 bool swapped_out, |
81 SessionStorageNamespace* session_storage) { | 83 SessionStorageNamespace* session_storage) { |
82 // See declaration of render_process_host_factory_ below. | 84 // See declaration of render_process_host_factory_ below. |
83 static_cast<SiteInstanceImpl*>(instance)-> | 85 static_cast<SiteInstanceImpl*>(instance)-> |
84 set_render_process_host_factory(render_process_host_factory_); | 86 set_render_process_host_factory(render_process_host_factory_); |
85 return new TestRenderViewHost(instance, delegate, routing_id); | 87 return new TestRenderViewHost(instance, delegate, routing_id, swapped_out); |
86 } | 88 } |
87 | 89 |
88 // static | 90 // static |
89 RenderViewHostTester* RenderViewHostTester::For(RenderViewHost* host) { | 91 RenderViewHostTester* RenderViewHostTester::For(RenderViewHost* host) { |
90 return static_cast<TestRenderViewHost*>(host); | 92 return static_cast<TestRenderViewHost*>(host); |
91 } | 93 } |
92 | 94 |
93 // static | 95 // static |
94 void RenderViewHostTester::EnableAccessibilityUpdatedNotifications( | 96 void RenderViewHostTester::EnableAccessibilityUpdatedNotifications( |
95 RenderViewHost* host) { | 97 RenderViewHost* host) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 219 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
218 message_loop_.RunAllPending(); | 220 message_loop_.RunAllPending(); |
219 } | 221 } |
220 | 222 |
221 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 223 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
222 RenderProcessHostFactory* factory) { | 224 RenderProcessHostFactory* factory) { |
223 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 225 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
224 } | 226 } |
225 | 227 |
226 } // namespace content | 228 } // namespace content |
OLD | NEW |