| 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/socket_test_util.h" | 5 #include "net/socket/socket_test_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 | 10 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 pending_buf_len_(0), | 180 pending_buf_len_(0), |
| 181 pending_callback_(NULL) { | 181 pending_callback_(NULL) { |
| 182 DCHECK(data_); | 182 DCHECK(data_); |
| 183 data_->Reset(); | 183 data_->Reset(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 int MockTCPClientSocket::Connect(net::CompletionCallback* callback) { | 186 int MockTCPClientSocket::Connect(net::CompletionCallback* callback) { |
| 187 if (connected_) | 187 if (connected_) |
| 188 return net::OK; | 188 return net::OK; |
| 189 connected_ = true; | 189 connected_ = true; |
| 190 peer_closed_connection_ = false; |
| 190 if (data_->connect_data().async) { | 191 if (data_->connect_data().async) { |
| 191 RunCallbackAsync(callback, data_->connect_data().result); | 192 RunCallbackAsync(callback, data_->connect_data().result); |
| 192 return net::ERR_IO_PENDING; | 193 return net::ERR_IO_PENDING; |
| 193 } | 194 } |
| 194 return data_->connect_data().result; | 195 return data_->connect_data().result; |
| 195 } | 196 } |
| 196 | 197 |
| 197 void MockTCPClientSocket::Disconnect() { | 198 void MockTCPClientSocket::Disconnect() { |
| 198 MockClientSocket::Disconnect(); | 199 MockClientSocket::Disconnect(); |
| 199 pending_callback_ = NULL; | 200 pending_callback_ = NULL; |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 | 895 |
| 895 const char kSOCKS5OkRequest[] = | 896 const char kSOCKS5OkRequest[] = |
| 896 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 897 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
| 897 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 898 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
| 898 | 899 |
| 899 const char kSOCKS5OkResponse[] = | 900 const char kSOCKS5OkResponse[] = |
| 900 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 901 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
| 901 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 902 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
| 902 | 903 |
| 903 } // namespace net | 904 } // namespace net |
| OLD | NEW |