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

Side by Side Diff: ipc/ipc_send_fds_test.cc

Issue 57783006: Revert https://src.chromium.org/viewvc/chrome?view=rev&revision=231330 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile (cc perftest). Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_perftests.cc ('k') | ipc/ipc_sync_message.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #if defined(OS_MACOSX) 8 #if defined(OS_MACOSX)
9 extern "C" { 9 extern "C" {
10 #include <sandbox.h> 10 #include <sandbox.h>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 MyChannelDescriptorListener listener(-1); 99 MyChannelDescriptorListener listener(-1);
100 CreateChannel(&listener); 100 CreateChannel(&listener);
101 ASSERT_TRUE(ConnectChannel()); 101 ASSERT_TRUE(ConnectChannel());
102 ASSERT_TRUE(StartClient()); 102 ASSERT_TRUE(StartClient());
103 103
104 for (unsigned i = 0; i < kNumFDsToSend; ++i) { 104 for (unsigned i = 0; i < kNumFDsToSend; ++i) {
105 const int fd = open(kDevZeroPath, O_RDONLY); 105 const int fd = open(kDevZeroPath, O_RDONLY);
106 ASSERT_GE(fd, 0); 106 ASSERT_GE(fd, 0);
107 base::FileDescriptor descriptor(fd, true); 107 base::FileDescriptor descriptor(fd, true);
108 108
109 IPC::Message* message = new IPC::Message(0, 3); 109 IPC::Message* message =
110 new IPC::Message(0, 3, IPC::Message::PRIORITY_NORMAL);
110 IPC::ParamTraits<base::FileDescriptor>::Write(message, descriptor); 111 IPC::ParamTraits<base::FileDescriptor>::Write(message, descriptor);
111 ASSERT_TRUE(sender()->Send(message)); 112 ASSERT_TRUE(sender()->Send(message));
112 } 113 }
113 114
114 // Run message loop. 115 // Run message loop.
115 base::MessageLoop::current()->Run(); 116 base::MessageLoop::current()->Run();
116 117
117 // Close the channel so the client's OnChannelError() gets fired. 118 // Close the channel so the client's OnChannelError() gets fired.
118 channel()->Close(); 119 channel()->Close();
119 120
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 static void Connect(IPC::Channel *channel) { 273 static void Connect(IPC::Channel *channel) {
273 EXPECT_TRUE(channel->Connect()); 274 EXPECT_TRUE(channel->Connect());
274 } 275 }
275 276
276 void Send(int fd) { 277 void Send(int fd) {
277 CHECK_EQ(base::MessageLoop::current(), in_thread_->message_loop()); 278 CHECK_EQ(base::MessageLoop::current(), in_thread_->message_loop());
278 279
279 ASSERT_GE(fd, 0); 280 ASSERT_GE(fd, 0);
280 base::FileDescriptor descriptor(fd, true); 281 base::FileDescriptor descriptor(fd, true);
281 282
282 IPC::Message* message = new IPC::Message(0, 3); 283 IPC::Message* message =
284 new IPC::Message(0, 3, IPC::Message::PRIORITY_NORMAL);
283 IPC::ParamTraits<base::FileDescriptor>::Write(message, descriptor); 285 IPC::ParamTraits<base::FileDescriptor>::Write(message, descriptor);
284 ASSERT_TRUE(in->Send(message)); 286 ASSERT_TRUE(in->Send(message));
285 } 287 }
286 288
287 private: 289 private:
288 scoped_ptr<IPC::Channel> in, out; 290 scoped_ptr<IPC::Channel> in, out;
289 base::Thread* in_thread_; 291 base::Thread* in_thread_;
290 base::Thread* out_thread_; 292 base::Thread* out_thread_;
291 MyCBListener cb_listener_; 293 MyCBListener cb_listener_;
292 MyCBListener null_listener_; 294 MyCBListener null_listener_;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 base::WaitableEvent received_; 371 base::WaitableEvent received_;
370 }; 372 };
371 373
372 TEST_F(IPCMultiSendingFdsTest, StressTest) { 374 TEST_F(IPCMultiSendingFdsTest, StressTest) {
373 Run(); 375 Run();
374 } 376 }
375 377
376 } // namespace 378 } // namespace
377 379
378 #endif // defined(OS_POSIX) 380 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « ipc/ipc_perftests.cc ('k') | ipc/ipc_sync_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698