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/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 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 } | 653 } |
654 | 654 |
655 bool MockClientSocket::IsConnected() const { | 655 bool MockClientSocket::IsConnected() const { |
656 return connected_; | 656 return connected_; |
657 } | 657 } |
658 | 658 |
659 bool MockClientSocket::IsConnectedAndIdle() const { | 659 bool MockClientSocket::IsConnectedAndIdle() const { |
660 return connected_; | 660 return connected_; |
661 } | 661 } |
662 | 662 |
663 int MockClientSocket::GetPeerAddress(AddressList* address) const { | 663 int MockClientSocket::GetPeerAddress(IPEndPoint* address) const { |
664 IPAddressNumber ip; | 664 IPAddressNumber ip; |
665 bool rv = ParseIPLiteralToNumber("192.0.2.33", &ip); | 665 bool rv = ParseIPLiteralToNumber("192.0.2.33", &ip); |
666 CHECK(rv); | 666 CHECK(rv); |
667 *address = AddressList::CreateFromIPAddress(ip, 0); | 667 *address = IPEndPoint(ip, 0); |
668 return OK; | 668 return OK; |
669 } | 669 } |
670 | 670 |
671 int MockClientSocket::GetLocalAddress(IPEndPoint* address) const { | 671 int MockClientSocket::GetLocalAddress(IPEndPoint* address) const { |
672 IPAddressNumber ip; | 672 IPAddressNumber ip; |
673 bool rv = ParseIPLiteralToNumber("192.0.2.33", &ip); | 673 bool rv = ParseIPLiteralToNumber("192.0.2.33", &ip); |
674 CHECK(rv); | 674 CHECK(rv); |
675 *address = IPEndPoint(ip, 123); | 675 *address = IPEndPoint(ip, 123); |
676 return OK; | 676 return OK; |
677 } | 677 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 } | 817 } |
818 | 818 |
819 bool MockTCPClientSocket::IsConnected() const { | 819 bool MockTCPClientSocket::IsConnected() const { |
820 return connected_ && !peer_closed_connection_; | 820 return connected_ && !peer_closed_connection_; |
821 } | 821 } |
822 | 822 |
823 bool MockTCPClientSocket::IsConnectedAndIdle() const { | 823 bool MockTCPClientSocket::IsConnectedAndIdle() const { |
824 return IsConnected(); | 824 return IsConnected(); |
825 } | 825 } |
826 | 826 |
827 int MockTCPClientSocket::GetPeerAddress(AddressList* address) const { | 827 int MockTCPClientSocket::GetPeerAddress(IPEndPoint* address) const { |
828 if (!IsConnected()) | 828 if (!IsConnected()) |
829 return ERR_SOCKET_NOT_CONNECTED; | 829 return ERR_SOCKET_NOT_CONNECTED; |
830 return MockClientSocket::GetPeerAddress(address); | 830 return MockClientSocket::GetPeerAddress(address); |
831 } | 831 } |
832 | 832 |
833 bool MockTCPClientSocket::WasEverUsed() const { | 833 bool MockTCPClientSocket::WasEverUsed() const { |
834 return was_used_to_convey_data_; | 834 return was_used_to_convey_data_; |
835 } | 835 } |
836 | 836 |
837 bool MockTCPClientSocket::UsingTCPFastOpen() const { | 837 bool MockTCPClientSocket::UsingTCPFastOpen() const { |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 | 1621 |
1622 const char kSOCKS5OkRequest[] = | 1622 const char kSOCKS5OkRequest[] = |
1623 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 1623 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
1624 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 1624 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
1625 | 1625 |
1626 const char kSOCKS5OkResponse[] = | 1626 const char kSOCKS5OkResponse[] = |
1627 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 1627 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
1628 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 1628 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
1629 | 1629 |
1630 } // namespace net | 1630 } // namespace net |
OLD | NEW |