diff options
author | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-06 19:45:08 +0000 |
---|---|---|
committer | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-06 19:45:08 +0000 |
commit | 1e1f1a7eb400cfd9094262315fc03d6a4e13fa1b (patch) | |
tree | 7dc8af2ae8f949cc9114cb04931b2898be201315 /ipc/sync_socket_unittest.cc | |
parent | de23ed934a0ed25ed0c371256e1f8f0355d465d2 (diff) | |
download | chromium_src-1e1f1a7eb400cfd9094262315fc03d6a4e13fa1b.zip chromium_src-1e1f1a7eb400cfd9094262315fc03d6a4e13fa1b.tar.gz chromium_src-1e1f1a7eb400cfd9094262315fc03d6a4e13fa1b.tar.bz2 |
Add an implementation of base::SyncSocket::Peek for posix platforms. Also
update the unit test to test the result.
TEST=ipc_tests/sync_socket_unittest.cc
Review URL: http://codereview.chromium.org/468023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33944 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/sync_socket_unittest.cc')
-rw-r--r-- | ipc/sync_socket_unittest.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc index 7710c09..c33d99a 100644 --- a/ipc/sync_socket_unittest.cc +++ b/ipc/sync_socket_unittest.cc @@ -189,14 +189,14 @@ class SyncSocketClientListener : public IPC::Channel::Listener { // 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)); EXPECT_TRUE(chan_->Send(msg)); @@ -221,6 +221,9 @@ TEST_F(SyncSocketTest, SanityTest) { // 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()); |