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 "chrome/renderer/chrome_mock_render_thread.h"
7 #include "base/single_thread_task_runner.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 #if defined(ENABLE_EXTENSIONS)
11 #include "extensions/common/extension_messages.h"
14 ChromeMockRenderThread::ChromeMockRenderThread() {
17 ChromeMockRenderThread::~ChromeMockRenderThread() {
20 scoped_refptr
<base::SingleThreadTaskRunner
>
21 ChromeMockRenderThread::GetIOMessageLoopProxy() {
22 return io_task_runner_
;
25 void ChromeMockRenderThread::set_io_message_loop_proxy(
26 const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
) {
27 io_task_runner_
= task_runner
;
30 bool ChromeMockRenderThread::OnMessageReceived(const IPC::Message
& msg
) {
31 if (content::MockRenderThread::OnMessageReceived(msg
))
34 // Some messages we do special handling.
35 #if defined(ENABLE_EXTENSIONS)
37 IPC_BEGIN_MESSAGE_MAP(ChromeMockRenderThread
, msg
)
38 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension
,
39 OnOpenChannelToExtension
)
40 IPC_MESSAGE_UNHANDLED(handled
= false)
48 #if defined(ENABLE_EXTENSIONS)
49 void ChromeMockRenderThread::OnOpenChannelToExtension(
51 const ExtensionMsg_ExternalConnectionInfo
& info
,
52 const std::string
& channel_name
,
53 bool include_tls_channel_id
,