Upstream the iOS web_shell and supporting code
[chromium-blink-merge.git] / content / test / render_thread_impl_browser_test_ipc_helper.h
blob0d8673202a767c60d43da1c9fec87b09f398e861
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"
15 namespace IPC {
16 class ChannelMojoHost;
17 class ChannelProxy;
18 class Sender;
21 namespace content {
23 // Helper for RenderThreadImplBrowserTest which takes care of setting up an IPC
24 // server, capable of sending messages to the RenderThread.
25 class RenderThreadImplBrowserIPCTestHelper {
26 public:
27 RenderThreadImplBrowserIPCTestHelper();
28 ~RenderThreadImplBrowserIPCTestHelper();
30 IPC::Sender* Sender() const { return channel_.get(); }
32 base::MessageLoop* GetMessageLoop() const { return message_loop_.get(); }
34 const std::string& GetChannelId() const { return channel_id_; }
36 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() const;
38 private:
39 class DummyListener;
41 void SetupIpcThread();
42 void SetupMojo();
44 scoped_ptr<IPC::ChannelProxy> channel_;
45 scoped_ptr<base::Thread> ipc_thread_;
46 scoped_ptr<base::MessageLoopForIO> message_loop_;
47 scoped_ptr<DummyListener> dummy_listener_;
48 scoped_ptr<IPC::ScopedIPCSupport> ipc_support_;
49 scoped_ptr<MojoApplicationHost> mojo_application_host_;
50 scoped_ptr<IPC::ChannelMojoHost> mojo_host_;
51 std::string channel_id_;
54 } // namespace content
56 #endif // CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_