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
3 // found in the LICENSE file.
5 #include "content/test/test_render_view_host_factory.h"
7 #include "content/browser/renderer_host/test_render_view_host.h"
8 #include "content/browser/site_instance_impl.h"
9 #include "content/public/browser/render_process_host_factory.h"
13 TestRenderViewHostFactory::TestRenderViewHostFactory(
14 RenderProcessHostFactory
* rph_factory
)
15 : render_process_host_factory_(rph_factory
) {
16 RenderViewHostFactory::RegisterFactory(this);
19 TestRenderViewHostFactory::~TestRenderViewHostFactory() {
20 RenderViewHostFactory::UnregisterFactory();
23 void TestRenderViewHostFactory::set_render_process_host_factory(
24 RenderProcessHostFactory
* rph_factory
) {
25 render_process_host_factory_
= rph_factory
;
28 RenderViewHost
* TestRenderViewHostFactory::CreateRenderViewHost(
29 SiteInstance
* instance
,
30 RenderViewHostDelegate
* delegate
,
31 RenderWidgetHostDelegate
* widget_delegate
,
34 SessionStorageNamespace
* session_storage
) {
35 // See declaration of render_process_host_factory_ below.
36 static_cast<SiteInstanceImpl
*>(instance
)->
37 set_render_process_host_factory(render_process_host_factory_
);
38 return new TestRenderViewHost(
39 instance
, delegate
, widget_delegate
, routing_id
, swapped_out
);
42 } // namespace content