diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 18:43:55 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 18:43:55 +0000 |
commit | 83039bbf2f2ec0e918f7000b5212d104f60f2bb7 (patch) | |
tree | b22dbd0051b57a437a588772a874271f0d02ffdb /net/udp/udp_socket_unittest.cc | |
parent | e7456a206fe5b50aeb322ebabd6c26adc869a5fd (diff) | |
download | chromium_src-83039bbf2f2ec0e918f7000b5212d104f60f2bb7.zip chromium_src-83039bbf2f2ec0e918f7000b5212d104f60f2bb7.tar.gz chromium_src-83039bbf2f2ec0e918f7000b5212d104f60f2bb7.tar.bz2 |
Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind().
This changes Socket::Read(), Socket::Write, and StreamSocket::Connect() to use CompletionCallback and fixes all users.
BUG=none
TEST=existing.
Review URL: http://codereview.chromium.org/8824006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/udp/udp_socket_unittest.cc')
-rw-r--r-- | net/udp/udp_socket_unittest.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/net/udp/udp_socket_unittest.cc b/net/udp/udp_socket_unittest.cc index 066b47c..5165d3d 100644 --- a/net/udp/udp_socket_unittest.cc +++ b/net/udp/udp_socket_unittest.cc @@ -32,10 +32,10 @@ class UDPSocketTest : public PlatformTest { // Blocks until data is read from the socket. std::string RecvFromSocket(UDPServerSocket* socket) { - TestOldCompletionCallback callback; + TestCompletionCallback callback; int rv = socket->RecvFrom(buffer_, kMaxRead, &recv_from_address_, - &callback); + callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); if (rv < 0) @@ -55,7 +55,7 @@ class UDPSocketTest : public PlatformTest { int SendToSocket(UDPServerSocket* socket, std::string msg, const IPEndPoint& address) { - TestOldCompletionCallback callback; + TestCompletionCallback callback; int length = msg.length(); scoped_refptr<StringIOBuffer> io_buffer(new StringIOBuffer(msg)); @@ -65,7 +65,7 @@ class UDPSocketTest : public PlatformTest { int bytes_sent = 0; while (buffer->BytesRemaining()) { int rv = socket->SendTo(buffer, buffer->BytesRemaining(), - address, &callback); + address, callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); if (rv <= 0) @@ -77,9 +77,9 @@ class UDPSocketTest : public PlatformTest { } std::string ReadSocket(UDPClientSocket* socket) { - TestOldCompletionCallback callback; + TestCompletionCallback callback; - int rv = socket->Read(buffer_, kMaxRead, &callback); + int rv = socket->Read(buffer_, kMaxRead, callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); if (rv < 0) @@ -90,7 +90,7 @@ class UDPSocketTest : public PlatformTest { // Loop until |msg| has been written to the socket or until an // error occurs. int WriteSocket(UDPClientSocket* socket, std::string msg) { - TestOldCompletionCallback callback; + TestCompletionCallback callback; int length = msg.length(); scoped_refptr<StringIOBuffer> io_buffer(new StringIOBuffer(msg)); @@ -99,7 +99,8 @@ class UDPSocketTest : public PlatformTest { int bytes_sent = 0; while (buffer->BytesRemaining()) { - int rv = socket->Write(buffer, buffer->BytesRemaining(), &callback); + int rv = socket->Write(buffer, buffer->BytesRemaining(), + callback.callback()); if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); if (rv <= 0) @@ -433,9 +434,9 @@ TEST_F(UDPSocketTest, CloseWithPendingRead) { int rv = server.Listen(bind_address); EXPECT_EQ(OK, rv); - TestOldCompletionCallback callback; + TestCompletionCallback callback; IPEndPoint from; - rv = server.RecvFrom(buffer_, kMaxRead, &from, &callback); + rv = server.RecvFrom(buffer_, kMaxRead, &from, callback.callback()); EXPECT_EQ(rv, ERR_IO_PENDING); server.Close(); |