Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: net/quic/quic_network_transaction_unittest.cc

Issue 2067843003: Require a CTVerifier and CTPolicyEnforcer for TLS/QUIC sockets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixup Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_end_to_end_unittest.cc ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 5 #include <memory>
6 #include <ostream> 6 #include <ostream>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "net/base/chunked_upload_data_stream.h" 16 #include "net/base/chunked_upload_data_stream.h"
17 #include "net/base/test_completion_callback.h" 17 #include "net/base/test_completion_callback.h"
18 #include "net/base/test_data_directory.h" 18 #include "net/base/test_data_directory.h"
19 #include "net/cert/ct_policy_enforcer.h"
19 #include "net/cert/mock_cert_verifier.h" 20 #include "net/cert/mock_cert_verifier.h"
20 #include "net/cert/multi_log_ct_verifier.h" 21 #include "net/cert/multi_log_ct_verifier.h"
21 #include "net/dns/mock_host_resolver.h" 22 #include "net/dns/mock_host_resolver.h"
22 #include "net/http/http_auth_handler_factory.h" 23 #include "net/http/http_auth_handler_factory.h"
23 #include "net/http/http_network_session.h" 24 #include "net/http/http_network_session.h"
24 #include "net/http/http_network_transaction.h" 25 #include "net/http/http_network_transaction.h"
25 #include "net/http/http_server_properties_impl.h" 26 #include "net/http/http_server_properties_impl.h"
26 #include "net/http/http_stream.h" 27 #include "net/http/http_stream.h"
27 #include "net/http/http_stream_factory.h" 28 #include "net/http/http_stream_factory.h"
28 #include "net/http/http_transaction_test_util.h" 29 #include "net/http/http_transaction_test_util.h"
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 void CreateSession() { 505 void CreateSession() {
505 params_.enable_quic = true; 506 params_.enable_quic = true;
506 params_.quic_clock = clock_; 507 params_.quic_clock = clock_;
507 params_.quic_random = &random_generator_; 508 params_.quic_random = &random_generator_;
508 params_.client_socket_factory = &socket_factory_; 509 params_.client_socket_factory = &socket_factory_;
509 params_.quic_crypto_client_stream_factory = &crypto_client_stream_factory_; 510 params_.quic_crypto_client_stream_factory = &crypto_client_stream_factory_;
510 params_.host_resolver = &host_resolver_; 511 params_.host_resolver = &host_resolver_;
511 params_.cert_verifier = &cert_verifier_; 512 params_.cert_verifier = &cert_verifier_;
512 params_.transport_security_state = &transport_security_state_; 513 params_.transport_security_state = &transport_security_state_;
513 params_.cert_transparency_verifier = cert_transparency_verifier_.get(); 514 params_.cert_transparency_verifier = cert_transparency_verifier_.get();
515 params_.ct_policy_enforcer = &ct_policy_enforcer_;
514 params_.socket_performance_watcher_factory = 516 params_.socket_performance_watcher_factory =
515 &test_socket_performance_watcher_factory_; 517 &test_socket_performance_watcher_factory_;
516 params_.proxy_service = proxy_service_.get(); 518 params_.proxy_service = proxy_service_.get();
517 params_.ssl_config_service = ssl_config_service_.get(); 519 params_.ssl_config_service = ssl_config_service_.get();
518 params_.http_auth_handler_factory = auth_handler_factory_.get(); 520 params_.http_auth_handler_factory = auth_handler_factory_.get();
519 params_.http_server_properties = &http_server_properties_; 521 params_.http_server_properties = &http_server_properties_;
520 params_.quic_supported_versions = SupportedVersions(GetParam()); 522 params_.quic_supported_versions = SupportedVersions(GetParam());
521 for (const char* host : 523 for (const char* host :
522 {kDefaultServerHostName, "www.example.org", "news.example.org", 524 {kDefaultServerHostName, "www.example.org", "news.example.org",
523 "bar.example.org", "foo.example.org", "invalid.example.org", 525 "bar.example.org", "foo.example.org", "invalid.example.org",
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 QuicTestPacketMaker client_maker_; 649 QuicTestPacketMaker client_maker_;
648 QuicTestPacketMaker server_maker_; 650 QuicTestPacketMaker server_maker_;
649 std::unique_ptr<HttpNetworkSession> session_; 651 std::unique_ptr<HttpNetworkSession> session_;
650 MockClientSocketFactory socket_factory_; 652 MockClientSocketFactory socket_factory_;
651 ProofVerifyDetailsChromium verify_details_; 653 ProofVerifyDetailsChromium verify_details_;
652 MockCryptoClientStreamFactory crypto_client_stream_factory_; 654 MockCryptoClientStreamFactory crypto_client_stream_factory_;
653 MockHostResolver host_resolver_; 655 MockHostResolver host_resolver_;
654 MockCertVerifier cert_verifier_; 656 MockCertVerifier cert_verifier_;
655 TransportSecurityState transport_security_state_; 657 TransportSecurityState transport_security_state_;
656 std::unique_ptr<CTVerifier> cert_transparency_verifier_; 658 std::unique_ptr<CTVerifier> cert_transparency_verifier_;
659 CTPolicyEnforcer ct_policy_enforcer_;
657 TestSocketPerformanceWatcherFactory test_socket_performance_watcher_factory_; 660 TestSocketPerformanceWatcherFactory test_socket_performance_watcher_factory_;
658 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_; 661 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_;
659 std::unique_ptr<ProxyService> proxy_service_; 662 std::unique_ptr<ProxyService> proxy_service_;
660 std::unique_ptr<HttpAuthHandlerFactory> auth_handler_factory_; 663 std::unique_ptr<HttpAuthHandlerFactory> auth_handler_factory_;
661 MockRandom random_generator_; 664 MockRandom random_generator_;
662 HttpServerPropertiesImpl http_server_properties_; 665 HttpServerPropertiesImpl http_server_properties_;
663 HttpNetworkSession::Params params_; 666 HttpNetworkSession::Params params_;
664 HttpRequestInfo request_; 667 HttpRequestInfo request_;
665 BoundTestNetLog net_log_; 668 BoundTestNetLog net_log_;
666 std::vector<std::unique_ptr<StaticSocketDataProvider>> hanging_data_; 669 std::vector<std::unique_ptr<StaticSocketDataProvider>> hanging_data_;
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 params.quic_crypto_client_stream_factory = &crypto_client_stream_factory_; 2182 params.quic_crypto_client_stream_factory = &crypto_client_stream_factory_;
2180 2183
2181 params.enable_alternative_service_with_different_host = true; 2184 params.enable_alternative_service_with_different_host = true;
2182 params.enable_quic = true; 2185 params.enable_quic = true;
2183 params.quic_random = &random_generator_; 2186 params.quic_random = &random_generator_;
2184 params.client_socket_factory = &socket_factory_; 2187 params.client_socket_factory = &socket_factory_;
2185 params.host_resolver = &host_resolver_; 2188 params.host_resolver = &host_resolver_;
2186 params.cert_verifier = &cert_verifier_; 2189 params.cert_verifier = &cert_verifier_;
2187 params.transport_security_state = &transport_security_state_; 2190 params.transport_security_state = &transport_security_state_;
2188 params.cert_transparency_verifier = cert_transparency_verifier_.get(); 2191 params.cert_transparency_verifier = cert_transparency_verifier_.get();
2192 params.ct_policy_enforcer = &ct_policy_enforcer_;
2189 params.socket_performance_watcher_factory = 2193 params.socket_performance_watcher_factory =
2190 &test_socket_performance_watcher_factory_; 2194 &test_socket_performance_watcher_factory_;
2191 params.ssl_config_service = ssl_config_service_.get(); 2195 params.ssl_config_service = ssl_config_service_.get();
2192 params.proxy_service = proxy_service_.get(); 2196 params.proxy_service = proxy_service_.get();
2193 params.http_auth_handler_factory = auth_handler_factory_.get(); 2197 params.http_auth_handler_factory = auth_handler_factory_.get();
2194 params.http_server_properties = &http_server_properties_; 2198 params.http_server_properties = &http_server_properties_;
2195 params.quic_supported_versions = SupportedVersions(version_); 2199 params.quic_supported_versions = SupportedVersions(version_);
2196 params.quic_host_whitelist.insert("news.example.org"); 2200 params.quic_host_whitelist.insert("news.example.org");
2197 params.quic_host_whitelist.insert("mail.example.org"); 2201 params.quic_host_whitelist.insert("mail.example.org");
2198 params.quic_host_whitelist.insert("mail.example.com"); 2202 params.quic_host_whitelist.insert("mail.example.com");
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 QuicVersion version_; 2356 QuicVersion version_;
2353 DestinationType destination_type_; 2357 DestinationType destination_type_;
2354 std::string origin1_; 2358 std::string origin1_;
2355 std::string origin2_; 2359 std::string origin2_;
2356 std::unique_ptr<HttpNetworkSession> session_; 2360 std::unique_ptr<HttpNetworkSession> session_;
2357 MockClientSocketFactory socket_factory_; 2361 MockClientSocketFactory socket_factory_;
2358 MockHostResolver host_resolver_; 2362 MockHostResolver host_resolver_;
2359 MockCertVerifier cert_verifier_; 2363 MockCertVerifier cert_verifier_;
2360 TransportSecurityState transport_security_state_; 2364 TransportSecurityState transport_security_state_;
2361 std::unique_ptr<CTVerifier> cert_transparency_verifier_; 2365 std::unique_ptr<CTVerifier> cert_transparency_verifier_;
2366 CTPolicyEnforcer ct_policy_enforcer_;
2362 TestSocketPerformanceWatcherFactory test_socket_performance_watcher_factory_; 2367 TestSocketPerformanceWatcherFactory test_socket_performance_watcher_factory_;
2363 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_; 2368 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_;
2364 std::unique_ptr<ProxyService> proxy_service_; 2369 std::unique_ptr<ProxyService> proxy_service_;
2365 std::unique_ptr<HttpAuthHandlerFactory> auth_handler_factory_; 2370 std::unique_ptr<HttpAuthHandlerFactory> auth_handler_factory_;
2366 MockRandom random_generator_; 2371 MockRandom random_generator_;
2367 HttpServerPropertiesImpl http_server_properties_; 2372 HttpServerPropertiesImpl http_server_properties_;
2368 BoundTestNetLog net_log_; 2373 BoundTestNetLog net_log_;
2369 MockCryptoClientStreamFactory crypto_client_stream_factory_; 2374 MockCryptoClientStreamFactory crypto_client_stream_factory_;
2370 std::vector<std::unique_ptr<StaticSocketDataProvider>> 2375 std::vector<std::unique_ptr<StaticSocketDataProvider>>
2371 static_socket_data_provider_vector_; 2376 static_socket_data_provider_vector_;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 AddHangingSocketData(); 2568 AddHangingSocketData();
2564 2569
2565 SendRequestAndExpectQuicResponse(origin1_); 2570 SendRequestAndExpectQuicResponse(origin1_);
2566 SendRequestAndExpectQuicResponse(origin2_); 2571 SendRequestAndExpectQuicResponse(origin2_);
2567 2572
2568 EXPECT_TRUE(AllDataConsumed()); 2573 EXPECT_TRUE(AllDataConsumed());
2569 } 2574 }
2570 2575
2571 } // namespace test 2576 } // namespace test
2572 } // namespace net 2577 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_end_to_end_unittest.cc ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698