| 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/socks_client_socket.h" | 5 #include "net/socket/socks_client_socket.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
| 12 #include "net/base/test_completion_callback.h" | 12 #include "net/base/test_completion_callback.h" |
| 13 #include "net/base/winsock_init.h" | 13 #include "net/base/winsock_init.h" |
| 14 #include "net/dns/host_resolver.h" | 14 #include "net/dns/host_resolver.h" |
| 15 #include "net/dns/mock_host_resolver.h" | 15 #include "net/dns/mock_host_resolver.h" |
| 16 #include "net/log/net_log.h" | |
| 17 #include "net/log/net_log_event_type.h" | 16 #include "net/log/net_log_event_type.h" |
| 18 #include "net/log/test_net_log.h" | 17 #include "net/log/test_net_log.h" |
| 19 #include "net/log/test_net_log_entry.h" | 18 #include "net/log/test_net_log_entry.h" |
| 20 #include "net/log/test_net_log_util.h" | 19 #include "net/log/test_net_log_util.h" |
| 21 #include "net/socket/client_socket_factory.h" | 20 #include "net/socket/client_socket_factory.h" |
| 22 #include "net/socket/socket_test_util.h" | 21 #include "net/socket/socket_test_util.h" |
| 23 #include "net/socket/tcp_client_socket.h" | 22 #include "net/socket/tcp_client_socket.h" |
| 24 #include "net/test/gtest_util.h" | 23 #include "net/test/gtest_util.h" |
| 25 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 27 #include "testing/platform_test.h" | 26 #include "testing/platform_test.h" |
| 28 | 27 |
| 29 using net::test::IsError; | 28 using net::test::IsError; |
| 30 using net::test::IsOk; | 29 using net::test::IsOk; |
| 31 | 30 |
| 32 //----------------------------------------------------------------------------- | 31 //----------------------------------------------------------------------------- |
| 33 | 32 |
| 34 namespace net { | 33 namespace net { |
| 35 | 34 |
| 35 class NetLog; |
| 36 |
| 36 const char kSOCKSOkRequest[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 37 const char kSOCKSOkRequest[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
| 37 const char kSOCKSOkReply[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 38 const char kSOCKSOkReply[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 38 | 39 |
| 39 class SOCKSClientSocketTest : public PlatformTest { | 40 class SOCKSClientSocketTest : public PlatformTest { |
| 40 public: | 41 public: |
| 41 SOCKSClientSocketTest(); | 42 SOCKSClientSocketTest(); |
| 42 // Create a SOCKSClientSocket on top of a MockSocket. | 43 // Create a SOCKSClientSocket on top of a MockSocket. |
| 43 std::unique_ptr<SOCKSClientSocket> BuildMockSocket( | 44 std::unique_ptr<SOCKSClientSocket> BuildMockSocket( |
| 44 MockRead reads[], | 45 MockRead reads[], |
| 45 size_t reads_count, | 46 size_t reads_count, |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 NULL, 0, | 462 NULL, 0, |
| 462 host_resolver.get(), | 463 host_resolver.get(), |
| 463 kHostName, 80, | 464 kHostName, 80, |
| 464 NULL); | 465 NULL); |
| 465 | 466 |
| 466 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, | 467 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, |
| 467 callback_.GetResult(user_sock_->Connect(callback_.callback()))); | 468 callback_.GetResult(user_sock_->Connect(callback_.callback()))); |
| 468 } | 469 } |
| 469 | 470 |
| 470 } // namespace net | 471 } // namespace net |
| OLD | NEW |