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 #include "ipc/mojo/ipc_channel_mojo.h" | 5 #include "ipc/mojo/ipc_channel_mojo.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/base_paths.h" | 11 #include "base/base_paths.h" |
11 #include "base/files/file.h" | 12 #include "base/files/file.h" |
12 #include "base/location.h" | 13 #include "base/location.h" |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "base/pickle.h" | 15 #include "base/pickle.h" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
17 #include "base/test/test_timeouts.h" | 18 #include "base/test/test_timeouts.h" |
18 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 class HandleSendingHelper { | 310 class HandleSendingHelper { |
310 public: | 311 public: |
311 static std::string GetSendingFileContent() { return "Hello"; } | 312 static std::string GetSendingFileContent() { return "Hello"; } |
312 | 313 |
313 static void WritePipe(IPC::Message* message, TestingMessagePipe* pipe) { | 314 static void WritePipe(IPC::Message* message, TestingMessagePipe* pipe) { |
314 std::string content = HandleSendingHelper::GetSendingFileContent(); | 315 std::string content = HandleSendingHelper::GetSendingFileContent(); |
315 EXPECT_EQ(MOJO_RESULT_OK, | 316 EXPECT_EQ(MOJO_RESULT_OK, |
316 mojo::WriteMessageRaw(pipe->self.get(), &content[0], | 317 mojo::WriteMessageRaw(pipe->self.get(), &content[0], |
317 static_cast<uint32_t>(content.size()), | 318 static_cast<uint32_t>(content.size()), |
318 nullptr, 0, 0)); | 319 nullptr, 0, 0)); |
319 EXPECT_TRUE( | 320 EXPECT_TRUE(IPC::MojoMessageHelper::WriteMessagePipeTo( |
320 IPC::MojoMessageHelper::WriteMessagePipeTo(message, pipe->peer.Pass())); | 321 message, std::move(pipe->peer))); |
321 } | 322 } |
322 | 323 |
323 static void WritePipeThenSend(IPC::Sender* sender, TestingMessagePipe* pipe) { | 324 static void WritePipeThenSend(IPC::Sender* sender, TestingMessagePipe* pipe) { |
324 IPC::Message* message = | 325 IPC::Message* message = |
325 new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); | 326 new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); |
326 WritePipe(message, pipe); | 327 WritePipe(message, pipe); |
327 ASSERT_TRUE(sender->Send(message)); | 328 ASSERT_TRUE(sender->Send(message)); |
328 } | 329 } |
329 | 330 |
330 static void ReadReceivedPipe(const IPC::Message& message, | 331 static void ReadReceivedPipe(const IPC::Message& message, |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 base::MessageLoop::current()->Run(); | 853 base::MessageLoop::current()->Run(); |
853 | 854 |
854 client.Close(); | 855 client.Close(); |
855 | 856 |
856 return 0; | 857 return 0; |
857 } | 858 } |
858 | 859 |
859 #endif // OS_LINUX | 860 #endif // OS_LINUX |
860 | 861 |
861 } // namespace | 862 } // namespace |
OLD | NEW |