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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "net/base/test_completion_callback.h" | 11 #include "net/base/test_completion_callback.h" |
12 #include "net/cert/mock_cert_verifier.h" | 12 #include "net/cert/mock_cert_verifier.h" |
13 #include "net/dns/mock_host_resolver.h" | 13 #include "net/dns/mock_host_resolver.h" |
14 #include "net/http/http_auth_handler_factory.h" | 14 #include "net/http/http_auth_handler_factory.h" |
15 #include "net/http/http_network_session.h" | 15 #include "net/http/http_network_session.h" |
16 #include "net/http/http_network_transaction.h" | 16 #include "net/http/http_network_transaction.h" |
17 #include "net/http/http_server_properties_impl.h" | 17 #include "net/http/http_server_properties_impl.h" |
18 #include "net/http/http_stream.h" | 18 #include "net/http/http_stream.h" |
19 #include "net/http/http_stream_factory.h" | 19 #include "net/http/http_stream_factory.h" |
20 #include "net/http/http_transaction_test_util.h" | 20 #include "net/http/http_transaction_test_util.h" |
21 #include "net/http/transport_security_state.h" | 21 #include "net/http/transport_security_state.h" |
22 #include "net/log/capturing_net_log.h" | |
23 #include "net/log/net_log_unittest.h" | 22 #include "net/log/net_log_unittest.h" |
| 23 #include "net/log/test_net_log.h" |
24 #include "net/proxy/proxy_config_service_fixed.h" | 24 #include "net/proxy/proxy_config_service_fixed.h" |
25 #include "net/proxy/proxy_resolver.h" | 25 #include "net/proxy/proxy_resolver.h" |
26 #include "net/proxy/proxy_service.h" | 26 #include "net/proxy/proxy_service.h" |
27 #include "net/quic/crypto/quic_decrypter.h" | 27 #include "net/quic/crypto/quic_decrypter.h" |
28 #include "net/quic/crypto/quic_encrypter.h" | 28 #include "net/quic/crypto/quic_encrypter.h" |
29 #include "net/quic/quic_framer.h" | 29 #include "net/quic/quic_framer.h" |
30 #include "net/quic/quic_http_utils.h" | 30 #include "net/quic/quic_http_utils.h" |
31 #include "net/quic/test_tools/crypto_test_utils.h" | 31 #include "net/quic/test_tools/crypto_test_utils.h" |
32 #include "net/quic/test_tools/mock_clock.h" | 32 #include "net/quic/test_tools/mock_clock.h" |
33 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" | 33 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 MockHostResolver host_resolver_; | 346 MockHostResolver host_resolver_; |
347 MockCertVerifier cert_verifier_; | 347 MockCertVerifier cert_verifier_; |
348 TransportSecurityState transport_security_state_; | 348 TransportSecurityState transport_security_state_; |
349 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_; | 349 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_; |
350 scoped_ptr<ProxyService> proxy_service_; | 350 scoped_ptr<ProxyService> proxy_service_; |
351 scoped_ptr<HttpAuthHandlerFactory> auth_handler_factory_; | 351 scoped_ptr<HttpAuthHandlerFactory> auth_handler_factory_; |
352 MockRandom random_generator_; | 352 MockRandom random_generator_; |
353 HttpServerPropertiesImpl http_server_properties; | 353 HttpServerPropertiesImpl http_server_properties; |
354 HttpNetworkSession::Params params_; | 354 HttpNetworkSession::Params params_; |
355 HttpRequestInfo request_; | 355 HttpRequestInfo request_; |
356 CapturingBoundNetLog net_log_; | 356 BoundTestNetLog net_log_; |
357 StaticSocketDataProvider hanging_data_; | 357 StaticSocketDataProvider hanging_data_; |
358 | 358 |
359 private: | 359 private: |
360 void SendRequestAndExpectQuicResponseMaybeFromProxy( | 360 void SendRequestAndExpectQuicResponseMaybeFromProxy( |
361 const std::string& expected, | 361 const std::string& expected, |
362 bool used_proxy, | 362 bool used_proxy, |
363 uint16 port) { | 363 uint16 port) { |
364 scoped_ptr<HttpNetworkTransaction> trans( | 364 scoped_ptr<HttpNetworkTransaction> trans( |
365 new HttpNetworkTransaction(DEFAULT_PRIORITY, session_.get())); | 365 new HttpNetworkTransaction(DEFAULT_PRIORITY, session_.get())); |
366 ProxyHeadersHandler proxy_headers_handler; | 366 ProxyHeadersHandler proxy_headers_handler; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 398 |
399 // The non-alternate protocol job needs to hang in order to guarantee that | 399 // The non-alternate protocol job needs to hang in order to guarantee that |
400 // the alternate-protocol job will "win". | 400 // the alternate-protocol job will "win". |
401 AddHangingNonAlternateProtocolSocketData(); | 401 AddHangingNonAlternateProtocolSocketData(); |
402 | 402 |
403 CreateSession(); | 403 CreateSession(); |
404 | 404 |
405 SendRequestAndExpectQuicResponse("hello!"); | 405 SendRequestAndExpectQuicResponse("hello!"); |
406 | 406 |
407 // Check that the NetLog was filled reasonably. | 407 // Check that the NetLog was filled reasonably. |
408 net::CapturingNetLog::CapturedEntryList entries; | 408 net::TestNetLog::CapturedEntryList entries; |
409 net_log_.GetEntries(&entries); | 409 net_log_.GetEntries(&entries); |
410 EXPECT_LT(0u, entries.size()); | 410 EXPECT_LT(0u, entries.size()); |
411 | 411 |
412 // Check that we logged a QUIC_SESSION_PACKET_RECEIVED. | 412 // Check that we logged a QUIC_SESSION_PACKET_RECEIVED. |
413 int pos = net::ExpectLogContainsSomewhere( | 413 int pos = net::ExpectLogContainsSomewhere( |
414 entries, 0, | 414 entries, 0, |
415 net::NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED, | 415 net::NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED, |
416 net::NetLog::PHASE_NONE); | 416 net::NetLog::PHASE_NONE); |
417 EXPECT_LT(0, pos); | 417 EXPECT_LT(0, pos); |
418 | 418 |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 nullptr, | 1167 nullptr, |
1168 net_log_.bound()); | 1168 net_log_.bound()); |
1169 | 1169 |
1170 CreateSessionWithNextProtos(); | 1170 CreateSessionWithNextProtos(); |
1171 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 1171 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
1172 SendRequestAndExpectHttpResponse("hello world"); | 1172 SendRequestAndExpectHttpResponse("hello world"); |
1173 } | 1173 } |
1174 | 1174 |
1175 } // namespace test | 1175 } // namespace test |
1176 } // namespace net | 1176 } // namespace net |
OLD | NEW |