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 "testing/gtest/include/gtest/gtest.h"
9 #if defined(ENABLE_EXTENSIONS)
10 #include "extensions/common/extension_messages.h"
13 ChromeMockRenderThread::ChromeMockRenderThread() {
16 ChromeMockRenderThread::~ChromeMockRenderThread() {
19 scoped_refptr
<base::MessageLoopProxy
>
20 ChromeMockRenderThread::GetIOMessageLoopProxy() {
21 return io_message_loop_proxy_
;
24 void ChromeMockRenderThread::set_io_message_loop_proxy(
25 const scoped_refptr
<base::MessageLoopProxy
>& proxy
) {
26 io_message_loop_proxy_
= proxy
;
29 bool ChromeMockRenderThread::OnMessageReceived(const IPC::Message
& msg
) {
30 if (content::MockRenderThread::OnMessageReceived(msg
))
33 // Some messages we do special handling.
34 #if defined(ENABLE_EXTENSIONS)
36 IPC_BEGIN_MESSAGE_MAP(ChromeMockRenderThread
, msg
)
37 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension
,
38 OnOpenChannelToExtension
)
39 IPC_MESSAGE_UNHANDLED(handled
= false)
47 #if defined(ENABLE_EXTENSIONS)
48 void ChromeMockRenderThread::OnOpenChannelToExtension(
50 const ExtensionMsg_ExternalConnectionInfo
& info
,
51 const std::string
& channel_name
,
52 bool include_tls_channel_id
,