OLD | NEW |
1 // Copyright (c) 2009 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 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool MockClientSocket::IsConnected() const { | 45 bool MockClientSocket::IsConnected() const { |
46 return connected_; | 46 return connected_; |
47 } | 47 } |
48 | 48 |
49 bool MockClientSocket::IsConnectedAndIdle() const { | 49 bool MockClientSocket::IsConnectedAndIdle() const { |
50 return connected_; | 50 return connected_; |
51 } | 51 } |
52 | 52 |
53 int MockClientSocket::GetPeerAddress(AddressList* address) const { | 53 int MockClientSocket::GetPeerAddress(AddressList* address) const { |
54 return net::SystemHostResolverProc("localhost", ADDRESS_FAMILY_UNSPECIFIED, | 54 return net::SystemHostResolverProc("localhost", ADDRESS_FAMILY_UNSPECIFIED, |
55 address); | 55 0, address); |
56 } | 56 } |
57 | 57 |
58 void MockClientSocket::RunCallbackAsync(net::CompletionCallback* callback, | 58 void MockClientSocket::RunCallbackAsync(net::CompletionCallback* callback, |
59 int result) { | 59 int result) { |
60 MessageLoop::current()->PostTask(FROM_HERE, | 60 MessageLoop::current()->PostTask(FROM_HERE, |
61 method_factory_.NewRunnableMethod( | 61 method_factory_.NewRunnableMethod( |
62 &MockClientSocket::RunCallback, callback, result)); | 62 &MockClientSocket::RunCallback, callback, result)); |
63 } | 63 } |
64 | 64 |
65 void MockClientSocket::RunCallback(net::CompletionCallback* callback, | 65 void MockClientSocket::RunCallback(net::CompletionCallback* callback, |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 const char kSOCKS5OkRequest[] = | 504 const char kSOCKS5OkRequest[] = |
505 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 505 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
506 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 506 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
507 | 507 |
508 const char kSOCKS5OkResponse[] = | 508 const char kSOCKS5OkResponse[] = |
509 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 509 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
510 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 510 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
511 | 511 |
512 } // namespace net | 512 } // namespace net |
OLD | NEW |