OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tcp_client_socket_pool.h" | 5 #include "net/socket/tcp_client_socket_pool.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "net/base/mock_host_resolver.h" | 10 #include "net/base/mock_host_resolver.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 virtual void Disconnect() { | 37 virtual void Disconnect() { |
38 connected_ = false; | 38 connected_ = false; |
39 } | 39 } |
40 virtual bool IsConnected() const { | 40 virtual bool IsConnected() const { |
41 return connected_; | 41 return connected_; |
42 } | 42 } |
43 virtual bool IsConnectedAndIdle() const { | 43 virtual bool IsConnectedAndIdle() const { |
44 return connected_; | 44 return connected_; |
45 } | 45 } |
46 virtual int GetPeerName(struct sockaddr* name, socklen_t* namelen) { | 46 virtual int GetPeerAddress(AddressList* address) const { |
47 return ERR_UNEXPECTED; | 47 return ERR_UNEXPECTED; |
48 } | 48 } |
49 | 49 |
50 // Socket methods: | 50 // Socket methods: |
51 virtual int Read(IOBuffer* buf, int buf_len, | 51 virtual int Read(IOBuffer* buf, int buf_len, |
52 CompletionCallback* callback) { | 52 CompletionCallback* callback) { |
53 return ERR_FAILED; | 53 return ERR_FAILED; |
54 } | 54 } |
55 virtual int Write(IOBuffer* buf, int buf_len, | 55 virtual int Write(IOBuffer* buf, int buf_len, |
56 CompletionCallback* callback) { | 56 CompletionCallback* callback) { |
(...skipping 16 matching lines...) Expand all Loading... |
73 } | 73 } |
74 | 74 |
75 virtual void Disconnect() {} | 75 virtual void Disconnect() {} |
76 | 76 |
77 virtual bool IsConnected() const { | 77 virtual bool IsConnected() const { |
78 return false; | 78 return false; |
79 } | 79 } |
80 virtual bool IsConnectedAndIdle() const { | 80 virtual bool IsConnectedAndIdle() const { |
81 return false; | 81 return false; |
82 } | 82 } |
83 virtual int GetPeerName(struct sockaddr* name, socklen_t* namelen) { | 83 virtual int GetPeerAddress(AddressList* address) const { |
84 return ERR_UNEXPECTED; | 84 return ERR_UNEXPECTED; |
85 } | 85 } |
86 | 86 |
87 // Socket methods: | 87 // Socket methods: |
88 virtual int Read(IOBuffer* buf, int buf_len, | 88 virtual int Read(IOBuffer* buf, int buf_len, |
89 CompletionCallback* callback) { | 89 CompletionCallback* callback) { |
90 return ERR_FAILED; | 90 return ERR_FAILED; |
91 } | 91 } |
92 | 92 |
93 virtual int Write(IOBuffer* buf, int buf_len, | 93 virtual int Write(IOBuffer* buf, int buf_len, |
(...skipping 21 matching lines...) Expand all Loading... |
115 } | 115 } |
116 | 116 |
117 virtual void Disconnect() {} | 117 virtual void Disconnect() {} |
118 | 118 |
119 virtual bool IsConnected() const { | 119 virtual bool IsConnected() const { |
120 return is_connected_; | 120 return is_connected_; |
121 } | 121 } |
122 virtual bool IsConnectedAndIdle() const { | 122 virtual bool IsConnectedAndIdle() const { |
123 return is_connected_; | 123 return is_connected_; |
124 } | 124 } |
125 virtual int GetPeerName(struct sockaddr* name, socklen_t* namelen) { | 125 virtual int GetPeerAddress(AddressList* address) const{ |
126 return ERR_UNEXPECTED; | 126 return ERR_UNEXPECTED; |
127 } | 127 } |
128 | 128 |
129 // Socket methods: | 129 // Socket methods: |
130 virtual int Read(IOBuffer* buf, int buf_len, | 130 virtual int Read(IOBuffer* buf, int buf_len, |
131 CompletionCallback* callback) { | 131 CompletionCallback* callback) { |
132 return ERR_FAILED; | 132 return ERR_FAILED; |
133 } | 133 } |
134 | 134 |
135 virtual int Write(IOBuffer* buf, int buf_len, | 135 virtual int Write(IOBuffer* buf, int buf_len, |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 EXPECT_EQ(1, pool_->IdleSocketCount()); | 623 EXPECT_EQ(1, pool_->IdleSocketCount()); |
624 | 624 |
625 // After an IP address change, we should have 0 idle sockets. | 625 // After an IP address change, we should have 0 idle sockets. |
626 notifier_.NotifyIPAddressChange(); | 626 notifier_.NotifyIPAddressChange(); |
627 EXPECT_EQ(0, pool_->IdleSocketCount()); | 627 EXPECT_EQ(0, pool_->IdleSocketCount()); |
628 } | 628 } |
629 | 629 |
630 } // namespace | 630 } // namespace |
631 | 631 |
632 } // namespace net | 632 } // namespace net |
OLD | NEW |