OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_SPDY_SPDY_TEST_UTIL_H_ | 5 #ifndef NET_SPDY_SPDY_TEST_UTIL_H_ |
6 #define NET_SPDY_SPDY_TEST_UTIL_H_ | 6 #define NET_SPDY_SPDY_TEST_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "net/base/address_list.h" |
10 #include "net/base/cert_verifier.h" | 11 #include "net/base/cert_verifier.h" |
| 12 #include "net/base/host_port_pair.h" |
| 13 #include "net/base/ip_endpoint.h" |
11 #include "net/base/mock_host_resolver.h" | 14 #include "net/base/mock_host_resolver.h" |
12 #include "net/base/request_priority.h" | 15 #include "net/base/request_priority.h" |
13 #include "net/base/ssl_config_service_defaults.h" | 16 #include "net/base/ssl_config_service_defaults.h" |
| 17 #include "net/base/sys_addrinfo.h" |
14 #include "net/http/http_auth_handler_factory.h" | 18 #include "net/http/http_auth_handler_factory.h" |
15 #include "net/http/http_cache.h" | 19 #include "net/http/http_cache.h" |
16 #include "net/http/http_network_session.h" | 20 #include "net/http/http_network_session.h" |
17 #include "net/http/http_network_layer.h" | 21 #include "net/http/http_network_layer.h" |
18 #include "net/http/http_transaction_factory.h" | 22 #include "net/http/http_transaction_factory.h" |
| 23 #include "net/proxy/proxy_server.h" |
19 #include "net/proxy/proxy_service.h" | 24 #include "net/proxy/proxy_service.h" |
20 #include "net/socket/socket_test_util.h" | 25 #include "net/socket/socket_test_util.h" |
21 #include "net/spdy/spdy_framer.h" | 26 #include "net/spdy/spdy_framer.h" |
22 #include "net/url_request/url_request_context.h" | 27 #include "net/url_request/url_request_context.h" |
23 #include "net/url_request/url_request_context_storage.h" | 28 #include "net/url_request/url_request_context_storage.h" |
24 | 29 |
25 namespace net { | 30 namespace net { |
26 | 31 |
27 // Default upload data used by both, mock objects and framer when creating | 32 // Default upload data used by both, mock objects and framer when creating |
28 // data frames. | 33 // data frames. |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 net::URLRequestContextStorage storage_; | 374 net::URLRequestContextStorage storage_; |
370 }; | 375 }; |
371 | 376 |
372 const SpdyHeaderInfo MakeSpdyHeader(spdy::SpdyControlType type); | 377 const SpdyHeaderInfo MakeSpdyHeader(spdy::SpdyControlType type); |
373 | 378 |
374 class SpdySessionPoolPeer { | 379 class SpdySessionPoolPeer { |
375 public: | 380 public: |
376 explicit SpdySessionPoolPeer(SpdySessionPool* pool) | 381 explicit SpdySessionPoolPeer(SpdySessionPool* pool) |
377 : pool_(pool) {} | 382 : pool_(pool) {} |
378 | 383 |
| 384 void AddAliases(const net::HostPortProxyPair& pair) { |
| 385 net::AddressList addresses; |
| 386 if (!pool_->LookupAddresses(pair, &addresses)) |
| 387 return; |
| 388 const addrinfo* address = addresses.head(); |
| 389 while (address) { |
| 390 net::IPEndPoint endpoint; |
| 391 endpoint.FromSockAddr(address->ai_addr, address->ai_addrlen); |
| 392 pool_->AddAlias(endpoint, pair); |
| 393 address = address->ai_next; |
| 394 } |
| 395 } |
| 396 |
379 void RemoveSpdySession(const scoped_refptr<SpdySession>& session) { | 397 void RemoveSpdySession(const scoped_refptr<SpdySession>& session) { |
380 pool_->Remove(session); | 398 pool_->Remove(session); |
381 } | 399 } |
382 | 400 |
383 void DisableDomainAuthenticationVerification() { | 401 void DisableDomainAuthenticationVerification() { |
384 pool_->verify_domain_authentication_ = false; | 402 pool_->verify_domain_authentication_ = false; |
385 } | 403 } |
386 | 404 |
387 private: | 405 private: |
388 SpdySessionPool* const pool_; | 406 SpdySessionPool* const pool_; |
389 | 407 |
390 DISALLOW_COPY_AND_ASSIGN(SpdySessionPoolPeer); | 408 DISALLOW_COPY_AND_ASSIGN(SpdySessionPoolPeer); |
391 }; | 409 }; |
392 | 410 |
393 } // namespace net | 411 } // namespace net |
394 | 412 |
395 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ | 413 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ |
OLD | NEW |