Do not define POSIX.
[chromium-blink-merge.git] / chrome / renderer / chrome_mock_render_thread.cc
blob61b68c0537bb0dde47082210f3d4b58acd3e73ac
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"
11 #endif
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))
31 return true;
33 // Some messages we do special handling.
34 #if defined(ENABLE_EXTENSIONS)
35 bool handled = true;
36 IPC_BEGIN_MESSAGE_MAP(ChromeMockRenderThread, msg)
37 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension,
38 OnOpenChannelToExtension)
39 IPC_MESSAGE_UNHANDLED(handled = false)
40 IPC_END_MESSAGE_MAP()
41 return handled;
42 #else
43 return false;
44 #endif
47 #if defined(ENABLE_EXTENSIONS)
48 void ChromeMockRenderThread::OnOpenChannelToExtension(
49 int routing_id,
50 const ExtensionMsg_ExternalConnectionInfo& info,
51 const std::string& channel_name,
52 bool include_tls_channel_id,
53 int* port_id) {
54 *port_id = 0;
56 #endif