[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 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. |
| 4 | |
| 5 | #include "ipc/mojo/ipc_channel_mojo.h" |
| 6 | |
| 7 | #include "base/base_paths.h" |
| 8 | #include "base/files/file.h" |
| 9 | #include "base/message_loop/message_loop.h" |
| 10 | #include "base/path_service.h" |
| 11 | #include "base/pickle.h" |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 12 | #include "base/run_loop.h" |
morrita | 0bd20bd | 2015-02-25 20:11:27 | [diff] [blame] | 13 | #include "base/test/test_timeouts.h" |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 14 | #include "base/threading/thread.h" |
| 15 | #include "ipc/ipc_message.h" |
| 16 | #include "ipc/ipc_test_base.h" |
| 17 | #include "ipc/ipc_test_channel_listener.h" |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 18 | #include "ipc/mojo/ipc_channel_mojo_host.h" |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 19 | #include "ipc/mojo/ipc_mojo_handle_attachment.h" |
| 20 | #include "ipc/mojo/ipc_mojo_message_helper.h" |
morrita | 438a2ee | 2015-04-03 05:28:21 | [diff] [blame^] | 21 | #include "ipc/mojo/ipc_mojo_param_traits.h" |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 22 | #include "ipc/mojo/scoped_ipc_support.h" |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 23 | |
| 24 | #if defined(OS_POSIX) |
| 25 | #include "base/file_descriptor_posix.h" |
morrita | 1aa788c | 2015-01-31 05:45:42 | [diff] [blame] | 26 | #include "ipc/ipc_platform_file_attachment_posix.h" |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 27 | #endif |
| 28 | |
| 29 | namespace { |
| 30 | |
| 31 | class ListenerThatExpectsOK : public IPC::Listener { |
| 32 | public: |
[email protected] | e5c2775 | 2014-08-08 21:45:13 | [diff] [blame] | 33 | ListenerThatExpectsOK() |
| 34 | : received_ok_(false) {} |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 35 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 36 | ~ListenerThatExpectsOK() override {} |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 37 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 38 | bool OnMessageReceived(const IPC::Message& message) override { |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 39 | PickleIterator iter(message); |
| 40 | std::string should_be_ok; |
| 41 | EXPECT_TRUE(iter.ReadString(&should_be_ok)); |
| 42 | EXPECT_EQ(should_be_ok, "OK"); |
[email protected] | e5c2775 | 2014-08-08 21:45:13 | [diff] [blame] | 43 | received_ok_ = true; |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 44 | base::MessageLoop::current()->Quit(); |
| 45 | return true; |
| 46 | } |
| 47 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 48 | void OnChannelError() override { |
[email protected] | e5c2775 | 2014-08-08 21:45:13 | [diff] [blame] | 49 | // The connection should be healthy while the listener is waiting |
| 50 | // message. An error can occur after that because the peer |
| 51 | // process dies. |
| 52 | DCHECK(received_ok_); |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | static void SendOK(IPC::Sender* sender) { |
| 56 | IPC::Message* message = new IPC::Message( |
| 57 | 0, 2, IPC::Message::PRIORITY_NORMAL); |
| 58 | message->WriteString(std::string("OK")); |
| 59 | ASSERT_TRUE(sender->Send(message)); |
| 60 | } |
[email protected] | e5c2775 | 2014-08-08 21:45:13 | [diff] [blame] | 61 | |
| 62 | private: |
| 63 | bool received_ok_; |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 64 | }; |
| 65 | |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 66 | class ChannelClient { |
| 67 | public: |
| 68 | explicit ChannelClient(IPC::Listener* listener, const char* name) { |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 69 | ipc_support_.reset( |
| 70 | new IPC::ScopedIPCSupport(main_message_loop_.task_runner())); |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 71 | channel_ = IPC::ChannelMojo::Create(NULL, |
| 72 | IPCTestBase::GetChannelName(name), |
| 73 | IPC::Channel::MODE_CLIENT, |
| 74 | listener); |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void Connect() { |
| 78 | CHECK(channel_->Connect()); |
| 79 | } |
| 80 | |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 81 | void Close() { |
| 82 | channel_->Close(); |
| 83 | |
| 84 | base::RunLoop run_loop; |
| 85 | base::MessageLoop::current()->PostTask(FROM_HERE, run_loop.QuitClosure()); |
| 86 | run_loop.Run(); |
| 87 | } |
| 88 | |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 89 | IPC::ChannelMojo* channel() const { return channel_.get(); } |
| 90 | |
| 91 | private: |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 92 | base::MessageLoopForIO main_message_loop_; |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 93 | scoped_ptr<IPC::ScopedIPCSupport> ipc_support_; |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 94 | scoped_ptr<IPC::ChannelMojo> channel_; |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 95 | }; |
| 96 | |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 97 | class IPCChannelMojoTestBase : public IPCTestBase { |
| 98 | public: |
| 99 | void InitWithMojo(const std::string& test_client_name) { |
| 100 | Init(test_client_name); |
| 101 | ipc_support_.reset(new IPC::ScopedIPCSupport(task_runner())); |
| 102 | } |
| 103 | |
| 104 | void TearDown() override { |
| 105 | // Make sure Mojo IPC support is properly shutdown on the I/O loop before |
| 106 | // TearDown continues. |
| 107 | ipc_support_.reset(); |
| 108 | base::RunLoop run_loop; |
| 109 | task_runner()->PostTask(FROM_HERE, run_loop.QuitClosure()); |
| 110 | run_loop.Run(); |
| 111 | |
| 112 | IPCTestBase::TearDown(); |
| 113 | } |
| 114 | |
| 115 | private: |
| 116 | scoped_ptr<IPC::ScopedIPCSupport> ipc_support_; |
| 117 | }; |
| 118 | |
| 119 | class IPCChannelMojoTest : public IPCChannelMojoTestBase { |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 120 | protected: |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 121 | scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( |
morrita | 373af03b | 2014-09-09 19:35:24 | [diff] [blame] | 122 | const IPC::ChannelHandle& handle, |
morrita | c4db547 | 2015-03-13 20:44:39 | [diff] [blame] | 123 | base::SequencedTaskRunner* runner) override { |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 124 | host_.reset(new IPC::ChannelMojoHost(task_runner())); |
morrita | e9453ea | 2014-09-26 03:20:48 | [diff] [blame] | 125 | return IPC::ChannelMojo::CreateServerFactory(host_->channel_delegate(), |
| 126 | handle); |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 127 | } |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 128 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 129 | bool DidStartClient() override { |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 130 | bool ok = IPCTestBase::DidStartClient(); |
| 131 | DCHECK(ok); |
rvargas | 07b589c | 2015-01-12 22:23:23 | [diff] [blame] | 132 | host_->OnClientLaunched(client_process().Handle()); |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 133 | return ok; |
| 134 | } |
| 135 | |
| 136 | private: |
| 137 | scoped_ptr<IPC::ChannelMojoHost> host_; |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 138 | }; |
| 139 | |
| 140 | |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 141 | class TestChannelListenerWithExtraExpectations |
| 142 | : public IPC::TestChannelListener { |
| 143 | public: |
| 144 | TestChannelListenerWithExtraExpectations() |
| 145 | : is_connected_called_(false) { |
| 146 | } |
| 147 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 148 | void OnChannelConnected(int32 peer_pid) override { |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 149 | IPC::TestChannelListener::OnChannelConnected(peer_pid); |
| 150 | EXPECT_TRUE(base::kNullProcessId != peer_pid); |
| 151 | is_connected_called_ = true; |
| 152 | } |
| 153 | |
| 154 | bool is_connected_called() const { return is_connected_called_; } |
| 155 | |
| 156 | private: |
| 157 | bool is_connected_called_; |
| 158 | }; |
| 159 | |
| 160 | TEST_F(IPCChannelMojoTest, ConnectedFromClient) { |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 161 | InitWithMojo("IPCChannelMojoTestClient"); |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 162 | |
| 163 | // Set up IPC channel and start client. |
| 164 | TestChannelListenerWithExtraExpectations listener; |
morrita | 373af03b | 2014-09-09 19:35:24 | [diff] [blame] | 165 | CreateChannel(&listener); |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 166 | listener.Init(sender()); |
| 167 | ASSERT_TRUE(ConnectChannel()); |
| 168 | ASSERT_TRUE(StartClient()); |
| 169 | |
| 170 | IPC::TestChannelListener::SendOneMessage( |
| 171 | sender(), "hello from parent"); |
| 172 | |
| 173 | base::MessageLoop::current()->Run(); |
| 174 | EXPECT_TRUE(base::kNullProcessId != this->channel()->GetPeerPID()); |
| 175 | |
| 176 | this->channel()->Close(); |
| 177 | |
| 178 | EXPECT_TRUE(WaitForClientShutdown()); |
| 179 | EXPECT_TRUE(listener.is_connected_called()); |
| 180 | EXPECT_TRUE(listener.HasSentAll()); |
| 181 | |
| 182 | DestroyChannel(); |
| 183 | } |
| 184 | |
| 185 | // A long running process that connects to us |
| 186 | MULTIPROCESS_IPC_TEST_CLIENT_MAIN(IPCChannelMojoTestClient) { |
| 187 | TestChannelListenerWithExtraExpectations listener; |
| 188 | ChannelClient client(&listener, "IPCChannelMojoTestClient"); |
| 189 | client.Connect(); |
| 190 | listener.Init(client.channel()); |
| 191 | |
| 192 | IPC::TestChannelListener::SendOneMessage( |
| 193 | client.channel(), "hello from child"); |
| 194 | base::MessageLoop::current()->Run(); |
| 195 | EXPECT_TRUE(listener.is_connected_called()); |
| 196 | EXPECT_TRUE(listener.HasSentAll()); |
| 197 | |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 198 | client.Close(); |
| 199 | |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 200 | return 0; |
| 201 | } |
| 202 | |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 203 | class ListenerExpectingErrors : public IPC::Listener { |
| 204 | public: |
| 205 | ListenerExpectingErrors() |
| 206 | : has_error_(false) { |
| 207 | } |
| 208 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 209 | void OnChannelConnected(int32 peer_pid) override { |
morrita | be6c4cc | 2014-09-24 23:38:44 | [diff] [blame] | 210 | base::MessageLoop::current()->Quit(); |
| 211 | } |
| 212 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 213 | bool OnMessageReceived(const IPC::Message& message) override { return true; } |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 214 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 215 | void OnChannelError() override { |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 216 | has_error_ = true; |
| 217 | base::MessageLoop::current()->Quit(); |
| 218 | } |
| 219 | |
| 220 | bool has_error() const { return has_error_; } |
| 221 | |
| 222 | private: |
| 223 | bool has_error_; |
| 224 | }; |
| 225 | |
| 226 | |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 227 | class IPCChannelMojoErrorTest : public IPCChannelMojoTestBase { |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 228 | protected: |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 229 | scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 230 | const IPC::ChannelHandle& handle, |
morrita | c4db547 | 2015-03-13 20:44:39 | [diff] [blame] | 231 | base::SequencedTaskRunner* runner) override { |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 232 | host_.reset(new IPC::ChannelMojoHost(task_runner())); |
morrita | e9453ea | 2014-09-26 03:20:48 | [diff] [blame] | 233 | return IPC::ChannelMojo::CreateServerFactory(host_->channel_delegate(), |
| 234 | handle); |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 235 | } |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 236 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 237 | bool DidStartClient() override { |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 238 | bool ok = IPCTestBase::DidStartClient(); |
| 239 | DCHECK(ok); |
rvargas | 07b589c | 2015-01-12 22:23:23 | [diff] [blame] | 240 | host_->OnClientLaunched(client_process().Handle()); |
morrita | 54f6f80c | 2014-09-23 21:16:00 | [diff] [blame] | 241 | return ok; |
| 242 | } |
| 243 | |
| 244 | private: |
| 245 | scoped_ptr<IPC::ChannelMojoHost> host_; |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 246 | }; |
| 247 | |
| 248 | class ListenerThatQuits : public IPC::Listener { |
| 249 | public: |
| 250 | ListenerThatQuits() { |
| 251 | } |
| 252 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 253 | bool OnMessageReceived(const IPC::Message& message) override { |
dcheng | f3076af | 2014-10-21 18:02:42 | [diff] [blame] | 254 | return true; |
| 255 | } |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 256 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 257 | void OnChannelConnected(int32 peer_pid) override { |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 258 | base::MessageLoop::current()->Quit(); |
| 259 | } |
| 260 | }; |
| 261 | |
| 262 | // A long running process that connects to us. |
| 263 | MULTIPROCESS_IPC_TEST_CLIENT_MAIN(IPCChannelMojoErraticTestClient) { |
| 264 | ListenerThatQuits listener; |
| 265 | ChannelClient client(&listener, "IPCChannelMojoErraticTestClient"); |
| 266 | client.Connect(); |
| 267 | |
| 268 | base::MessageLoop::current()->Run(); |
| 269 | |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 270 | client.Close(); |
| 271 | |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 272 | return 0; |
| 273 | } |
| 274 | |
morrita | be6c4cc | 2014-09-24 23:38:44 | [diff] [blame] | 275 | TEST_F(IPCChannelMojoErrorTest, SendFailWithPendingMessages) { |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 276 | InitWithMojo("IPCChannelMojoErraticTestClient"); |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 277 | |
| 278 | // Set up IPC channel and start client. |
| 279 | ListenerExpectingErrors listener; |
| 280 | CreateChannel(&listener); |
| 281 | ASSERT_TRUE(ConnectChannel()); |
| 282 | |
jamesr | a03ae49 | 2014-10-03 04:26:48 | [diff] [blame] | 283 | // This matches a value in mojo/edk/system/constants.h |
morrita | be6c4cc | 2014-09-24 23:38:44 | [diff] [blame] | 284 | const int kMaxMessageNumBytes = 4 * 1024 * 1024; |
| 285 | std::string overly_large_data(kMaxMessageNumBytes, '*'); |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 286 | // This messages are queued as pending. |
morrita | be6c4cc | 2014-09-24 23:38:44 | [diff] [blame] | 287 | for (size_t i = 0; i < 10; ++i) { |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 288 | IPC::TestChannelListener::SendOneMessage( |
morrita | be6c4cc | 2014-09-24 23:38:44 | [diff] [blame] | 289 | sender(), overly_large_data.c_str()); |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | ASSERT_TRUE(StartClient()); |
| 293 | base::MessageLoop::current()->Run(); |
| 294 | |
| 295 | this->channel()->Close(); |
| 296 | |
| 297 | EXPECT_TRUE(WaitForClientShutdown()); |
| 298 | EXPECT_TRUE(listener.has_error()); |
| 299 | |
| 300 | DestroyChannel(); |
| 301 | } |
| 302 | |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 303 | struct TestingMessagePipe { |
| 304 | TestingMessagePipe() { |
| 305 | EXPECT_EQ(MOJO_RESULT_OK, mojo::CreateMessagePipe(nullptr, &self, &peer)); |
| 306 | } |
| 307 | |
| 308 | mojo::ScopedMessagePipeHandle self; |
| 309 | mojo::ScopedMessagePipeHandle peer; |
| 310 | }; |
| 311 | |
| 312 | class HandleSendingHelper { |
| 313 | public: |
| 314 | static std::string GetSendingFileContent() { return "Hello"; } |
| 315 | |
| 316 | static void WritePipe(IPC::Message* message, TestingMessagePipe* pipe) { |
| 317 | std::string content = HandleSendingHelper::GetSendingFileContent(); |
| 318 | EXPECT_EQ(MOJO_RESULT_OK, |
| 319 | mojo::WriteMessageRaw(pipe->self.get(), &content[0], |
| 320 | static_cast<uint32_t>(content.size()), |
| 321 | nullptr, 0, 0)); |
| 322 | EXPECT_TRUE( |
| 323 | IPC::MojoMessageHelper::WriteMessagePipeTo(message, pipe->peer.Pass())); |
| 324 | } |
| 325 | |
| 326 | static void WritePipeThenSend(IPC::Sender* sender, TestingMessagePipe* pipe) { |
| 327 | IPC::Message* message = |
| 328 | new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); |
| 329 | WritePipe(message, pipe); |
| 330 | ASSERT_TRUE(sender->Send(message)); |
| 331 | } |
| 332 | |
| 333 | static void ReadReceivedPipe(const IPC::Message& message, |
| 334 | PickleIterator* iter) { |
| 335 | mojo::ScopedMessagePipeHandle pipe; |
| 336 | EXPECT_TRUE( |
| 337 | IPC::MojoMessageHelper::ReadMessagePipeFrom(&message, iter, &pipe)); |
| 338 | std::string content(GetSendingFileContent().size(), ' '); |
| 339 | |
| 340 | uint32_t num_bytes = static_cast<uint32_t>(content.size()); |
| 341 | EXPECT_EQ(MOJO_RESULT_OK, |
| 342 | mojo::ReadMessageRaw(pipe.get(), &content[0], &num_bytes, nullptr, |
| 343 | nullptr, 0)); |
| 344 | EXPECT_EQ(content, GetSendingFileContent()); |
| 345 | } |
| 346 | |
| 347 | #if defined(OS_POSIX) |
| 348 | static base::FilePath GetSendingFilePath() { |
| 349 | base::FilePath path; |
| 350 | bool ok = PathService::Get(base::DIR_CACHE, &path); |
| 351 | EXPECT_TRUE(ok); |
| 352 | return path.Append("ListenerThatExpectsFile.txt"); |
| 353 | } |
| 354 | |
| 355 | static void WriteFile(IPC::Message* message, base::File& file) { |
| 356 | std::string content = GetSendingFileContent(); |
| 357 | file.WriteAtCurrentPos(content.data(), content.size()); |
| 358 | file.Flush(); |
| 359 | message->WriteAttachment(new IPC::internal::PlatformFileAttachment( |
| 360 | base::ScopedFD(file.TakePlatformFile()))); |
| 361 | } |
| 362 | |
| 363 | static void WriteFileThenSend(IPC::Sender* sender, base::File& file) { |
| 364 | IPC::Message* message = |
| 365 | new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); |
| 366 | WriteFile(message, file); |
| 367 | ASSERT_TRUE(sender->Send(message)); |
| 368 | } |
| 369 | |
| 370 | static void WriteFileAndPipeThenSend(IPC::Sender* sender, |
| 371 | base::File& file, |
| 372 | TestingMessagePipe* pipe) { |
| 373 | IPC::Message* message = |
| 374 | new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); |
| 375 | WriteFile(message, file); |
| 376 | WritePipe(message, pipe); |
| 377 | ASSERT_TRUE(sender->Send(message)); |
| 378 | } |
| 379 | |
| 380 | static void ReadReceivedFile(const IPC::Message& message, |
| 381 | PickleIterator* iter) { |
| 382 | base::ScopedFD fd; |
| 383 | scoped_refptr<IPC::MessageAttachment> attachment; |
| 384 | EXPECT_TRUE(message.ReadAttachment(iter, &attachment)); |
| 385 | base::File file(attachment->TakePlatformFile()); |
| 386 | std::string content(GetSendingFileContent().size(), ' '); |
| 387 | file.Read(0, &content[0], content.size()); |
| 388 | EXPECT_EQ(content, GetSendingFileContent()); |
| 389 | } |
| 390 | #endif |
| 391 | }; |
| 392 | |
| 393 | class ListenerThatExpectsMessagePipe : public IPC::Listener { |
| 394 | public: |
| 395 | ListenerThatExpectsMessagePipe() : sender_(NULL) {} |
| 396 | |
| 397 | ~ListenerThatExpectsMessagePipe() override {} |
| 398 | |
| 399 | bool OnMessageReceived(const IPC::Message& message) override { |
| 400 | PickleIterator iter(message); |
| 401 | HandleSendingHelper::ReadReceivedPipe(message, &iter); |
| 402 | base::MessageLoop::current()->Quit(); |
| 403 | ListenerThatExpectsOK::SendOK(sender_); |
| 404 | return true; |
| 405 | } |
| 406 | |
| 407 | void OnChannelError() override { NOTREACHED(); } |
| 408 | |
| 409 | void set_sender(IPC::Sender* sender) { sender_ = sender; } |
| 410 | |
| 411 | private: |
| 412 | IPC::Sender* sender_; |
| 413 | }; |
| 414 | |
| 415 | TEST_F(IPCChannelMojoTest, SendMessagePipe) { |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 416 | InitWithMojo("IPCChannelMojoTestSendMessagePipeClient"); |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 417 | |
| 418 | ListenerThatExpectsOK listener; |
| 419 | CreateChannel(&listener); |
| 420 | ASSERT_TRUE(ConnectChannel()); |
| 421 | ASSERT_TRUE(StartClient()); |
| 422 | |
| 423 | TestingMessagePipe pipe; |
| 424 | HandleSendingHelper::WritePipeThenSend(channel(), &pipe); |
| 425 | |
| 426 | base::MessageLoop::current()->Run(); |
| 427 | this->channel()->Close(); |
| 428 | |
| 429 | EXPECT_TRUE(WaitForClientShutdown()); |
| 430 | DestroyChannel(); |
| 431 | } |
| 432 | |
| 433 | MULTIPROCESS_IPC_TEST_CLIENT_MAIN(IPCChannelMojoTestSendMessagePipeClient) { |
| 434 | ListenerThatExpectsMessagePipe listener; |
morrita | e73c0b4 | 2015-03-05 02:55:19 | [diff] [blame] | 435 | ChannelClient client(&listener, "IPCChannelMojoTestSendMessagePipeClient"); |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 436 | client.Connect(); |
| 437 | listener.set_sender(client.channel()); |
| 438 | |
| 439 | base::MessageLoop::current()->Run(); |
| 440 | |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 441 | client.Close(); |
| 442 | |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 443 | return 0; |
| 444 | } |
| 445 | |
morrita | 438a2ee | 2015-04-03 05:28:21 | [diff] [blame^] | 446 | void ReadOK(mojo::MessagePipeHandle pipe) { |
| 447 | std::string should_be_ok("xx"); |
| 448 | uint32_t num_bytes = static_cast<uint32_t>(should_be_ok.size()); |
| 449 | CHECK_EQ(MOJO_RESULT_OK, |
| 450 | mojo::ReadMessageRaw(pipe, &should_be_ok[0], &num_bytes, nullptr, |
| 451 | nullptr, 0)); |
| 452 | EXPECT_EQ(should_be_ok, std::string("OK")); |
| 453 | } |
| 454 | |
| 455 | void WriteOK(mojo::MessagePipeHandle pipe) { |
| 456 | std::string ok("OK"); |
| 457 | CHECK_EQ(MOJO_RESULT_OK, |
| 458 | mojo::WriteMessageRaw(pipe, &ok[0], static_cast<uint32_t>(ok.size()), |
| 459 | nullptr, 0, 0)); |
| 460 | } |
| 461 | |
| 462 | class ListenerThatExpectsMessagePipeUsingParamTrait : public IPC::Listener { |
| 463 | public: |
| 464 | explicit ListenerThatExpectsMessagePipeUsingParamTrait(bool receiving_valid) |
| 465 | : sender_(NULL), receiving_valid_(receiving_valid) {} |
| 466 | |
| 467 | ~ListenerThatExpectsMessagePipeUsingParamTrait() override {} |
| 468 | |
| 469 | bool OnMessageReceived(const IPC::Message& message) override { |
| 470 | PickleIterator iter(message); |
| 471 | mojo::MessagePipeHandle handle; |
| 472 | EXPECT_TRUE(IPC::ParamTraits<mojo::MessagePipeHandle>::Read(&message, &iter, |
| 473 | &handle)); |
| 474 | EXPECT_EQ(handle.is_valid(), receiving_valid_); |
| 475 | if (receiving_valid_) { |
| 476 | ReadOK(handle); |
| 477 | MojoClose(handle.value()); |
| 478 | } |
| 479 | |
| 480 | base::MessageLoop::current()->Quit(); |
| 481 | ListenerThatExpectsOK::SendOK(sender_); |
| 482 | return true; |
| 483 | } |
| 484 | |
| 485 | void OnChannelError() override { NOTREACHED(); } |
| 486 | void set_sender(IPC::Sender* sender) { sender_ = sender; } |
| 487 | |
| 488 | private: |
| 489 | IPC::Sender* sender_; |
| 490 | bool receiving_valid_; |
| 491 | }; |
| 492 | |
| 493 | void ParamTraitMessagePipeClient(bool receiving_valid_handle, |
| 494 | const char* channel_name) { |
| 495 | ListenerThatExpectsMessagePipeUsingParamTrait listener( |
| 496 | receiving_valid_handle); |
| 497 | ChannelClient client(&listener, channel_name); |
| 498 | client.Connect(); |
| 499 | listener.set_sender(client.channel()); |
| 500 | |
| 501 | base::MessageLoop::current()->Run(); |
| 502 | |
| 503 | client.Close(); |
| 504 | } |
| 505 | |
| 506 | TEST_F(IPCChannelMojoTest, ParamTraitValidMessagePipe) { |
| 507 | InitWithMojo("ParamTraitValidMessagePipeClient"); |
| 508 | |
| 509 | ListenerThatExpectsOK listener; |
| 510 | CreateChannel(&listener); |
| 511 | ASSERT_TRUE(ConnectChannel()); |
| 512 | ASSERT_TRUE(StartClient()); |
| 513 | |
| 514 | TestingMessagePipe pipe; |
| 515 | |
| 516 | scoped_ptr<IPC::Message> message(new IPC::Message()); |
| 517 | IPC::ParamTraits<mojo::MessagePipeHandle>::Write(message.get(), |
| 518 | pipe.peer.release()); |
| 519 | WriteOK(pipe.self.get()); |
| 520 | |
| 521 | this->channel()->Send(message.release()); |
| 522 | base::MessageLoop::current()->Run(); |
| 523 | this->channel()->Close(); |
| 524 | |
| 525 | EXPECT_TRUE(WaitForClientShutdown()); |
| 526 | DestroyChannel(); |
| 527 | } |
| 528 | |
| 529 | MULTIPROCESS_IPC_TEST_CLIENT_MAIN(ParamTraitValidMessagePipeClient) { |
| 530 | ParamTraitMessagePipeClient(true, "ParamTraitValidMessagePipeClient"); |
| 531 | return 0; |
| 532 | } |
| 533 | |
| 534 | TEST_F(IPCChannelMojoTest, ParamTraitInvalidMessagePipe) { |
| 535 | InitWithMojo("ParamTraitInvalidMessagePipeClient"); |
| 536 | |
| 537 | ListenerThatExpectsOK listener; |
| 538 | CreateChannel(&listener); |
| 539 | ASSERT_TRUE(ConnectChannel()); |
| 540 | ASSERT_TRUE(StartClient()); |
| 541 | |
| 542 | mojo::MessagePipeHandle invalid_handle; |
| 543 | scoped_ptr<IPC::Message> message(new IPC::Message()); |
| 544 | IPC::ParamTraits<mojo::MessagePipeHandle>::Write(message.get(), |
| 545 | invalid_handle); |
| 546 | |
| 547 | this->channel()->Send(message.release()); |
| 548 | base::MessageLoop::current()->Run(); |
| 549 | this->channel()->Close(); |
| 550 | |
| 551 | EXPECT_TRUE(WaitForClientShutdown()); |
| 552 | DestroyChannel(); |
| 553 | } |
| 554 | |
| 555 | MULTIPROCESS_IPC_TEST_CLIENT_MAIN(ParamTraitInvalidMessagePipeClient) { |
| 556 | ParamTraitMessagePipeClient(false, "ParamTraitInvalidMessagePipeClient"); |
| 557 | return 0; |
| 558 | } |
| 559 | |
morrita | 2580367 | 2014-10-15 18:50:19 | [diff] [blame] | 560 | #if defined(OS_WIN) |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 561 | class IPCChannelMojoDeadHandleTest : public IPCChannelMojoTestBase { |
morrita | 2580367 | 2014-10-15 18:50:19 | [diff] [blame] | 562 | protected: |
| 563 | virtual scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( |
| 564 | const IPC::ChannelHandle& handle, |
morrita | c4db547 | 2015-03-13 20:44:39 | [diff] [blame] | 565 | base::SequencedTaskRunner* runner) override { |
morrita | 2580367 | 2014-10-15 18:50:19 | [diff] [blame] | 566 | host_.reset(new IPC::ChannelMojoHost(task_runner())); |
| 567 | return IPC::ChannelMojo::CreateServerFactory(host_->channel_delegate(), |
| 568 | handle); |
| 569 | } |
| 570 | |
| 571 | virtual bool DidStartClient() override { |
| 572 | IPCTestBase::DidStartClient(); |
rvargas | 07b589c | 2015-01-12 22:23:23 | [diff] [blame] | 573 | const base::ProcessHandle client = client_process().Handle(); |
morrita | 2580367 | 2014-10-15 18:50:19 | [diff] [blame] | 574 | // Forces GetFileHandleForProcess() fail. It happens occasionally |
| 575 | // in production, so we should exercise it somehow. |
morrita | e73c0b4 | 2015-03-05 02:55:19 | [diff] [blame] | 576 | // TODO(morrita): figure out how to safely test this. See crbug.com/464109. |
rvargas | 07b589c | 2015-01-12 22:23:23 | [diff] [blame] | 577 | // ::CloseHandle(client); |
morrita | 2580367 | 2014-10-15 18:50:19 | [diff] [blame] | 578 | host_->OnClientLaunched(client); |
| 579 | return true; |
| 580 | } |
| 581 | |
| 582 | private: |
| 583 | scoped_ptr<IPC::ChannelMojoHost> host_; |
| 584 | }; |
| 585 | |
| 586 | TEST_F(IPCChannelMojoDeadHandleTest, InvalidClientHandle) { |
| 587 | // Any client type is fine as it is going to be killed anyway. |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 588 | InitWithMojo("IPCChannelMojoTestDoNothingClient"); |
morrita | 2580367 | 2014-10-15 18:50:19 | [diff] [blame] | 589 | |
| 590 | // Set up IPC channel and start client. |
| 591 | ListenerExpectingErrors listener; |
| 592 | CreateChannel(&listener); |
| 593 | ASSERT_TRUE(ConnectChannel()); |
| 594 | |
| 595 | ASSERT_TRUE(StartClient()); |
| 596 | base::MessageLoop::current()->Run(); |
| 597 | |
| 598 | this->channel()->Close(); |
| 599 | |
morrita | e73c0b4 | 2015-03-05 02:55:19 | [diff] [blame] | 600 | // TODO(morrita): We need CloseHandle() call in DidStartClient(), |
| 601 | // which has been disabled since crrev.com/843113003, to |
| 602 | // make this fail. See crbug.com/464109. |
| 603 | // EXPECT_FALSE(WaitForClientShutdown()); |
| 604 | WaitForClientShutdown(); |
morrita | 2580367 | 2014-10-15 18:50:19 | [diff] [blame] | 605 | EXPECT_TRUE(listener.has_error()); |
| 606 | |
| 607 | DestroyChannel(); |
| 608 | } |
| 609 | |
| 610 | MULTIPROCESS_IPC_TEST_CLIENT_MAIN(IPCChannelMojoTestDoNothingClient) { |
| 611 | ListenerThatQuits listener; |
| 612 | ChannelClient client(&listener, "IPCChannelMojoTestDoNothingClient"); |
| 613 | client.Connect(); |
| 614 | |
| 615 | // Quits without running the message loop as this client won't |
| 616 | // receive any messages from the server. |
| 617 | |
| 618 | return 0; |
| 619 | } |
| 620 | #endif |
morrita | 0a24cfc9 | 2014-09-16 03:20:48 | [diff] [blame] | 621 | |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 622 | #if defined(OS_POSIX) |
| 623 | class ListenerThatExpectsFile : public IPC::Listener { |
| 624 | public: |
| 625 | ListenerThatExpectsFile() |
| 626 | : sender_(NULL) {} |
| 627 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 628 | ~ListenerThatExpectsFile() override {} |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 629 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 630 | bool OnMessageReceived(const IPC::Message& message) override { |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 631 | PickleIterator iter(message); |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 632 | HandleSendingHelper::ReadReceivedFile(message, &iter); |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 633 | base::MessageLoop::current()->Quit(); |
| 634 | ListenerThatExpectsOK::SendOK(sender_); |
| 635 | return true; |
| 636 | } |
| 637 | |
dcheng | fe61fca | 2014-10-22 02:29:52 | [diff] [blame] | 638 | void OnChannelError() override { |
dcheng | f3076af | 2014-10-21 18:02:42 | [diff] [blame] | 639 | NOTREACHED(); |
| 640 | } |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 641 | |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 642 | void set_sender(IPC::Sender* sender) { sender_ = sender; } |
| 643 | |
| 644 | private: |
| 645 | IPC::Sender* sender_; |
| 646 | }; |
| 647 | |
| 648 | |
| 649 | TEST_F(IPCChannelMojoTest, SendPlatformHandle) { |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 650 | InitWithMojo("IPCChannelMojoTestSendPlatformHandleClient"); |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 651 | |
| 652 | ListenerThatExpectsOK listener; |
morrita | 373af03b | 2014-09-09 19:35:24 | [diff] [blame] | 653 | CreateChannel(&listener); |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 654 | ASSERT_TRUE(ConnectChannel()); |
| 655 | ASSERT_TRUE(StartClient()); |
| 656 | |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 657 | base::File file(HandleSendingHelper::GetSendingFilePath(), |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 658 | base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE | |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 659 | base::File::FLAG_READ); |
| 660 | HandleSendingHelper::WriteFileThenSend(channel(), file); |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 661 | base::MessageLoop::current()->Run(); |
| 662 | |
| 663 | this->channel()->Close(); |
| 664 | |
| 665 | EXPECT_TRUE(WaitForClientShutdown()); |
| 666 | DestroyChannel(); |
| 667 | } |
| 668 | |
| 669 | MULTIPROCESS_IPC_TEST_CLIENT_MAIN(IPCChannelMojoTestSendPlatformHandleClient) { |
| 670 | ListenerThatExpectsFile listener; |
| 671 | ChannelClient client( |
| 672 | &listener, "IPCChannelMojoTestSendPlatformHandleClient"); |
| 673 | client.Connect(); |
| 674 | listener.set_sender(client.channel()); |
| 675 | |
| 676 | base::MessageLoop::current()->Run(); |
| 677 | |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 678 | client.Close(); |
| 679 | |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 680 | return 0; |
| 681 | } |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 682 | |
| 683 | class ListenerThatExpectsFileAndPipe : public IPC::Listener { |
| 684 | public: |
| 685 | ListenerThatExpectsFileAndPipe() : sender_(NULL) {} |
| 686 | |
| 687 | ~ListenerThatExpectsFileAndPipe() override {} |
| 688 | |
| 689 | bool OnMessageReceived(const IPC::Message& message) override { |
| 690 | PickleIterator iter(message); |
| 691 | HandleSendingHelper::ReadReceivedFile(message, &iter); |
| 692 | HandleSendingHelper::ReadReceivedPipe(message, &iter); |
| 693 | base::MessageLoop::current()->Quit(); |
| 694 | ListenerThatExpectsOK::SendOK(sender_); |
| 695 | return true; |
| 696 | } |
| 697 | |
| 698 | void OnChannelError() override { NOTREACHED(); } |
| 699 | |
| 700 | void set_sender(IPC::Sender* sender) { sender_ = sender; } |
| 701 | |
| 702 | private: |
| 703 | IPC::Sender* sender_; |
| 704 | }; |
| 705 | |
| 706 | TEST_F(IPCChannelMojoTest, SendPlatformHandleAndPipe) { |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 707 | InitWithMojo("IPCChannelMojoTestSendPlatformHandleAndPipeClient"); |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 708 | |
| 709 | ListenerThatExpectsOK listener; |
| 710 | CreateChannel(&listener); |
| 711 | ASSERT_TRUE(ConnectChannel()); |
| 712 | ASSERT_TRUE(StartClient()); |
| 713 | |
| 714 | base::File file(HandleSendingHelper::GetSendingFilePath(), |
| 715 | base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE | |
| 716 | base::File::FLAG_READ); |
| 717 | TestingMessagePipe pipe; |
| 718 | HandleSendingHelper::WriteFileAndPipeThenSend(channel(), file, &pipe); |
| 719 | |
| 720 | base::MessageLoop::current()->Run(); |
| 721 | this->channel()->Close(); |
| 722 | |
| 723 | EXPECT_TRUE(WaitForClientShutdown()); |
| 724 | DestroyChannel(); |
| 725 | } |
| 726 | |
| 727 | MULTIPROCESS_IPC_TEST_CLIENT_MAIN( |
| 728 | IPCChannelMojoTestSendPlatformHandleAndPipeClient) { |
| 729 | ListenerThatExpectsFileAndPipe listener; |
| 730 | ChannelClient client(&listener, |
| 731 | "IPCChannelMojoTestSendPlatformHandleAndPipeClient"); |
| 732 | client.Connect(); |
| 733 | listener.set_sender(client.channel()); |
| 734 | |
| 735 | base::MessageLoop::current()->Run(); |
| 736 | |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 737 | client.Close(); |
| 738 | |
morrita | 81b17e0 | 2015-02-06 00:58:30 | [diff] [blame] | 739 | return 0; |
| 740 | } |
| 741 | |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 742 | #endif |
| 743 | |
morrita | 0bd20bd | 2015-02-25 20:11:27 | [diff] [blame] | 744 | #if defined(OS_LINUX) |
| 745 | |
| 746 | const base::ProcessId kMagicChildId = 54321; |
| 747 | |
| 748 | class ListenerThatVerifiesPeerPid : public IPC::Listener { |
| 749 | public: |
| 750 | void OnChannelConnected(int32 peer_pid) override { |
| 751 | EXPECT_EQ(peer_pid, kMagicChildId); |
| 752 | base::MessageLoop::current()->Quit(); |
| 753 | } |
| 754 | |
| 755 | bool OnMessageReceived(const IPC::Message& message) override { |
| 756 | NOTREACHED(); |
| 757 | return true; |
| 758 | } |
| 759 | }; |
| 760 | |
| 761 | TEST_F(IPCChannelMojoTest, VerifyGlobalPid) { |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 762 | InitWithMojo("IPCChannelMojoTestVerifyGlobalPidClient"); |
morrita | 0bd20bd | 2015-02-25 20:11:27 | [diff] [blame] | 763 | |
| 764 | ListenerThatVerifiesPeerPid listener; |
| 765 | CreateChannel(&listener); |
| 766 | ASSERT_TRUE(ConnectChannel()); |
| 767 | ASSERT_TRUE(StartClient()); |
| 768 | |
| 769 | base::MessageLoop::current()->Run(); |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 770 | channel()->Close(); |
morrita | 0bd20bd | 2015-02-25 20:11:27 | [diff] [blame] | 771 | |
| 772 | EXPECT_TRUE(WaitForClientShutdown()); |
| 773 | DestroyChannel(); |
| 774 | } |
| 775 | |
| 776 | MULTIPROCESS_IPC_TEST_CLIENT_MAIN(IPCChannelMojoTestVerifyGlobalPidClient) { |
| 777 | IPC::Channel::SetGlobalPid(kMagicChildId); |
| 778 | ListenerThatQuits listener; |
| 779 | ChannelClient client(&listener, |
| 780 | "IPCChannelMojoTestVerifyGlobalPidClient"); |
| 781 | client.Connect(); |
| 782 | |
| 783 | base::MessageLoop::current()->Run(); |
| 784 | |
rockot | cbca72f | 2015-03-03 16:31:04 | [diff] [blame] | 785 | client.Close(); |
| 786 | |
morrita | 0bd20bd | 2015-02-25 20:11:27 | [diff] [blame] | 787 | return 0; |
| 788 | } |
| 789 | |
| 790 | #endif // OS_LINUX |
| 791 | |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 792 | } // namespace |