diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-26 09:51:28 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-26 09:51:28 +0000 |
commit | 9dd3ff0fbfdeb813cdd624ac71c947434aa36afe (patch) | |
tree | 84ca47f7ad4a3bb41b399402965c17a5fa165112 /net/quic | |
parent | c263fbe097a62d65774a7ff4002471d0f4869852 (diff) | |
download | chromium_src-9dd3ff0fbfdeb813cdd624ac71c947434aa36afe.zip chromium_src-9dd3ff0fbfdeb813cdd624ac71c947434aa36afe.tar.gz chromium_src-9dd3ff0fbfdeb813cdd624ac71c947434aa36afe.tar.bz2 |
Add PrivacyMode support to the QuicStreamFactory.
BUG=356338
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=259303
Review URL: https://codereview.chromium.org/185773006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic')
-rw-r--r-- | net/quic/crypto/quic_crypto_client_config.cc | 5 | ||||
-rw-r--r-- | net/quic/crypto/quic_crypto_client_config_test.cc | 7 | ||||
-rw-r--r-- | net/quic/quic_client_session_test.cc | 3 | ||||
-rw-r--r-- | net/quic/quic_crypto_client_stream_test.cc | 4 | ||||
-rw-r--r-- | net/quic/quic_crypto_server_stream_test.cc | 3 | ||||
-rw-r--r-- | net/quic/quic_http_stream_test.cc | 2 | ||||
-rw-r--r-- | net/quic/quic_session_key.cc | 21 | ||||
-rw-r--r-- | net/quic/quic_session_key.h | 13 | ||||
-rw-r--r-- | net/quic/quic_session_key_test.cc | 16 | ||||
-rw-r--r-- | net/quic/quic_stream_factory.cc | 33 | ||||
-rw-r--r-- | net/quic/quic_stream_factory.h | 7 | ||||
-rw-r--r-- | net/quic/quic_stream_factory_test.cc | 49 | ||||
-rw-r--r-- | net/quic/test_tools/crypto_test_utils.cc | 3 |
13 files changed, 118 insertions, 48 deletions
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc index 96369dd..2d8afde 100644 --- a/net/quic/crypto/quic_crypto_client_config.cc +++ b/net/quic/crypto/quic_crypto_client_config.cc @@ -698,8 +698,9 @@ void QuicCryptoClientConfig::PopulateFromCanonicalConfig( if (i == canoncial_suffixes_.size()) return; - QuicSessionKey suffix_server_key( - canoncial_suffixes_[i], server_key.port(), server_key.is_https()); + QuicSessionKey suffix_server_key(canoncial_suffixes_[i], server_key.port(), + server_key.is_https(), + server_key.privacy_mode()); if (!ContainsKey(canonical_server_map_, suffix_server_key)) { // This is the first host we've seen which matches the suffix, so make it // canonical. diff --git a/net/quic/crypto/quic_crypto_client_config_test.cc b/net/quic/crypto/quic_crypto_client_config_test.cc index f295ef5..d157024 100644 --- a/net/quic/crypto/quic_crypto_client_config_test.cc +++ b/net/quic/crypto/quic_crypto_client_config_test.cc @@ -56,7 +56,7 @@ TEST(QuicCryptoClientConfigTest, InchoateChlo) { QuicCryptoClientConfig config; QuicCryptoNegotiatedParameters params; CryptoHandshakeMessage msg; - QuicSessionKey server_key("www.google.com", 80, false); + QuicSessionKey server_key("www.google.com", 80, false, kPrivacyModeDisabled); config.FillInchoateClientHello(server_key, QuicVersionMax(), &state, ¶ms, &msg); @@ -92,14 +92,15 @@ TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) { TEST(QuicCryptoClientConfigTest, InitializeFrom) { QuicCryptoClientConfig config; - QuicSessionKey canonical_key1("www.google.com", 80, false); + QuicSessionKey canonical_key1("www.google.com", 80, false, + kPrivacyModeDisabled); QuicCryptoClientConfig::CachedState* state = config.LookupOrCreate(canonical_key1); // TODO(rch): Populate other fields of |state|. state->set_source_address_token("TOKEN"); state->SetProofValid(); - QuicSessionKey other_key("mail.google.com", 80, false); + QuicSessionKey other_key("mail.google.com", 80, false, kPrivacyModeDisabled); config.InitializeFrom(other_key, canonical_key1, &config); QuicCryptoClientConfig::CachedState* other = config.LookupOrCreate(other_key); diff --git a/net/quic/quic_client_session_test.cc b/net/quic/quic_client_session_test.cc index 87e3381..3c8d933 100644 --- a/net/quic/quic_client_session_test.cc +++ b/net/quic/quic_client_session_test.cc @@ -70,7 +70,8 @@ class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> { new PacketSavingConnection(false, SupportedVersions(GetParam()))), session_(connection_, GetSocket().Pass(), writer_.Pass(), NULL, NULL, make_scoped_ptr((QuicServerInfo*)NULL), - QuicSessionKey(kServerHostname, kServerPort, false), + QuicSessionKey(kServerHostname, kServerPort, false, + kPrivacyModeDisabled), DefaultQuicConfig(), &crypto_config_, &net_log_) { session_.config()->SetDefaults(); crypto_config_.SetDefaults(); diff --git a/net/quic/quic_crypto_client_stream_test.cc b/net/quic/quic_crypto_client_stream_test.cc index 12835f3..d2cfc34 100644 --- a/net/quic/quic_crypto_client_stream_test.cc +++ b/net/quic/quic_crypto_client_stream_test.cc @@ -28,7 +28,7 @@ class QuicCryptoClientStreamTest : public ::testing::Test { QuicCryptoClientStreamTest() : connection_(new PacketSavingConnection(false)), session_(new TestClientSession(connection_, DefaultQuicConfig())), - server_key_(kServerHostname, kServerPort, false), + server_key_(kServerHostname, kServerPort, false, kPrivacyModeDisabled), stream_(new QuicCryptoClientStream( server_key_, session_.get(), NULL, &crypto_config_)) { session_->SetCryptoStream(stream_.get()); @@ -106,7 +106,7 @@ TEST_F(QuicCryptoClientStreamTest, NegotiatedParameters) { } TEST_F(QuicCryptoClientStreamTest, InvalidHostname) { - QuicSessionKey server_key("invalid", 80, false); + QuicSessionKey server_key("invalid", 80, false, kPrivacyModeDisabled); stream_.reset(new QuicCryptoClientStream(server_key, session_.get(), NULL, &crypto_config_)); session_->SetCryptoStream(stream_.get()); diff --git a/net/quic/quic_crypto_server_stream_test.cc b/net/quic/quic_crypto_server_stream_test.cc index 704f069..d0c87e8 100644 --- a/net/quic/quic_crypto_server_stream_test.cc +++ b/net/quic/quic_crypto_server_stream_test.cc @@ -145,7 +145,8 @@ TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { QuicCryptoClientConfig client_crypto_config; client_crypto_config.SetDefaults(); - QuicSessionKey server_key(kServerHostname, kServerPort, false); + QuicSessionKey server_key(kServerHostname, kServerPort, false, + kPrivacyModeDisabled); scoped_ptr<QuicCryptoClientStream> client(new QuicCryptoClientStream( server_key, client_session.get(), NULL, &client_crypto_config)); client_session->SetCryptoStream(client.get()); diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc index 1eb7ebe..ac1f715 100644 --- a/net/quic/quic_http_stream_test.cc +++ b/net/quic/quic_http_stream_test.cc @@ -209,7 +209,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> { &crypto_client_stream_factory_, make_scoped_ptr((QuicServerInfo*)NULL), QuicSessionKey(kServerHostname, kServerPort, - false), + false, kPrivacyModeDisabled), DefaultQuicConfig(), &crypto_config_, NULL)); session_->GetCryptoStream()->CryptoConnect(); EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); diff --git a/net/quic/quic_session_key.cc b/net/quic/quic_session_key.cc index 385a1de..8ffd524 100644 --- a/net/quic/quic_session_key.cc +++ b/net/quic/quic_session_key.cc @@ -11,15 +11,19 @@ namespace net { QuicSessionKey::QuicSessionKey() {} QuicSessionKey::QuicSessionKey(const HostPortPair& host_port_pair, - bool is_https) + bool is_https, + PrivacyMode privacy_mode) : host_port_pair_(host_port_pair), - is_https_(is_https) {} + is_https_(is_https), + privacy_mode_(privacy_mode) {} QuicSessionKey::QuicSessionKey(const string& host, uint16 port, - bool is_https) + bool is_https, + PrivacyMode privacy_mode) : host_port_pair_(host, port), - is_https_(is_https) {} + is_https_(is_https), + privacy_mode_(privacy_mode) {} QuicSessionKey::~QuicSessionKey() {} @@ -27,16 +31,21 @@ bool QuicSessionKey::operator<(const QuicSessionKey& other) const { if (!host_port_pair_.Equals(other.host_port_pair_)) { return host_port_pair_ < other.host_port_pair_; } - return is_https_ < other.is_https_; + if (is_https_ != other.is_https_) { + return is_https_ < other.is_https_; + } + return privacy_mode_ < other.privacy_mode_; } bool QuicSessionKey::operator==(const QuicSessionKey& other) const { return is_https_ == other.is_https_ && + privacy_mode_ == other.privacy_mode_ && host_port_pair_.Equals(other.host_port_pair_); } string QuicSessionKey::ToString() const { - return (is_https_ ? "https://" : "http://") + host_port_pair_.ToString(); + return (is_https_ ? "https://" : "http://") + host_port_pair_.ToString() + + (privacy_mode_ == kPrivacyModeEnabled ? "/private" : ""); } } // namespace net diff --git a/net/quic/quic_session_key.h b/net/quic/quic_session_key.h index 12975fa..6cd43e7 100644 --- a/net/quic/quic_session_key.h +++ b/net/quic/quic_session_key.h @@ -9,6 +9,7 @@ #include "net/base/host_port_pair.h" #include "net/base/net_export.h" +#include "net/base/privacy_mode.h" namespace net { @@ -16,8 +17,13 @@ namespace net { class NET_EXPORT_PRIVATE QuicSessionKey { public: QuicSessionKey(); - QuicSessionKey(const HostPortPair& host_port_pair, bool is_https); - QuicSessionKey(const std::string& host, uint16 port, bool is_https); + QuicSessionKey(const HostPortPair& host_port_pair, + bool is_https, + PrivacyMode privacy_mode); + QuicSessionKey(const std::string& host, + uint16 port, + bool is_https, + PrivacyMode privacy_mode); ~QuicSessionKey(); // Needed to be an element of std::set. @@ -38,9 +44,12 @@ class NET_EXPORT_PRIVATE QuicSessionKey { bool is_https() const { return is_https_; } + PrivacyMode privacy_mode() const { return privacy_mode_; } + private: HostPortPair host_port_pair_; bool is_https_; + PrivacyMode privacy_mode_; }; } // namespace net diff --git a/net/quic/quic_session_key_test.cc b/net/quic/quic_session_key_test.cc index b07b3b7..e8fd4fd 100644 --- a/net/quic/quic_session_key_test.cc +++ b/net/quic/quic_session_key_test.cc @@ -15,13 +15,25 @@ namespace { TEST(QuicSessionKeyTest, ToString) { HostPortPair google_host_port_pair("google.com", 10); - QuicSessionKey google_http_key(google_host_port_pair, false); + QuicSessionKey google_http_key(google_host_port_pair, false, + kPrivacyModeDisabled); string google_http_key_str = google_http_key.ToString(); EXPECT_EQ("http://google.com:10", google_http_key_str); - QuicSessionKey google_https_key(google_host_port_pair, true); + QuicSessionKey google_https_key(google_host_port_pair, true, + kPrivacyModeDisabled); string google_https_key_str = google_https_key.ToString(); EXPECT_EQ("https://google.com:10", google_https_key_str); + + QuicSessionKey private_http_key(google_host_port_pair, false, + kPrivacyModeEnabled); + string private_http_key_str = private_http_key.ToString(); + EXPECT_EQ("http://google.com:10/private", private_http_key_str); + + QuicSessionKey private_https_key(google_host_port_pair, true, + kPrivacyModeEnabled); + string private_https_key_str = private_https_key.ToString(); + EXPECT_EQ("https://google.com:10/private", private_https_key_str); } } // namespace diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index d8f33c0..b0bed19 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc @@ -88,6 +88,7 @@ class QuicStreamFactory::Job { HostResolver* host_resolver, const HostPortPair& host_port_pair, bool is_https, + PrivacyMode privacy_mode, base::StringPiece method, QuicServerInfo* server_info, const BoundNetLog& net_log); @@ -128,7 +129,6 @@ class QuicStreamFactory::Job { QuicStreamFactory* factory_; SingleRequestHostResolver host_resolver_; - bool is_https_; QuicSessionKey session_key_; bool is_post_; scoped_ptr<QuicServerInfo> server_info_; @@ -145,13 +145,13 @@ QuicStreamFactory::Job::Job(QuicStreamFactory* factory, HostResolver* host_resolver, const HostPortPair& host_port_pair, bool is_https, + PrivacyMode privacy_mode, base::StringPiece method, QuicServerInfo* server_info, const BoundNetLog& net_log) : factory_(factory), host_resolver_(host_resolver), - is_https_(is_https), - session_key_(host_port_pair, is_https), + session_key_(host_port_pair, is_https, privacy_mode), is_post_(method == "POST"), server_info_(server_info), net_log_(net_log), @@ -273,9 +273,8 @@ int QuicStreamFactory::Job::DoLoadServerInfoComplete(int rv) { int QuicStreamFactory::Job::DoConnect() { io_state_ = STATE_CONNECT_COMPLETE; - int rv = factory_->CreateSession(session_key_.host_port_pair(), is_https_, - server_info_.Pass(), address_list_, - net_log_, &session_); + int rv = factory_->CreateSession(session_key_, server_info_.Pass(), + address_list_, net_log_, &session_); if (rv != OK) { DCHECK(rv != ERR_IO_PENDING); DCHECK(!session_); @@ -287,7 +286,7 @@ int QuicStreamFactory::Job::DoConnect() { return ERR_QUIC_PROTOCOL_ERROR; } rv = session_->CryptoConnect( - factory_->require_confirmation() || is_https_ || is_post_, + factory_->require_confirmation() || session_key_.is_https() || is_post_, base::Bind(&QuicStreamFactory::Job::OnIOComplete, base::Unretained(this))); return rv; @@ -322,13 +321,15 @@ QuicStreamRequest::~QuicStreamRequest() { int QuicStreamRequest::Request(const HostPortPair& host_port_pair, bool is_https, + PrivacyMode privacy_mode, base::StringPiece method, const BoundNetLog& net_log, const CompletionCallback& callback) { DCHECK(!stream_); DCHECK(callback_.is_null()); DCHECK(factory_); - int rv = factory_->Create(host_port_pair, is_https, method, net_log, this); + int rv = factory_->Create(host_port_pair, is_https, privacy_mode, method, + net_log, this); if (rv == ERR_IO_PENDING) { host_port_pair_ = host_port_pair; is_https_ = is_https; @@ -404,10 +405,11 @@ QuicStreamFactory::~QuicStreamFactory() { int QuicStreamFactory::Create(const HostPortPair& host_port_pair, bool is_https, + PrivacyMode privacy_mode, base::StringPiece method, const BoundNetLog& net_log, QuicStreamRequest* request) { - QuicSessionKey session_key(host_port_pair, is_https); + QuicSessionKey session_key(host_port_pair, is_https, privacy_mode); if (HasActiveSession(session_key)) { request->set_stream(CreateIfSessionExists(session_key, net_log)); return OK; @@ -429,8 +431,8 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair, quic_server_info = quic_server_info_factory_->GetForServer(session_key); } } - scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_pair, - is_https, method, quic_server_info, net_log)); + scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_pair, is_https, + privacy_mode, method, quic_server_info, net_log)); int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete, base::Unretained(this), job.get())); @@ -653,14 +655,12 @@ bool QuicStreamFactory::HasActiveSession( } int QuicStreamFactory::CreateSession( - const HostPortPair& host_port_pair, - bool is_https, + const QuicSessionKey& session_key, scoped_ptr<QuicServerInfo> server_info, const AddressList& address_list, const BoundNetLog& net_log, QuicClientSession** session) { bool enable_port_selection = enable_port_selection_; - QuicSessionKey session_key(host_port_pair, is_https); if (enable_port_selection && ContainsKey(gone_away_aliases_, session_key)) { // Disable port selection when the server is going away. @@ -673,7 +673,7 @@ int QuicStreamFactory::CreateSession( QuicConnectionId connection_id = random_generator_->RandUint64(); IPEndPoint addr = *address_list.begin(); scoped_refptr<PortSuggester> port_suggester = - new PortSuggester(host_port_pair, port_seed_); + new PortSuggester(session_key.host_port_pair(), port_seed_); DatagramSocket::BindType bind_type = enable_port_selection ? DatagramSocket::RANDOM_BIND : // Use our callback. DatagramSocket::DEFAULT_BIND; // Use OS to randomize. @@ -733,7 +733,8 @@ int QuicStreamFactory::CreateSession( QuicConfig config = config_; if (http_server_properties_) { const HttpServerProperties::NetworkStats* stats = - http_server_properties_->GetServerNetworkStats(host_port_pair); + http_server_properties_->GetServerNetworkStats( + session_key.host_port_pair()); if (stats != NULL) { config.set_initial_round_trip_time_us(stats->rtt.InMicroseconds(), stats->rtt.InMicroseconds()); diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h index 44686c8..1e22cdb 100644 --- a/net/quic/quic_stream_factory.h +++ b/net/quic/quic_stream_factory.h @@ -54,6 +54,7 @@ class NET_EXPORT_PRIVATE QuicStreamRequest { // For http, |is_https| is false and |cert_verifier| can be null. int Request(const HostPortPair& host_port_pair, bool is_https, + PrivacyMode privacy_mode, base::StringPiece method, const BoundNetLog& net_log, const CompletionCallback& callback); @@ -108,6 +109,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory // asynchronously. int Create(const HostPortPair& host_port_pair, bool is_https, + PrivacyMode privacy_mode, base::StringPiece method, const BoundNetLog& net_log, QuicStreamRequest* request); @@ -164,7 +166,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory class Job; friend class test::QuicStreamFactoryPeer; - // The key used to find session by hostname. Includes + // The key used to find session by ip. Includes // the ip address, port, and scheme. struct NET_EXPORT_PRIVATE IpAliasKey { IpAliasKey(); @@ -200,8 +202,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory void OnJobComplete(Job* job, int rv); bool HasActiveSession(const QuicSessionKey& session_key) const; bool HasActiveJob(const QuicSessionKey& session_key) const; - int CreateSession(const HostPortPair& host_port_pair, - bool is_https, + int CreateSession(const QuicSessionKey& session_key, scoped_ptr<QuicServerInfo> quic_server_info, const AddressList& address_list, const BoundNetLog& net_log, diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc index 3ff203c..780c5cb 100644 --- a/net/quic/quic_stream_factory_test.cc +++ b/net/quic/quic_stream_factory_test.cc @@ -48,7 +48,7 @@ class QuicStreamFactoryPeer { static bool HasActiveSession(QuicStreamFactory* factory, const HostPortPair& host_port_pair, bool is_https) { - QuicSessionKey server_key(host_port_pair, is_https); + QuicSessionKey server_key(host_port_pair, is_https, kPrivacyModeDisabled); return factory->HasActiveSession(server_key); } @@ -56,7 +56,7 @@ class QuicStreamFactoryPeer { QuicStreamFactory* factory, const HostPortPair& host_port_pair, bool is_https) { - QuicSessionKey server_key(host_port_pair, is_https); + QuicSessionKey server_key(host_port_pair, is_https, kPrivacyModeDisabled); DCHECK(factory->HasActiveSession(server_key)); return factory->active_sessions_[server_key]; } @@ -66,7 +66,7 @@ class QuicStreamFactoryPeer { const HostPortPair& host_port_pair, bool is_https, const BoundNetLog& net_log) { - QuicSessionKey server_key(host_port_pair, is_https); + QuicSessionKey server_key(host_port_pair, is_https, kPrivacyModeDisabled); return factory->CreateIfSessionExists(server_key, net_log); } @@ -96,7 +96,8 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> { &random_generator_, clock_, kDefaultMaxPacketSize, SupportedVersions(GetParam()), true, true), host_port_pair_(kDefaultServerHostName, kDefaultServerPort), - is_https_(false) { + is_https_(false), + privacy_mode_(kPrivacyModeDisabled) { factory_.set_require_confirmation(false); } @@ -133,6 +134,7 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> { EXPECT_EQ(ERR_IO_PENDING, request.Request(destination, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -181,6 +183,7 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> { QuicStreamFactory factory_; HostPortPair host_port_pair_; bool is_https_; + PrivacyMode privacy_mode_; BoundNetLog net_log_; TestCompletionCallback callback_; }; @@ -204,6 +207,7 @@ TEST_P(QuicStreamFactoryTest, Create) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -222,6 +226,7 @@ TEST_P(QuicStreamFactoryTest, Create) { EXPECT_EQ(OK, request2.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -250,6 +255,7 @@ TEST_P(QuicStreamFactoryTest, CreateZeroRtt) { EXPECT_EQ(OK, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -279,6 +285,7 @@ TEST_P(QuicStreamFactoryTest, CreateZeroRttPost) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "POST", net_log_, callback_.callback())); @@ -309,6 +316,7 @@ TEST_P(QuicStreamFactoryTest, CreateHttpVsHttps) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -321,6 +329,7 @@ TEST_P(QuicStreamFactoryTest, CreateHttpVsHttps) { EXPECT_EQ(ERR_IO_PENDING, request2.Request(host_port_pair_, !is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -359,6 +368,7 @@ TEST_P(QuicStreamFactoryTest, Pooling) { EXPECT_EQ(OK, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -370,6 +380,7 @@ TEST_P(QuicStreamFactoryTest, Pooling) { EXPECT_EQ(OK, request2.Request(server2, is_https_, + privacy_mode_, "GET", net_log_, callback.callback())); @@ -407,6 +418,7 @@ TEST_P(QuicStreamFactoryTest, NoPoolingAfterGoAway) { EXPECT_EQ(OK, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -418,6 +430,7 @@ TEST_P(QuicStreamFactoryTest, NoPoolingAfterGoAway) { EXPECT_EQ(OK, request2.Request(server2, is_https_, + privacy_mode_, "GET", net_log_, callback.callback())); @@ -436,6 +449,7 @@ TEST_P(QuicStreamFactoryTest, NoPoolingAfterGoAway) { EXPECT_EQ(OK, request3.Request(server2, is_https_, + privacy_mode_, "GET", net_log_, callback3.callback())); @@ -483,6 +497,7 @@ TEST_P(QuicStreamFactoryTest, HttpsPooling) { EXPECT_EQ(OK, request.Request(server1, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -494,6 +509,7 @@ TEST_P(QuicStreamFactoryTest, HttpsPooling) { EXPECT_EQ(OK, request2.Request(server2, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -546,6 +562,7 @@ TEST_P(QuicStreamFactoryTest, NoHttpsPoolingWithCertMismatch) { EXPECT_EQ(OK, request.Request(server1, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -557,6 +574,7 @@ TEST_P(QuicStreamFactoryTest, NoHttpsPoolingWithCertMismatch) { EXPECT_EQ(OK, request2.Request(server2, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -589,6 +607,7 @@ TEST_P(QuicStreamFactoryTest, Goaway) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -613,6 +632,7 @@ TEST_P(QuicStreamFactoryTest, Goaway) { EXPECT_EQ(ERR_IO_PENDING, request2.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -660,6 +680,7 @@ TEST_P(QuicStreamFactoryTest, MaxOpenStream) { QuicStreamRequest request(&factory_); int rv = request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback()); @@ -680,6 +701,7 @@ TEST_P(QuicStreamFactoryTest, MaxOpenStream) { EXPECT_EQ(OK, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, CompletionCallback())); @@ -710,6 +732,7 @@ TEST_P(QuicStreamFactoryTest, ResolutionErrorInCreate) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -731,6 +754,7 @@ TEST_P(QuicStreamFactoryTest, ConnectErrorInCreate) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -752,6 +776,7 @@ TEST_P(QuicStreamFactoryTest, CancelCreate) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -819,6 +844,7 @@ TEST_P(QuicStreamFactoryTest, CloseAllSessions) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -842,6 +868,7 @@ TEST_P(QuicStreamFactoryTest, CloseAllSessions) { EXPECT_EQ(ERR_IO_PENDING, request2.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -881,6 +908,7 @@ TEST_P(QuicStreamFactoryTest, OnIPAddressChanged) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -905,6 +933,7 @@ TEST_P(QuicStreamFactoryTest, OnIPAddressChanged) { EXPECT_EQ(ERR_IO_PENDING, request2.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -944,6 +973,7 @@ TEST_P(QuicStreamFactoryTest, OnCertAdded) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -968,6 +998,7 @@ TEST_P(QuicStreamFactoryTest, OnCertAdded) { EXPECT_EQ(ERR_IO_PENDING, request2.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -1007,6 +1038,7 @@ TEST_P(QuicStreamFactoryTest, OnCACertChanged) { EXPECT_EQ(ERR_IO_PENDING, request.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -1031,6 +1063,7 @@ TEST_P(QuicStreamFactoryTest, OnCACertChanged) { EXPECT_EQ(ERR_IO_PENDING, request2.Request(host_port_pair_, is_https_, + privacy_mode_, "GET", net_log_, callback_.callback())); @@ -1059,7 +1092,7 @@ TEST_P(QuicStreamFactoryTest, SharedCryptoConfig) { HostPortPair host_port_pair1(r1_host_name, 80); QuicCryptoClientConfig* crypto_config = QuicStreamFactoryPeer::GetCryptoConfig(&factory_); - QuicSessionKey server_key1(host_port_pair1, is_https_); + QuicSessionKey server_key1(host_port_pair1, is_https_, privacy_mode_); QuicCryptoClientConfig::CachedState* cached1 = crypto_config->LookupOrCreate(server_key1); EXPECT_FALSE(cached1->proof_valid()); @@ -1071,7 +1104,7 @@ TEST_P(QuicStreamFactoryTest, SharedCryptoConfig) { cached1->SetProofValid(); HostPortPair host_port_pair2(r2_host_name, 80); - QuicSessionKey server_key2(host_port_pair2, is_https_); + QuicSessionKey server_key2(host_port_pair2, is_https_, privacy_mode_); QuicCryptoClientConfig::CachedState* cached2 = crypto_config->LookupOrCreate(server_key2); EXPECT_EQ(cached1->source_address_token(), cached2->source_address_token()); @@ -1093,7 +1126,7 @@ TEST_P(QuicStreamFactoryTest, CryptoConfigWhenProofIsInvalid) { HostPortPair host_port_pair1(r3_host_name, 80); QuicCryptoClientConfig* crypto_config = QuicStreamFactoryPeer::GetCryptoConfig(&factory_); - QuicSessionKey server_key1(host_port_pair1, is_https_); + QuicSessionKey server_key1(host_port_pair1, is_https_, privacy_mode_); QuicCryptoClientConfig::CachedState* cached1 = crypto_config->LookupOrCreate(server_key1); EXPECT_FALSE(cached1->proof_valid()); @@ -1105,7 +1138,7 @@ TEST_P(QuicStreamFactoryTest, CryptoConfigWhenProofIsInvalid) { cached1->SetProofInvalid(); HostPortPair host_port_pair2(r4_host_name, 80); - QuicSessionKey server_key2(host_port_pair2, is_https_); + QuicSessionKey server_key2(host_port_pair2, is_https_, privacy_mode_); QuicCryptoClientConfig::CachedState* cached2 = crypto_config->LookupOrCreate(server_key2); EXPECT_NE(cached1->source_address_token(), cached2->source_address_token()); diff --git a/net/quic/test_tools/crypto_test_utils.cc b/net/quic/test_tools/crypto_test_utils.cc index 6dc60ca..45fc5a0 100644 --- a/net/quic/test_tools/crypto_test_utils.cc +++ b/net/quic/test_tools/crypto_test_utils.cc @@ -179,7 +179,8 @@ int CryptoTestUtils::HandshakeWithFakeClient( if (options.channel_id_enabled) { crypto_config.SetChannelIDSigner(ChannelIDSignerForTesting()); } - QuicSessionKey server_key(kServerHostname, kServerPort, false); + QuicSessionKey server_key(kServerHostname, kServerPort, false, + kPrivacyModeDisabled); QuicCryptoClientStream client(server_key, &client_session, NULL, &crypto_config); client_session.SetCryptoStream(&client); |