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 "net/quic/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "net/base/test_data_directory.h" | 9 #include "net/base/test_data_directory.h" |
10 #include "net/cert/cert_verifier.h" | 10 #include "net/cert/cert_verifier.h" |
11 #include "net/dns/mock_host_resolver.h" | 11 #include "net/dns/mock_host_resolver.h" |
12 #include "net/http/http_response_headers.h" | 12 #include "net/http/http_response_headers.h" |
13 #include "net/http/http_response_info.h" | 13 #include "net/http/http_response_info.h" |
14 #include "net/http/http_util.h" | 14 #include "net/http/http_util.h" |
| 15 #include "net/http/transport_security_state.h" |
15 #include "net/quic/crypto/crypto_handshake.h" | 16 #include "net/quic/crypto/crypto_handshake.h" |
16 #include "net/quic/crypto/proof_verifier_chromium.h" | 17 #include "net/quic/crypto/proof_verifier_chromium.h" |
17 #include "net/quic/crypto/quic_decrypter.h" | 18 #include "net/quic/crypto/quic_decrypter.h" |
18 #include "net/quic/crypto/quic_encrypter.h" | 19 #include "net/quic/crypto/quic_encrypter.h" |
19 #include "net/quic/quic_http_stream.h" | 20 #include "net/quic/quic_http_stream.h" |
20 #include "net/quic/quic_server_id.h" | 21 #include "net/quic/quic_server_id.h" |
21 #include "net/quic/test_tools/mock_clock.h" | 22 #include "net/quic/test_tools/mock_clock.h" |
22 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" | 23 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" |
23 #include "net/quic/test_tools/mock_random.h" | 24 #include "net/quic/test_tools/mock_random.h" |
24 #include "net/quic/test_tools/quic_test_packet_maker.h" | 25 #include "net/quic/test_tools/quic_test_packet_maker.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 QuicStreamFactoryTest() | 90 QuicStreamFactoryTest() |
90 : random_generator_(0), | 91 : random_generator_(0), |
91 maker_(GetParam(), 0), | 92 maker_(GetParam(), 0), |
92 clock_(new MockClock()), | 93 clock_(new MockClock()), |
93 cert_verifier_(CertVerifier::CreateDefault()), | 94 cert_verifier_(CertVerifier::CreateDefault()), |
94 channel_id_service_(new ChannelIDService( | 95 channel_id_service_(new ChannelIDService( |
95 new DefaultChannelIDStore(NULL), | 96 new DefaultChannelIDStore(NULL), |
96 base::MessageLoopProxy::current())), | 97 base::MessageLoopProxy::current())), |
97 factory_(&host_resolver_, &socket_factory_, | 98 factory_(&host_resolver_, &socket_factory_, |
98 base::WeakPtr<HttpServerProperties>(), cert_verifier_.get(), | 99 base::WeakPtr<HttpServerProperties>(), cert_verifier_.get(), |
99 channel_id_service_.get(), | 100 channel_id_service_.get(), &transport_security_state_, |
100 &crypto_client_stream_factory_, &random_generator_, clock_, | 101 &crypto_client_stream_factory_, &random_generator_, clock_, |
101 kDefaultMaxPacketSize, std::string(), | 102 kDefaultMaxPacketSize, std::string(), |
102 SupportedVersions(GetParam()), true, true, true, | 103 SupportedVersions(GetParam()), true, true, true, |
103 QuicTagVector()), | 104 QuicTagVector()), |
104 host_port_pair_(kDefaultServerHostName, kDefaultServerPort), | 105 host_port_pair_(kDefaultServerHostName, kDefaultServerPort), |
105 is_https_(false), | 106 is_https_(false), |
106 privacy_mode_(PRIVACY_MODE_DISABLED) { | 107 privacy_mode_(PRIVACY_MODE_DISABLED) { |
107 factory_.set_require_confirmation(false); | 108 factory_.set_require_confirmation(false); |
108 } | 109 } |
109 | 110 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 183 } |
183 | 184 |
184 MockHostResolver host_resolver_; | 185 MockHostResolver host_resolver_; |
185 DeterministicMockClientSocketFactory socket_factory_; | 186 DeterministicMockClientSocketFactory socket_factory_; |
186 MockCryptoClientStreamFactory crypto_client_stream_factory_; | 187 MockCryptoClientStreamFactory crypto_client_stream_factory_; |
187 MockRandom random_generator_; | 188 MockRandom random_generator_; |
188 QuicTestPacketMaker maker_; | 189 QuicTestPacketMaker maker_; |
189 MockClock* clock_; // Owned by factory_. | 190 MockClock* clock_; // Owned by factory_. |
190 scoped_ptr<CertVerifier> cert_verifier_; | 191 scoped_ptr<CertVerifier> cert_verifier_; |
191 scoped_ptr<ChannelIDService> channel_id_service_; | 192 scoped_ptr<ChannelIDService> channel_id_service_; |
| 193 TransportSecurityState transport_security_state_; |
192 QuicStreamFactory factory_; | 194 QuicStreamFactory factory_; |
193 HostPortPair host_port_pair_; | 195 HostPortPair host_port_pair_; |
194 bool is_https_; | 196 bool is_https_; |
195 PrivacyMode privacy_mode_; | 197 PrivacyMode privacy_mode_; |
196 BoundNetLog net_log_; | 198 BoundNetLog net_log_; |
197 TestCompletionCallback callback_; | 199 TestCompletionCallback callback_; |
198 }; | 200 }; |
199 | 201 |
200 INSTANTIATE_TEST_CASE_P(Version, QuicStreamFactoryTest, | 202 INSTANTIATE_TEST_CASE_P(Version, QuicStreamFactoryTest, |
201 ::testing::ValuesIn(QuicSupportedVersions())); | 203 ::testing::ValuesIn(QuicSupportedVersions())); |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 QuicCryptoClientConfig::CachedState* cached2 = | 1151 QuicCryptoClientConfig::CachedState* cached2 = |
1150 crypto_config->LookupOrCreate(server_id2); | 1152 crypto_config->LookupOrCreate(server_id2); |
1151 EXPECT_NE(cached1->source_address_token(), cached2->source_address_token()); | 1153 EXPECT_NE(cached1->source_address_token(), cached2->source_address_token()); |
1152 EXPECT_TRUE(cached2->source_address_token().empty()); | 1154 EXPECT_TRUE(cached2->source_address_token().empty()); |
1153 EXPECT_FALSE(cached2->proof_valid()); | 1155 EXPECT_FALSE(cached2->proof_valid()); |
1154 } | 1156 } |
1155 } | 1157 } |
1156 | 1158 |
1157 } // namespace test | 1159 } // namespace test |
1158 } // namespace net | 1160 } // namespace net |
OLD | NEW |