| 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 <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 WriteFile(message, file); | 355 WriteFile(message, file); |
| 356 WritePipe(message, pipe); | 356 WritePipe(message, pipe); |
| 357 ASSERT_TRUE(sender->Send(message)); | 357 ASSERT_TRUE(sender->Send(message)); |
| 358 } | 358 } |
| 359 | 359 |
| 360 static void ReadReceivedFile(const IPC::Message& message, | 360 static void ReadReceivedFile(const IPC::Message& message, |
| 361 base::PickleIterator* iter) { | 361 base::PickleIterator* iter) { |
| 362 base::ScopedFD fd; | 362 base::ScopedFD fd; |
| 363 scoped_refptr<base::Pickle::Attachment> attachment; | 363 scoped_refptr<base::Pickle::Attachment> attachment; |
| 364 EXPECT_TRUE(message.ReadAttachment(iter, &attachment)); | 364 EXPECT_TRUE(message.ReadAttachment(iter, &attachment)); |
| 365 EXPECT_EQ(IPC::MessageAttachment::TYPE_PLATFORM_FILE, |
| 366 static_cast<IPC::MessageAttachment*>(attachment.get()) |
| 367 ->GetType()); |
| 365 base::File file(static_cast<IPC::MessageAttachment*>(attachment.get()) | 368 base::File file(static_cast<IPC::MessageAttachment*>(attachment.get()) |
| 366 ->TakePlatformFile()); | 369 ->TakePlatformFile()); |
| 367 std::string content(GetSendingFileContent().size(), ' '); | 370 std::string content(GetSendingFileContent().size(), ' '); |
| 368 file.Read(0, &content[0], content.size()); | 371 file.Read(0, &content[0], content.size()); |
| 369 EXPECT_EQ(content, GetSendingFileContent()); | 372 EXPECT_EQ(content, GetSendingFileContent()); |
| 370 } | 373 } |
| 371 #endif | 374 #endif |
| 372 }; | 375 }; |
| 373 | 376 |
| 374 class ListenerThatExpectsMessagePipe : public IPC::Listener { | 377 class ListenerThatExpectsMessagePipe : public IPC::Listener { |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 Connect(&listener); | 730 Connect(&listener); |
| 728 | 731 |
| 729 base::MessageLoop::current()->Run(); | 732 base::MessageLoop::current()->Run(); |
| 730 | 733 |
| 731 Close(); | 734 Close(); |
| 732 } | 735 } |
| 733 | 736 |
| 734 #endif // OS_LINUX | 737 #endif // OS_LINUX |
| 735 | 738 |
| 736 } // namespace | 739 } // namespace |
| OLD | NEW |