| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/socket/socks_client_socket.h" | 5 #include "net/socket/socks_client_socket.h" |
| 6 | 6 |
| 7 #include "net/base/address_list.h" | 7 #include "net/base/address_list.h" |
| 8 #include "net/base/net_log.h" | 8 #include "net/base/net_log.h" |
| 9 #include "net/base/net_log_unittest.h" | 9 #include "net/base/net_log_unittest.h" |
| 10 #include "net/base/mock_host_resolver.h" | 10 #include "net/base/mock_host_resolver.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 LogContainsBeginEvent(log.entries(), 0, NetLog::TYPE_SOCKS_CONNECT)); | 146 LogContainsBeginEvent(log.entries(), 0, NetLog::TYPE_SOCKS_CONNECT)); |
| 147 EXPECT_FALSE(user_sock_->IsConnected()); | 147 EXPECT_FALSE(user_sock_->IsConnected()); |
| 148 rv = callback_.WaitForResult(); | 148 rv = callback_.WaitForResult(); |
| 149 | 149 |
| 150 EXPECT_EQ(OK, rv); | 150 EXPECT_EQ(OK, rv); |
| 151 EXPECT_TRUE(user_sock_->IsConnected()); | 151 EXPECT_TRUE(user_sock_->IsConnected()); |
| 152 EXPECT_EQ(SOCKSClientSocket::kSOCKS4, user_sock_->socks_version_); | 152 EXPECT_EQ(SOCKSClientSocket::kSOCKS4, user_sock_->socks_version_); |
| 153 EXPECT_TRUE(LogContainsEndEvent( | 153 EXPECT_TRUE(LogContainsEndEvent( |
| 154 log.entries(), -1, NetLog::TYPE_SOCKS_CONNECT)); | 154 log.entries(), -1, NetLog::TYPE_SOCKS_CONNECT)); |
| 155 | 155 |
| 156 scoped_refptr<IOBuffer> buffer = new IOBuffer(payload_write.size()); | 156 scoped_refptr<IOBuffer> buffer(new IOBuffer(payload_write.size())); |
| 157 memcpy(buffer->data(), payload_write.data(), payload_write.size()); | 157 memcpy(buffer->data(), payload_write.data(), payload_write.size()); |
| 158 rv = user_sock_->Write(buffer, payload_write.size(), &callback_); | 158 rv = user_sock_->Write(buffer, payload_write.size(), &callback_); |
| 159 EXPECT_EQ(ERR_IO_PENDING, rv); | 159 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 160 rv = callback_.WaitForResult(); | 160 rv = callback_.WaitForResult(); |
| 161 EXPECT_EQ(static_cast<int>(payload_write.size()), rv); | 161 EXPECT_EQ(static_cast<int>(payload_write.size()), rv); |
| 162 | 162 |
| 163 buffer = new IOBuffer(payload_read.size()); | 163 buffer = new IOBuffer(payload_read.size()); |
| 164 rv = user_sock_->Read(buffer, payload_read.size(), &callback_); | 164 rv = user_sock_->Read(buffer, payload_read.size(), &callback_); |
| 165 EXPECT_EQ(ERR_IO_PENDING, rv); | 165 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 166 rv = callback_.WaitForResult(); | 166 rv = callback_.WaitForResult(); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // Disconnect the SOCKS socket -- this should cancel the outstanding resolve. | 409 // Disconnect the SOCKS socket -- this should cancel the outstanding resolve. |
| 410 user_sock_->Disconnect(); | 410 user_sock_->Disconnect(); |
| 411 | 411 |
| 412 EXPECT_FALSE(hanging_resolver->HasOutstandingRequest()); | 412 EXPECT_FALSE(hanging_resolver->HasOutstandingRequest()); |
| 413 | 413 |
| 414 EXPECT_FALSE(user_sock_->IsConnected()); | 414 EXPECT_FALSE(user_sock_->IsConnected()); |
| 415 EXPECT_FALSE(user_sock_->IsConnectedAndIdle()); | 415 EXPECT_FALSE(user_sock_->IsConnectedAndIdle()); |
| 416 } | 416 } |
| 417 | 417 |
| 418 } // namespace net | 418 } // namespace net |
| OLD | NEW |