OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_ | 5 #ifndef CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_ |
6 #define CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_ | 6 #define CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_ |
7 | 7 |
8 #include "content/app/mojo/mojo_init.h" | 8 #include "content/app/mojo/mojo_init.h" |
9 #include "content/browser/mojo/mojo_application_host.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" | 10 #include "ipc/ipc_channel_proxy.h" |
12 #include "ipc/mojo/ipc_channel_mojo.h" | 11 #include "ipc/mojo/ipc_channel_mojo.h" |
13 #include "ipc/mojo/scoped_ipc_support.h" | 12 #include "ipc/mojo/scoped_ipc_support.h" |
14 | 13 |
15 namespace IPC { | 14 namespace IPC { |
16 class ChannelProxy; | 15 class ChannelProxy; |
17 class Sender; | 16 class Sender; |
18 }; | 17 }; |
19 | 18 |
20 namespace content { | 19 namespace content { |
21 | 20 |
22 // Helper for RenderThreadImplBrowserTest which takes care of setting up an IPC | 21 // Helper for RenderThreadImplBrowserTest which takes care of setting up an IPC |
23 // server, capable of sending messages to the RenderThread. | 22 // server, capable of sending messages to the RenderThread. |
24 class RenderThreadImplBrowserIPCTestHelper { | 23 class RenderThreadImplBrowserIPCTestHelper { |
25 public: | 24 public: |
26 RenderThreadImplBrowserIPCTestHelper(); | 25 RenderThreadImplBrowserIPCTestHelper(); |
27 ~RenderThreadImplBrowserIPCTestHelper(); | 26 ~RenderThreadImplBrowserIPCTestHelper(); |
28 | 27 |
29 IPC::Sender* Sender() const { return channel_.get(); } | 28 IPC::Sender* Sender() const { return channel_.get(); } |
30 | 29 |
31 base::MessageLoop* GetMessageLoop() const { return message_loop_.get(); } | 30 base::MessageLoop* GetMessageLoop() const { return message_loop_.get(); } |
32 | 31 |
33 const std::string& GetChannelId() const { return channel_id_; } | 32 const std::string& GetChannelId() const { return channel_id_; } |
34 | 33 |
35 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() const; | 34 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() const; |
36 | 35 |
37 mojo::MessagePipeHandle GetMessagePipeHandle() { | 36 const std::string& GetMojoIpcToken() const { |
38 return message_pipe_handle_.release(); | 37 return mojo_ipc_token_; |
| 38 } |
| 39 |
| 40 const std::string& GetMojoApplicationToken() const { |
| 41 return mojo_application_token_; |
39 } | 42 } |
40 | 43 |
41 private: | 44 private: |
42 class DummyListener; | 45 class DummyListener; |
43 | 46 |
44 void SetupIpcThread(); | 47 void SetupIpcThread(); |
45 void SetupMojo(); | 48 void SetupMojo(); |
46 | 49 |
47 std::unique_ptr<IPC::ChannelProxy> channel_; | 50 std::unique_ptr<IPC::ChannelProxy> channel_; |
48 std::unique_ptr<base::Thread> ipc_thread_; | 51 std::unique_ptr<base::Thread> ipc_thread_; |
49 std::unique_ptr<base::MessageLoopForIO> message_loop_; | 52 std::unique_ptr<base::MessageLoopForIO> message_loop_; |
50 std::unique_ptr<DummyListener> dummy_listener_; | 53 std::unique_ptr<DummyListener> dummy_listener_; |
51 std::unique_ptr<IPC::ScopedIPCSupport> ipc_support_; | 54 std::unique_ptr<IPC::ScopedIPCSupport> ipc_support_; |
52 std::unique_ptr<MojoApplicationHost> mojo_application_host_; | 55 std::unique_ptr<MojoApplicationHost> mojo_application_host_; |
53 mojo::ScopedMessagePipeHandle message_pipe_handle_; | 56 std::string mojo_ipc_token_; |
| 57 std::string mojo_application_token_; |
54 std::string channel_id_; | 58 std::string channel_id_; |
55 }; | 59 }; |
56 | 60 |
57 } // namespace content | 61 } // namespace content |
58 | 62 |
59 #endif // CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_ | 63 #endif // CONTENT_TEST_RENDER_THREAD_IMPL_BROWSER_TEST_IPC_HELPER_H_ |
OLD | NEW |