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

Unified Diff: net/socket/transport_client_socket_unittest.cc

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/tcp_server_socket_unittest.cc ('k') | net/socket/unix_domain_socket_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/transport_client_socket_unittest.cc
diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc
index b5935e32faa3e29256b425e4725ddbc93bbc1c2f..2f75e740067d5f126002a478f0cc3682e5126dd1 100644
--- a/net/socket/transport_client_socket_unittest.cc
+++ b/net/socket/transport_client_socket_unittest.cc
@@ -116,7 +116,7 @@ void TransportClientSocketTest::SetUp() {
if (sock.get())
break;
}
- ASSERT_TRUE(sock != NULL);
+ ASSERT_TRUE(sock.get() != NULL);
listen_sock_ = sock;
listen_port_ = port;
@@ -164,8 +164,8 @@ void TransportClientSocketTest::SendClientRequest() {
int rv;
memcpy(request_buffer->data(), request_text, arraysize(request_text) - 1);
- rv = sock_->Write(request_buffer, arraysize(request_text) - 1,
- callback.callback());
+ rv = sock_->Write(
+ request_buffer.get(), arraysize(request_text) - 1, callback.callback());
EXPECT_TRUE(rv >= 0 || rv == ERR_IO_PENDING);
if (rv == ERR_IO_PENDING)
@@ -225,7 +225,7 @@ TEST_P(TransportClientSocketTest, IsConnected) {
SendClientRequest();
// Drain a single byte so we know we've received some data.
- bytes_read = DrainClientSocket(buf, 1, 1, &callback);
+ bytes_read = DrainClientSocket(buf.get(), 1, 1, &callback);
ASSERT_EQ(bytes_read, 1u);
// Socket should be considered connected, but not idle, due to
@@ -233,8 +233,8 @@ TEST_P(TransportClientSocketTest, IsConnected) {
EXPECT_TRUE(sock_->IsConnected());
EXPECT_FALSE(sock_->IsConnectedAndIdle());
- bytes_read = DrainClientSocket(buf, 4096, arraysize(kServerReply) - 2,
- &callback);
+ bytes_read = DrainClientSocket(
+ buf.get(), 4096, arraysize(kServerReply) - 2, &callback);
ASSERT_EQ(bytes_read, arraysize(kServerReply) - 2);
// After draining the data, the socket should be back to connected
@@ -246,15 +246,15 @@ TEST_P(TransportClientSocketTest, IsConnected) {
set_close_server_socket_on_next_send(true);
SendClientRequest();
- bytes_read = DrainClientSocket(buf, 1, 1, &callback);
+ bytes_read = DrainClientSocket(buf.get(), 1, 1, &callback);
ASSERT_EQ(bytes_read, 1u);
// As above because of data.
EXPECT_TRUE(sock_->IsConnected());
EXPECT_FALSE(sock_->IsConnectedAndIdle());
- bytes_read = DrainClientSocket(buf, 4096, arraysize(kServerReply) - 2,
- &callback);
+ bytes_read = DrainClientSocket(
+ buf.get(), 4096, arraysize(kServerReply) - 2, &callback);
ASSERT_EQ(bytes_read, arraysize(kServerReply) - 2);
// Once the data is drained, the socket should now be seen as not
@@ -262,7 +262,7 @@ TEST_P(TransportClientSocketTest, IsConnected) {
if (sock_->IsConnected()) {
// In the unlikely event that the server's connection closure is not
// processed in time, wait for the connection to be closed.
- rv = sock_->Read(buf, 4096, callback.callback());
+ rv = sock_->Read(buf.get(), 4096, callback.callback());
EXPECT_EQ(0, callback.GetResult(rv));
EXPECT_FALSE(sock_->IsConnected());
}
@@ -281,14 +281,14 @@ TEST_P(TransportClientSocketTest, Read) {
SendClientRequest();
scoped_refptr<IOBuffer> buf(new IOBuffer(4096));
- uint32 bytes_read = DrainClientSocket(buf, 4096, arraysize(kServerReply) - 1,
- &callback);
+ uint32 bytes_read = DrainClientSocket(
+ buf.get(), 4096, arraysize(kServerReply) - 1, &callback);
ASSERT_EQ(bytes_read, arraysize(kServerReply) - 1);
// All data has been read now. Read once more to force an ERR_IO_PENDING, and
// then close the server socket, and note the close.
- rv = sock_->Read(buf, 4096, callback.callback());
+ rv = sock_->Read(buf.get(), 4096, callback.callback());
ASSERT_EQ(ERR_IO_PENDING, rv);
CloseServerSocket();
EXPECT_EQ(0, callback.WaitForResult());
@@ -308,7 +308,7 @@ TEST_P(TransportClientSocketTest, Read_SmallChunks) {
scoped_refptr<IOBuffer> buf(new IOBuffer(1));
uint32 bytes_read = 0;
while (bytes_read < arraysize(kServerReply) - 1) {
- rv = sock_->Read(buf, 1, callback.callback());
+ rv = sock_->Read(buf.get(), 1, callback.callback());
EXPECT_TRUE(rv >= 0 || rv == ERR_IO_PENDING);
if (rv == ERR_IO_PENDING)
@@ -321,7 +321,7 @@ TEST_P(TransportClientSocketTest, Read_SmallChunks) {
// All data has been read now. Read once more to force an ERR_IO_PENDING, and
// then close the server socket, and note the close.
- rv = sock_->Read(buf, 1, callback.callback());
+ rv = sock_->Read(buf.get(), 1, callback.callback());
ASSERT_EQ(ERR_IO_PENDING, rv);
CloseServerSocket();
EXPECT_EQ(0, callback.WaitForResult());
@@ -340,7 +340,7 @@ TEST_P(TransportClientSocketTest, Read_Interrupted) {
// Do a partial read and then exit. This test should not crash!
scoped_refptr<IOBuffer> buf(new IOBuffer(16));
- rv = sock_->Read(buf, 16, callback.callback());
+ rv = sock_->Read(buf.get(), 16, callback.callback());
EXPECT_TRUE(rv >= 0 || rv == ERR_IO_PENDING);
if (rv == ERR_IO_PENDING)
@@ -362,7 +362,7 @@ TEST_P(TransportClientSocketTest, DISABLED_FullDuplex_ReadFirst) {
// Read first. There's no data, so it should return ERR_IO_PENDING.
const int kBufLen = 4096;
scoped_refptr<IOBuffer> buf(new IOBuffer(kBufLen));
- rv = sock_->Read(buf, kBufLen, callback.callback());
+ rv = sock_->Read(buf.get(), kBufLen, callback.callback());
EXPECT_EQ(ERR_IO_PENDING, rv);
PauseServerReads();
@@ -373,7 +373,8 @@ TEST_P(TransportClientSocketTest, DISABLED_FullDuplex_ReadFirst) {
TestCompletionCallback write_callback;
while (true) {
- rv = sock_->Write(request_buffer, kWriteBufLen, write_callback.callback());
+ rv = sock_->Write(
+ request_buffer.get(), kWriteBufLen, write_callback.callback());
ASSERT_TRUE(rv >= 0 || rv == ERR_IO_PENDING);
if (rv == ERR_IO_PENDING) {
@@ -409,7 +410,8 @@ TEST_P(TransportClientSocketTest, DISABLED_FullDuplex_WriteFirst) {
TestCompletionCallback write_callback;
while (true) {
- rv = sock_->Write(request_buffer, kWriteBufLen, write_callback.callback());
+ rv = sock_->Write(
+ request_buffer.get(), kWriteBufLen, write_callback.callback());
ASSERT_TRUE(rv >= 0 || rv == ERR_IO_PENDING);
if (rv == ERR_IO_PENDING)
@@ -422,7 +424,7 @@ TEST_P(TransportClientSocketTest, DISABLED_FullDuplex_WriteFirst) {
const int kBufLen = 4096;
scoped_refptr<IOBuffer> buf(new IOBuffer(kBufLen));
while (true) {
- rv = sock_->Read(buf, kBufLen, callback.callback());
+ rv = sock_->Read(buf.get(), kBufLen, callback.callback());
ASSERT_TRUE(rv >= 0 || rv == ERR_IO_PENDING);
if (rv == ERR_IO_PENDING)
break;
« no previous file with comments | « net/socket/tcp_server_socket_unittest.cc ('k') | net/socket/unix_domain_socket_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698