| 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 #include <utility> |
| 10 | 10 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 IPC::Message* message = | 371 IPC::Message* message = |
| 372 new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); | 372 new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); |
| 373 WriteFile(message, file); | 373 WriteFile(message, file); |
| 374 WritePipe(message, pipe); | 374 WritePipe(message, pipe); |
| 375 ASSERT_TRUE(sender->Send(message)); | 375 ASSERT_TRUE(sender->Send(message)); |
| 376 } | 376 } |
| 377 | 377 |
| 378 static void ReadReceivedFile(const IPC::Message& message, | 378 static void ReadReceivedFile(const IPC::Message& message, |
| 379 base::PickleIterator* iter) { | 379 base::PickleIterator* iter) { |
| 380 base::ScopedFD fd; | 380 base::ScopedFD fd; |
| 381 scoped_refptr<IPC::MessageAttachment> attachment; | 381 scoped_refptr<base::Pickle::Attachment> attachment; |
| 382 EXPECT_TRUE(message.ReadAttachment(iter, &attachment)); | 382 EXPECT_TRUE(message.ReadAttachment(iter, &attachment)); |
| 383 base::File file(attachment->TakePlatformFile()); | 383 base::File file(static_cast<IPC::MessageAttachment*>(attachment.get()) |
| 384 ->TakePlatformFile()); |
| 384 std::string content(GetSendingFileContent().size(), ' '); | 385 std::string content(GetSendingFileContent().size(), ' '); |
| 385 file.Read(0, &content[0], content.size()); | 386 file.Read(0, &content[0], content.size()); |
| 386 EXPECT_EQ(content, GetSendingFileContent()); | 387 EXPECT_EQ(content, GetSendingFileContent()); |
| 387 } | 388 } |
| 388 #endif | 389 #endif |
| 389 }; | 390 }; |
| 390 | 391 |
| 391 class ListenerThatExpectsMessagePipe : public IPC::Listener { | 392 class ListenerThatExpectsMessagePipe : public IPC::Listener { |
| 392 public: | 393 public: |
| 393 ListenerThatExpectsMessagePipe() : sender_(NULL) {} | 394 ListenerThatExpectsMessagePipe() : sender_(NULL) {} |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 base::MessageLoop::current()->Run(); | 854 base::MessageLoop::current()->Run(); |
| 854 | 855 |
| 855 client.Close(); | 856 client.Close(); |
| 856 | 857 |
| 857 return 0; | 858 return 0; |
| 858 } | 859 } |
| 859 | 860 |
| 860 #endif // OS_LINUX | 861 #endif // OS_LINUX |
| 861 | 862 |
| 862 } // namespace | 863 } // namespace |
| OLD | NEW |