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

Side by Side Diff: ipc/sync_socket_unittest.cc

Issue 10387218: Make GlobalDescriptors::MaybeGet return -1 when the key is not found. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied Jeremy's suggestions + sync. Created 8 years, 6 months 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
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 "base/sync_socket.h" 5 #include "base/sync_socket.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string> 8 #include <string>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 MessageLoop::current()->Quit(); 101 MessageLoop::current()->Quit();
102 } 102 }
103 103
104 IPC::Channel* chan_; 104 IPC::Channel* chan_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(SyncSocketServerListener); 106 DISALLOW_COPY_AND_ASSIGN(SyncSocketServerListener);
107 }; 107 };
108 108
109 // Runs the fuzzing server child mode. Returns when the preset number 109 // Runs the fuzzing server child mode. Returns when the preset number
110 // of messages have been received. 110 // of messages have been received.
111 MULTIPROCESS_TEST_MAIN(RunSyncSocketServer) { 111 MULTIPROCESS_IPC_TEST_MAIN(RunSyncSocketServer) {
112 MessageLoopForIO main_message_loop; 112 MessageLoopForIO main_message_loop;
113 SyncSocketServerListener listener; 113 SyncSocketServerListener listener;
114 IPC::Channel chan(kSyncSocketChannel, IPC::Channel::MODE_CLIENT, &listener); 114 IPC::Channel chan(kSyncSocketChannel, IPC::Channel::MODE_CLIENT, &listener);
115 EXPECT_TRUE(chan.Connect()); 115 EXPECT_TRUE(chan.Connect());
116 listener.Init(&chan); 116 listener.Init(&chan);
117 MessageLoop::current()->Run(); 117 MessageLoop::current()->Run();
118 return 0; 118 return 0;
119 } 119 }
120 120
121 // The SyncSocket client listener only processes one sort of message, 121 // The SyncSocket client listener only processes one sort of message,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 EXPECT_EQ(0U, pair[0].Send(kHelloString, kHelloStringLength)); 299 EXPECT_EQ(0U, pair[0].Send(kHelloString, kHelloStringLength));
300 EXPECT_EQ(bytes_in_buffer, pair[1].Peek()); 300 EXPECT_EQ(bytes_in_buffer, pair[1].Peek());
301 301
302 // Read from another socket to free some space for a new write. 302 // Read from another socket to free some space for a new write.
303 char hello[kHelloStringLength] = {0}; 303 char hello[kHelloStringLength] = {0};
304 pair[1].Receive(&hello[0], sizeof(hello)); 304 pair[1].Receive(&hello[0], sizeof(hello));
305 305
306 // Should be able to write more data to the buffer now. 306 // Should be able to write more data to the buffer now.
307 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength)); 307 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength));
308 } 308 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698