| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/socks5_client_socket.h" | 5 #include "net/socket/socks5_client_socket.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 TEST_F(SOCKS5ClientSocketTest, ConnectAndDisconnectTwice) { | 187 TEST_F(SOCKS5ClientSocketTest, ConnectAndDisconnectTwice) { |
| 188 const std::string hostname = "my-host-name"; | 188 const std::string hostname = "my-host-name"; |
| 189 const char kSOCKS5DomainRequest[] = { | 189 const char kSOCKS5DomainRequest[] = { |
| 190 0x05, // VER | 190 0x05, // VER |
| 191 0x01, // CMD | 191 0x01, // CMD |
| 192 0x00, // RSV | 192 0x00, // RSV |
| 193 0x03, // ATYPE | 193 0x03, // ATYPE |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 std::string request(kSOCKS5DomainRequest, arraysize(kSOCKS5DomainRequest)); | 196 std::string request(kSOCKS5DomainRequest, arraysize(kSOCKS5DomainRequest)); |
| 197 request.push_back(hostname.size()); | 197 request.push_back(static_cast<char>(hostname.size())); |
| 198 request.append(hostname); | 198 request.append(hostname); |
| 199 request.append(reinterpret_cast<const char*>(&kNwPort), sizeof(kNwPort)); | 199 request.append(reinterpret_cast<const char*>(&kNwPort), sizeof(kNwPort)); |
| 200 | 200 |
| 201 for (int i = 0; i < 2; ++i) { | 201 for (int i = 0; i < 2; ++i) { |
| 202 MockWrite data_writes[] = { | 202 MockWrite data_writes[] = { |
| 203 MockWrite(SYNCHRONOUS, kSOCKS5GreetRequest, kSOCKS5GreetRequestLength), | 203 MockWrite(SYNCHRONOUS, kSOCKS5GreetRequest, kSOCKS5GreetRequestLength), |
| 204 MockWrite(SYNCHRONOUS, request.data(), request.size()) | 204 MockWrite(SYNCHRONOUS, request.data(), request.size()) |
| 205 }; | 205 }; |
| 206 MockRead data_reads[] = { | 206 MockRead data_reads[] = { |
| 207 MockRead(SYNCHRONOUS, kSOCKS5GreetResponse, kSOCKS5GreetResponseLength), | 207 MockRead(SYNCHRONOUS, kSOCKS5GreetResponse, kSOCKS5GreetResponseLength), |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 EXPECT_TRUE(user_sock_->IsConnected()); | 372 EXPECT_TRUE(user_sock_->IsConnected()); |
| 373 net_log_.GetEntries(&net_log_entries); | 373 net_log_.GetEntries(&net_log_entries); |
| 374 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1, | 374 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1, |
| 375 NetLog::TYPE_SOCKS5_CONNECT)); | 375 NetLog::TYPE_SOCKS5_CONNECT)); |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace | 379 } // namespace |
| 380 | 380 |
| 381 } // namespace net | 381 } // namespace net |
| OLD | NEW |