1 // Copyright (c) 2011 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 #ifndef CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_
6 #define CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_
10 #include "content/public/test/mock_render_thread.h"
12 struct ExtensionMsg_ExternalConnectionInfo
;
14 // Extends content::MockRenderThread to know about extension messages.
15 class ChromeMockRenderThread
: public content::MockRenderThread
{
17 ChromeMockRenderThread();
18 ~ChromeMockRenderThread() override
;
20 // content::RenderThread overrides.
21 scoped_refptr
<base::SingleThreadTaskRunner
> GetIOMessageLoopProxy() override
;
23 //////////////////////////////////////////////////////////////////////////
24 // The following functions are called by the test itself.
26 // Set IO message loop proxy.
27 void set_io_message_loop_proxy(
28 const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
);
31 // Overrides base class implementation to add custom handling for
32 // print and extensions.
33 bool OnMessageReceived(const IPC::Message
& msg
) override
;
35 #if defined(ENABLE_EXTENSIONS)
36 // The callee expects to be returned a valid channel_id.
37 void OnOpenChannelToExtension(int routing_id
,
38 const ExtensionMsg_ExternalConnectionInfo
& info
,
39 const std::string
& channel_name
,
40 bool include_tls_channel_id
,
44 scoped_refptr
<base::SingleThreadTaskRunner
> io_task_runner_
;
46 DISALLOW_COPY_AND_ASSIGN(ChromeMockRenderThread
);
49 #endif // CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_