Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: ipc/ipc_channel_mojo_unittest.cc

Issue 2504063002: Revert of Remove IPC::BrokerableAttachment. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/ipc_channel_mojo.cc ('k') | ipc/ipc_channel_nacl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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( 292 EXPECT_EQ(IPC::MessageAttachment::TYPE_PLATFORM_FILE,
293 IPC::MessageAttachment::Type::PLATFORM_FILE, 293 static_cast<IPC::MessageAttachment*>(attachment.get())
294 static_cast<IPC::MessageAttachment*>(attachment.get())->GetType()); 294 ->GetType());
295 base::File file( 295 base::File file(static_cast<IPC::MessageAttachment*>(attachment.get())
296 static_cast<IPC::internal::PlatformFileAttachment*>(attachment.get()) 296 ->TakePlatformFile());
297 ->TakePlatformFile());
298 std::string content(GetSendingFileContent().size(), ' '); 297 std::string content(GetSendingFileContent().size(), ' ');
299 file.Read(0, &content[0], content.size()); 298 file.Read(0, &content[0], content.size());
300 EXPECT_EQ(content, GetSendingFileContent()); 299 EXPECT_EQ(content, GetSendingFileContent());
301 } 300 }
302 #endif 301 #endif
303 }; 302 };
304 303
305 class ListenerThatExpectsMessagePipe : public IPC::Listener { 304 class ListenerThatExpectsMessagePipe : public IPC::Listener {
306 public: 305 public:
307 ListenerThatExpectsMessagePipe() : sender_(NULL) {} 306 ListenerThatExpectsMessagePipe() : sender_(NULL) {}
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 Connect(&listener); 1409 Connect(&listener);
1411 1410
1412 base::RunLoop().Run(); 1411 base::RunLoop().Run();
1413 1412
1414 Close(); 1413 Close();
1415 } 1414 }
1416 1415
1417 #endif // OS_LINUX 1416 #endif // OS_LINUX
1418 1417
1419 } // namespace 1418 } // namespace
OLDNEW
« no previous file with comments | « ipc/ipc_channel_mojo.cc ('k') | ipc/ipc_channel_nacl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698