OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/message_loop/message_loop.h" | |
14 #include "base/pickle.h" | 13 #include "base/pickle.h" |
15 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
16 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
17 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
18 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
19 #include "ipc/ipc_test_base.h" | 18 #include "ipc/ipc_test_base.h" |
20 #include "ipc/ipc_test_channel_listener.h" | 19 #include "ipc/ipc_test_channel_listener.h" |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 TEST_F(IPCChannelTest, ChannelProxyTest) { | 120 TEST_F(IPCChannelTest, ChannelProxyTest) { |
122 Init("GenericClient"); | 121 Init("GenericClient"); |
123 | 122 |
124 base::Thread thread("ChannelProxyTestServer"); | 123 base::Thread thread("ChannelProxyTestServer"); |
125 base::Thread::Options options; | 124 base::Thread::Options options; |
126 options.message_loop_type = base::MessageLoop::TYPE_IO; | 125 options.message_loop_type = base::MessageLoop::TYPE_IO; |
127 thread.StartWithOptions(options); | 126 thread.StartWithOptions(options); |
128 | 127 |
129 // Set up IPC channel proxy. | 128 // Set up IPC channel proxy. |
130 IPC::TestChannelListener listener; | 129 IPC::TestChannelListener listener; |
131 CreateChannelProxy(&listener, thread.message_loop_proxy().get()); | 130 CreateChannelProxy(&listener, thread.task_runner().get()); |
132 listener.Init(sender()); | 131 listener.Init(sender()); |
133 | 132 |
134 ASSERT_TRUE(StartClient()); | 133 ASSERT_TRUE(StartClient()); |
135 | 134 |
136 IPC::TestChannelListener::SendOneMessage(sender(), "hello from parent"); | 135 IPC::TestChannelListener::SendOneMessage(sender(), "hello from parent"); |
137 | 136 |
138 // Run message loop. | 137 // Run message loop. |
139 base::MessageLoop::current()->Run(); | 138 base::MessageLoop::current()->Run(); |
140 | 139 |
141 EXPECT_TRUE(WaitForClientShutdown()); | 140 EXPECT_TRUE(WaitForClientShutdown()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 &listener)); | 194 &listener)); |
196 CHECK(channel->Connect()); | 195 CHECK(channel->Connect()); |
197 listener.Init(channel.get()); | 196 listener.Init(channel.get()); |
198 IPC::TestChannelListener::SendOneMessage(channel.get(), "hello from child"); | 197 IPC::TestChannelListener::SendOneMessage(channel.get(), "hello from child"); |
199 | 198 |
200 base::MessageLoop::current()->Run(); | 199 base::MessageLoop::current()->Run(); |
201 return 0; | 200 return 0; |
202 } | 201 } |
203 | 202 |
204 } // namespace | 203 } // namespace |
OLD | NEW |