1 // Copyright 2014 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 CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_
6 #define CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_
8 #include "content/app/mojo/mojo_init.h"
9 #include "content/browser/mojo/mojo_application_host.h"
10 #include "content/common/mojo/mojo_messages.h"
11 #include "ipc/ipc_channel_proxy.h"
12 #include "ipc/mojo/ipc_channel_mojo.h"
13 #include "ipc/mojo/scoped_ipc_support.h"
22 // Helper for RenderThreadImplBrowserTest which takes care of setting up an IPC
23 // server, capable of sending messages to the RenderThread.
24 class RenderThreadImplBrowserIPCTestHelper
{
26 RenderThreadImplBrowserIPCTestHelper();
27 ~RenderThreadImplBrowserIPCTestHelper();
29 IPC::Sender
* Sender() const { return channel_
.get(); }
31 base::MessageLoop
* GetMessageLoop() const { return message_loop_
.get(); }
33 const std::string
& GetChannelId() const { return channel_id_
; }
35 scoped_refptr
<base::SingleThreadTaskRunner
> GetIOTaskRunner() const;
40 void SetupIpcThread();
43 scoped_ptr
<IPC::ChannelProxy
> channel_
;
44 scoped_ptr
<base::Thread
> ipc_thread_
;
45 scoped_ptr
<base::MessageLoopForIO
> message_loop_
;
46 scoped_ptr
<DummyListener
> dummy_listener_
;
47 scoped_ptr
<IPC::ScopedIPCSupport
> ipc_support_
;
48 scoped_ptr
<MojoApplicationHost
> mojo_application_host_
;
49 std::string channel_id_
;
52 } // namespace content
54 #endif // CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_