OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/transport_client_socket_pool_test_util.h" | 5 #include "net/socket/transport_client_socket_pool_test_util.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 else | 64 else |
65 SetIPv6Address(address); | 65 SetIPv6Address(address); |
66 return OK; | 66 return OK; |
67 } | 67 } |
68 const BoundNetLog& NetLog() const override { return net_log_; } | 68 const BoundNetLog& NetLog() const override { return net_log_; } |
69 | 69 |
70 void SetSubresourceSpeculation() override {} | 70 void SetSubresourceSpeculation() override {} |
71 void SetOmniboxSpeculation() override {} | 71 void SetOmniboxSpeculation() override {} |
72 bool WasEverUsed() const override { return false; } | 72 bool WasEverUsed() const override { return false; } |
73 void EnableTCPFastOpenIfSupported() override { use_tcp_fastopen_ = true; } | 73 void EnableTCPFastOpenIfSupported() override { use_tcp_fastopen_ = true; } |
74 bool UsingTCPFastOpen() const override { return use_tcp_fastopen_; } | |
75 bool WasNpnNegotiated() const override { return false; } | 74 bool WasNpnNegotiated() const override { return false; } |
76 NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } | 75 NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } |
77 bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } | 76 bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } |
78 void GetConnectionAttempts(ConnectionAttempts* out) const override { | 77 void GetConnectionAttempts(ConnectionAttempts* out) const override { |
79 out->clear(); | 78 out->clear(); |
80 } | 79 } |
81 void ClearConnectionAttempts() override {} | 80 void ClearConnectionAttempts() override {} |
82 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {} | 81 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {} |
83 int64_t GetTotalReceivedBytes() const override { | 82 int64_t GetTotalReceivedBytes() const override { |
84 NOTIMPLEMENTED(); | 83 NOTIMPLEMENTED(); |
(...skipping 11 matching lines...) Expand all Loading... | |
96 const CompletionCallback& callback) override { | 95 const CompletionCallback& callback) override { |
97 return ERR_FAILED; | 96 return ERR_FAILED; |
98 } | 97 } |
99 int SetReceiveBufferSize(int32_t size) override { return OK; } | 98 int SetReceiveBufferSize(int32_t size) override { return OK; } |
100 int SetSendBufferSize(int32_t size) override { return OK; } | 99 int SetSendBufferSize(int32_t size) override { return OK; } |
101 | 100 |
102 private: | 101 private: |
103 bool connected_; | 102 bool connected_; |
104 const AddressList addrlist_; | 103 const AddressList addrlist_; |
105 BoundNetLog net_log_; | 104 BoundNetLog net_log_; |
106 bool use_tcp_fastopen_; | 105 bool use_tcp_fastopen_; |
mmenke
2016/03/22 14:43:33
I believe this variable can be removed from all 3
tfarina
2016/03/22 16:30:36
Done.
| |
107 | 106 |
108 DISALLOW_COPY_AND_ASSIGN(MockConnectClientSocket); | 107 DISALLOW_COPY_AND_ASSIGN(MockConnectClientSocket); |
109 }; | 108 }; |
110 | 109 |
111 class MockFailingClientSocket : public StreamSocket { | 110 class MockFailingClientSocket : public StreamSocket { |
112 public: | 111 public: |
113 MockFailingClientSocket(const AddressList& addrlist, net::NetLog* net_log) | 112 MockFailingClientSocket(const AddressList& addrlist, net::NetLog* net_log) |
114 : addrlist_(addrlist), | 113 : addrlist_(addrlist), |
115 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)), | 114 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)), |
116 use_tcp_fastopen_(false) {} | 115 use_tcp_fastopen_(false) {} |
(...skipping 12 matching lines...) Expand all Loading... | |
129 } | 128 } |
130 int GetLocalAddress(IPEndPoint* address) const override { | 129 int GetLocalAddress(IPEndPoint* address) const override { |
131 return ERR_UNEXPECTED; | 130 return ERR_UNEXPECTED; |
132 } | 131 } |
133 const BoundNetLog& NetLog() const override { return net_log_; } | 132 const BoundNetLog& NetLog() const override { return net_log_; } |
134 | 133 |
135 void SetSubresourceSpeculation() override {} | 134 void SetSubresourceSpeculation() override {} |
136 void SetOmniboxSpeculation() override {} | 135 void SetOmniboxSpeculation() override {} |
137 bool WasEverUsed() const override { return false; } | 136 bool WasEverUsed() const override { return false; } |
138 void EnableTCPFastOpenIfSupported() override { use_tcp_fastopen_ = true; } | 137 void EnableTCPFastOpenIfSupported() override { use_tcp_fastopen_ = true; } |
139 bool UsingTCPFastOpen() const override { return use_tcp_fastopen_; } | |
140 bool WasNpnNegotiated() const override { return false; } | 138 bool WasNpnNegotiated() const override { return false; } |
141 NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } | 139 NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } |
142 bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } | 140 bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } |
143 void GetConnectionAttempts(ConnectionAttempts* out) const override { | 141 void GetConnectionAttempts(ConnectionAttempts* out) const override { |
144 out->clear(); | 142 out->clear(); |
145 for (const auto& addr : addrlist_) | 143 for (const auto& addr : addrlist_) |
146 out->push_back(ConnectionAttempt(addr, ERR_CONNECTION_FAILED)); | 144 out->push_back(ConnectionAttempt(addr, ERR_CONNECTION_FAILED)); |
147 } | 145 } |
148 void ClearConnectionAttempts() override {} | 146 void ClearConnectionAttempts() override {} |
149 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {} | 147 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {} |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 else | 256 else |
259 SetIPv6Address(address); | 257 SetIPv6Address(address); |
260 return OK; | 258 return OK; |
261 } | 259 } |
262 const BoundNetLog& NetLog() const override { return net_log_; } | 260 const BoundNetLog& NetLog() const override { return net_log_; } |
263 | 261 |
264 void SetSubresourceSpeculation() override {} | 262 void SetSubresourceSpeculation() override {} |
265 void SetOmniboxSpeculation() override {} | 263 void SetOmniboxSpeculation() override {} |
266 bool WasEverUsed() const override { return false; } | 264 bool WasEverUsed() const override { return false; } |
267 void EnableTCPFastOpenIfSupported() override { use_tcp_fastopen_ = true; } | 265 void EnableTCPFastOpenIfSupported() override { use_tcp_fastopen_ = true; } |
268 bool UsingTCPFastOpen() const override { return use_tcp_fastopen_; } | |
269 bool WasNpnNegotiated() const override { return false; } | 266 bool WasNpnNegotiated() const override { return false; } |
270 NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } | 267 NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } |
271 bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } | 268 bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } |
272 void GetConnectionAttempts(ConnectionAttempts* out) const override { | 269 void GetConnectionAttempts(ConnectionAttempts* out) const override { |
273 *out = connection_attempts_; | 270 *out = connection_attempts_; |
274 } | 271 } |
275 void ClearConnectionAttempts() override { connection_attempts_.clear(); } | 272 void ClearConnectionAttempts() override { connection_attempts_.clear(); } |
276 void AddConnectionAttempts(const ConnectionAttempts& attempts) override { | 273 void AddConnectionAttempts(const ConnectionAttempts& attempts) override { |
277 connection_attempts_.insert(connection_attempts_.begin(), attempts.begin(), | 274 connection_attempts_.insert(connection_attempts_.begin(), attempts.begin(), |
278 attempts.end()); | 275 attempts.end()); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
464 run_loop_quit_closure_ = run_loop.QuitClosure(); | 461 run_loop_quit_closure_ = run_loop.QuitClosure(); |
465 run_loop.Run(); | 462 run_loop.Run(); |
466 run_loop_quit_closure_.Reset(); | 463 run_loop_quit_closure_.Reset(); |
467 } | 464 } |
468 base::Closure trigger = triggerable_sockets_.front(); | 465 base::Closure trigger = triggerable_sockets_.front(); |
469 triggerable_sockets_.pop(); | 466 triggerable_sockets_.pop(); |
470 return trigger; | 467 return trigger; |
471 } | 468 } |
472 | 469 |
473 } // namespace net | 470 } // namespace net |
OLD | NEW |