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" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return true; | 83 return true; |
84 } | 84 } |
85 return false; | 85 return false; |
86 } | 86 } |
87 }; | 87 }; |
88 | 88 |
89 class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> { | 89 class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> { |
90 protected: | 90 protected: |
91 QuicStreamFactoryTest() | 91 QuicStreamFactoryTest() |
92 : random_generator_(0), | 92 : random_generator_(0), |
93 maker_(GetParam(), 0), | |
94 clock_(new MockClock()), | 93 clock_(new MockClock()), |
| 94 maker_(GetParam(), 0, clock_), |
95 cert_verifier_(CertVerifier::CreateDefault()), | 95 cert_verifier_(CertVerifier::CreateDefault()), |
96 channel_id_service_(new ChannelIDService( | 96 channel_id_service_(new ChannelIDService( |
97 new DefaultChannelIDStore(NULL), | 97 new DefaultChannelIDStore(NULL), |
98 base::MessageLoopProxy::current())), | 98 base::MessageLoopProxy::current())), |
99 factory_(&host_resolver_, &socket_factory_, | 99 factory_(&host_resolver_, &socket_factory_, |
100 base::WeakPtr<HttpServerProperties>(), cert_verifier_.get(), | 100 base::WeakPtr<HttpServerProperties>(), cert_verifier_.get(), |
101 channel_id_service_.get(), &transport_security_state_, | 101 channel_id_service_.get(), &transport_security_state_, |
102 &crypto_client_stream_factory_, &random_generator_, clock_, | 102 &crypto_client_stream_factory_, &random_generator_, clock_, |
103 kDefaultMaxPacketSize, std::string(), | 103 kDefaultMaxPacketSize, std::string(), |
104 SupportedVersions(GetParam()), true, true, QuicTagVector()), | 104 SupportedVersions(GetParam()), true, true, QuicTagVector()), |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 QuicStreamId stream_id = kClientDataStreamId1; | 180 QuicStreamId stream_id = kClientDataStreamId1; |
181 return maker_.MakeRstPacket( | 181 return maker_.MakeRstPacket( |
182 1, true, stream_id, | 182 1, true, stream_id, |
183 AdjustErrorForVersion(QUIC_RST_FLOW_CONTROL_ACCOUNTING, GetParam())); | 183 AdjustErrorForVersion(QUIC_RST_FLOW_CONTROL_ACCOUNTING, GetParam())); |
184 } | 184 } |
185 | 185 |
186 MockHostResolver host_resolver_; | 186 MockHostResolver host_resolver_; |
187 DeterministicMockClientSocketFactory socket_factory_; | 187 DeterministicMockClientSocketFactory socket_factory_; |
188 MockCryptoClientStreamFactory crypto_client_stream_factory_; | 188 MockCryptoClientStreamFactory crypto_client_stream_factory_; |
189 MockRandom random_generator_; | 189 MockRandom random_generator_; |
| 190 MockClock* clock_; // Owned by factory_. |
190 QuicTestPacketMaker maker_; | 191 QuicTestPacketMaker maker_; |
191 MockClock* clock_; // Owned by factory_. | |
192 scoped_ptr<CertVerifier> cert_verifier_; | 192 scoped_ptr<CertVerifier> cert_verifier_; |
193 scoped_ptr<ChannelIDService> channel_id_service_; | 193 scoped_ptr<ChannelIDService> channel_id_service_; |
194 TransportSecurityState transport_security_state_; | 194 TransportSecurityState transport_security_state_; |
195 QuicStreamFactory factory_; | 195 QuicStreamFactory factory_; |
196 HostPortPair host_port_pair_; | 196 HostPortPair host_port_pair_; |
197 bool is_https_; | 197 bool is_https_; |
198 PrivacyMode privacy_mode_; | 198 PrivacyMode privacy_mode_; |
199 BoundNetLog net_log_; | 199 BoundNetLog net_log_; |
200 TestCompletionCallback callback_; | 200 TestCompletionCallback callback_; |
201 }; | 201 }; |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 QuicCryptoClientConfig::CachedState* cached2 = | 1291 QuicCryptoClientConfig::CachedState* cached2 = |
1292 crypto_config->LookupOrCreate(server_id2); | 1292 crypto_config->LookupOrCreate(server_id2); |
1293 EXPECT_NE(cached1->source_address_token(), cached2->source_address_token()); | 1293 EXPECT_NE(cached1->source_address_token(), cached2->source_address_token()); |
1294 EXPECT_TRUE(cached2->source_address_token().empty()); | 1294 EXPECT_TRUE(cached2->source_address_token().empty()); |
1295 EXPECT_FALSE(cached2->proof_valid()); | 1295 EXPECT_FALSE(cached2->proof_valid()); |
1296 } | 1296 } |
1297 } | 1297 } |
1298 | 1298 |
1299 } // namespace test | 1299 } // namespace test |
1300 } // namespace net | 1300 } // namespace net |
OLD | NEW |