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/ipc_channel_mojo.h" | 5 #include "ipc/ipc_channel_mojo.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 WriteFile(message, file); | 282 WriteFile(message, file); |
283 WritePipe(message, pipe); | 283 WritePipe(message, pipe); |
284 ASSERT_TRUE(sender->Send(message)); | 284 ASSERT_TRUE(sender->Send(message)); |
285 } | 285 } |
286 | 286 |
287 static void ReadReceivedFile(const IPC::Message& message, | 287 static void ReadReceivedFile(const IPC::Message& message, |
288 base::PickleIterator* iter) { | 288 base::PickleIterator* iter) { |
289 base::ScopedFD fd; | 289 base::ScopedFD fd; |
290 scoped_refptr<base::Pickle::Attachment> attachment; | 290 scoped_refptr<base::Pickle::Attachment> attachment; |
291 EXPECT_TRUE(message.ReadAttachment(iter, &attachment)); | 291 EXPECT_TRUE(message.ReadAttachment(iter, &attachment)); |
292 EXPECT_EQ(IPC::MessageAttachment::TYPE_PLATFORM_FILE, | 292 EXPECT_EQ( |
293 static_cast<IPC::MessageAttachment*>(attachment.get()) | 293 IPC::MessageAttachment::Type::PLATFORM_FILE, |
294 ->GetType()); | 294 static_cast<IPC::MessageAttachment*>(attachment.get())->GetType()); |
295 base::File file(static_cast<IPC::MessageAttachment*>(attachment.get()) | 295 base::File file( |
296 ->TakePlatformFile()); | 296 static_cast<IPC::internal::PlatformFileAttachment*>(attachment.get()) |
| 297 ->TakePlatformFile()); |
297 std::string content(GetSendingFileContent().size(), ' '); | 298 std::string content(GetSendingFileContent().size(), ' '); |
298 file.Read(0, &content[0], content.size()); | 299 file.Read(0, &content[0], content.size()); |
299 EXPECT_EQ(content, GetSendingFileContent()); | 300 EXPECT_EQ(content, GetSendingFileContent()); |
300 } | 301 } |
301 #endif | 302 #endif |
302 }; | 303 }; |
303 | 304 |
304 class ListenerThatExpectsMessagePipe : public IPC::Listener { | 305 class ListenerThatExpectsMessagePipe : public IPC::Listener { |
305 public: | 306 public: |
306 ListenerThatExpectsMessagePipe() : sender_(NULL) {} | 307 ListenerThatExpectsMessagePipe() : sender_(NULL) {} |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 Connect(&listener); | 1410 Connect(&listener); |
1410 | 1411 |
1411 base::RunLoop().Run(); | 1412 base::RunLoop().Run(); |
1412 | 1413 |
1413 Close(); | 1414 Close(); |
1414 } | 1415 } |
1415 | 1416 |
1416 #endif // OS_LINUX | 1417 #endif // OS_LINUX |
1417 | 1418 |
1418 } // namespace | 1419 } // namespace |
OLD | NEW |