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

Unified Diff: ipc/sync_socket_unittest.cc

Issue 468023: Add an implementation of base::SyncSocket::Peek for posix platforms. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/sync_socket_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/sync_socket_unittest.cc
===================================================================
--- ipc/sync_socket_unittest.cc (revision 33881)
+++ ipc/sync_socket_unittest.cc (working copy)
@@ -189,14 +189,14 @@
// string as was written on the SyncSocket. These are compared
// and a shutdown message is sent back to the server.
void OnMsgClassResponse(const std::string& str) {
-#if defined(OS_WIN)
// We rely on the order of sync_socket.Send() and chan_->Send() in
// the SyncSocketServerListener object.
EXPECT_EQ(kHelloStringLength, socket_->Peek());
-#endif
char buf[kHelloStringLength];
socket_->Receive(static_cast<void*>(buf), kHelloStringLength);
EXPECT_EQ(strcmp(str.c_str(), buf), 0);
+ // After receiving from the socket there should be no bytes left.
+ EXPECT_EQ(0, socket_->Peek());
IPC::Message* msg = new MsgClassShutdown();
EXPECT_NE(msg, reinterpret_cast<IPC::Message*>(NULL));
Evan Martin 2009/12/06 01:45:22 Off-topic, but I think if "new" returns NULL you'v
EXPECT_TRUE(chan_->Send(msg));
@@ -221,6 +221,9 @@
// Create a pair of SyncSockets.
base::SyncSocket* pair[2];
base::SyncSocket::CreatePair(pair);
+ // Immediately after creation there should be no pending bytes.
+ EXPECT_EQ(0, pair[0]->Peek());
+ EXPECT_EQ(0, pair[1]->Peek());
base::SyncSocket::Handle target_handle;
// Connect the channel and listener.
ASSERT_TRUE(chan.Connect());
« no previous file with comments | « base/sync_socket_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698