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

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

Issue 346323002: net: Implement ChannelIDSourceChromium, which is based on Chromium's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
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 "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/quic/crypto/crypto_handshake.h" 15 #include "net/quic/crypto/crypto_handshake.h"
16 #include "net/quic/crypto/proof_verifier_chromium.h" 16 #include "net/quic/crypto/proof_verifier_chromium.h"
17 #include "net/quic/crypto/quic_decrypter.h" 17 #include "net/quic/crypto/quic_decrypter.h"
18 #include "net/quic/crypto/quic_encrypter.h" 18 #include "net/quic/crypto/quic_encrypter.h"
19 #include "net/quic/quic_http_stream.h" 19 #include "net/quic/quic_http_stream.h"
20 #include "net/quic/quic_server_id.h" 20 #include "net/quic/quic_server_id.h"
21 #include "net/quic/test_tools/mock_clock.h" 21 #include "net/quic/test_tools/mock_clock.h"
22 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" 22 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h"
23 #include "net/quic/test_tools/mock_random.h" 23 #include "net/quic/test_tools/mock_random.h"
24 #include "net/quic/test_tools/quic_test_packet_maker.h" 24 #include "net/quic/test_tools/quic_test_packet_maker.h"
25 #include "net/quic/test_tools/quic_test_utils.h" 25 #include "net/quic/test_tools/quic_test_utils.h"
26 #include "net/socket/socket_test_util.h" 26 #include "net/socket/socket_test_util.h"
27 #include "net/ssl/default_server_bound_cert_store.h"
27 #include "net/test/cert_test_util.h" 28 #include "net/test/cert_test_util.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 30
30 using base::StringPiece; 31 using base::StringPiece;
31 using std::string; 32 using std::string;
32 using std::vector; 33 using std::vector;
33 34
34 namespace net { 35 namespace net {
35 namespace test { 36 namespace test {
36 37
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 83 }
83 }; 84 };
84 85
85 class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> { 86 class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> {
86 protected: 87 protected:
87 QuicStreamFactoryTest() 88 QuicStreamFactoryTest()
88 : random_generator_(0), 89 : random_generator_(0),
89 maker_(GetParam(), 0), 90 maker_(GetParam(), 0),
90 clock_(new MockClock()), 91 clock_(new MockClock()),
91 cert_verifier_(CertVerifier::CreateDefault()), 92 cert_verifier_(CertVerifier::CreateDefault()),
93 server_bound_cert_service_(new ServerBoundCertService(
94 new DefaultServerBoundCertStore(NULL),
95 base::MessageLoopProxy::current())),
92 factory_(&host_resolver_, &socket_factory_, 96 factory_(&host_resolver_, &socket_factory_,
93 base::WeakPtr<HttpServerProperties>(), cert_verifier_.get(), 97 base::WeakPtr<HttpServerProperties>(), cert_verifier_.get(),
98 server_bound_cert_service_.get(),
94 &crypto_client_stream_factory_, &random_generator_, clock_, 99 &crypto_client_stream_factory_, &random_generator_, clock_,
95 kDefaultMaxPacketSize, std::string(), 100 kDefaultMaxPacketSize, std::string(),
96 SupportedVersions(GetParam()), true, true, true), 101 SupportedVersions(GetParam()), true, true, true),
97 host_port_pair_(kDefaultServerHostName, kDefaultServerPort), 102 host_port_pair_(kDefaultServerHostName, kDefaultServerPort),
98 is_https_(false), 103 is_https_(false),
99 privacy_mode_(PRIVACY_MODE_DISABLED) { 104 privacy_mode_(PRIVACY_MODE_DISABLED) {
100 factory_.set_require_confirmation(false); 105 factory_.set_require_confirmation(false);
101 } 106 }
102 107
103 scoped_ptr<QuicHttpStream> CreateIfSessionExists( 108 scoped_ptr<QuicHttpStream> CreateIfSessionExists(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 AdjustErrorForVersion(QUIC_RST_FLOW_CONTROL_ACCOUNTING, GetParam())); 179 AdjustErrorForVersion(QUIC_RST_FLOW_CONTROL_ACCOUNTING, GetParam()));
175 } 180 }
176 181
177 MockHostResolver host_resolver_; 182 MockHostResolver host_resolver_;
178 DeterministicMockClientSocketFactory socket_factory_; 183 DeterministicMockClientSocketFactory socket_factory_;
179 MockCryptoClientStreamFactory crypto_client_stream_factory_; 184 MockCryptoClientStreamFactory crypto_client_stream_factory_;
180 MockRandom random_generator_; 185 MockRandom random_generator_;
181 QuicTestPacketMaker maker_; 186 QuicTestPacketMaker maker_;
182 MockClock* clock_; // Owned by factory_. 187 MockClock* clock_; // Owned by factory_.
183 scoped_ptr<CertVerifier> cert_verifier_; 188 scoped_ptr<CertVerifier> cert_verifier_;
189 scoped_ptr<ServerBoundCertService> server_bound_cert_service_;
184 QuicStreamFactory factory_; 190 QuicStreamFactory factory_;
185 HostPortPair host_port_pair_; 191 HostPortPair host_port_pair_;
186 bool is_https_; 192 bool is_https_;
187 PrivacyMode privacy_mode_; 193 PrivacyMode privacy_mode_;
188 BoundNetLog net_log_; 194 BoundNetLog net_log_;
189 TestCompletionCallback callback_; 195 TestCompletionCallback callback_;
190 }; 196 };
191 197
192 INSTANTIATE_TEST_CASE_P(Version, QuicStreamFactoryTest, 198 INSTANTIATE_TEST_CASE_P(Version, QuicStreamFactoryTest,
193 ::testing::ValuesIn(QuicSupportedVersions())); 199 ::testing::ValuesIn(QuicSupportedVersions()));
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 QuicCryptoClientConfig::CachedState* cached2 = 1145 QuicCryptoClientConfig::CachedState* cached2 =
1140 crypto_config->LookupOrCreate(server_id2); 1146 crypto_config->LookupOrCreate(server_id2);
1141 EXPECT_NE(cached1->source_address_token(), cached2->source_address_token()); 1147 EXPECT_NE(cached1->source_address_token(), cached2->source_address_token());
1142 EXPECT_TRUE(cached2->source_address_token().empty()); 1148 EXPECT_TRUE(cached2->source_address_token().empty());
1143 EXPECT_FALSE(cached2->proof_valid()); 1149 EXPECT_FALSE(cached2->proof_valid());
1144 } 1150 }
1145 } 1151 }
1146 1152
1147 } // namespace test 1153 } // namespace test
1148 } // namespace net 1154 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698