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

Unified Diff: net/quic/quic_stream_factory_test.cc

Issue 48893003: QUIC - added googlevideo.com to the list of cannonical hostnames to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merging with tip Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_stream_factory_test.cc
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc
index c5c75e33066d8c58d36c4bb58fc9bd26d0d5700a..a55f273e235089808a2c357e8d0882abf897912c 100644
--- a/net/quic/quic_stream_factory_test.cc
+++ b/net/quic/quic_stream_factory_test.cc
@@ -22,6 +22,10 @@
#include "net/socket/socket_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::StringPiece;
+using std::string;
+using std::vector;
+
namespace net {
namespace test {
@@ -459,64 +463,86 @@ TEST_F(QuicStreamFactoryTest, OnIPAddressChanged) {
}
TEST_F(QuicStreamFactoryTest, SharedCryptoConfig) {
- HostPortProxyPair host_port_proxy_pair1(HostPortPair("r1.c.youtube.com", 80),
- ProxyServer::Direct());
-
- QuicCryptoClientConfig* crypto_config1 =
- QuicStreamFactoryPeer::GetOrCreateCryptoConfig(&factory_,
- host_port_proxy_pair1);
- DCHECK(crypto_config1);
- QuicCryptoClientConfig::CachedState* cached1 =
- crypto_config1->LookupOrCreate(host_port_proxy_pair1.first.host());
- EXPECT_FALSE(cached1->proof_valid());
- EXPECT_TRUE(cached1->source_address_token().empty());
-
- // Mutate the cached1 to have different data.
- // TODO(rtenneti): mutate other members of CachedState.
- cached1->set_source_address_token("c.youtube.com");
- cached1->SetProofValid();
-
- HostPortProxyPair host_port_proxy_pair2(HostPortPair("r2.c.youtube.com", 80),
- ProxyServer::Direct());
- QuicCryptoClientConfig* crypto_config2 =
- QuicStreamFactoryPeer::GetOrCreateCryptoConfig(&factory_,
- host_port_proxy_pair2);
- DCHECK(crypto_config2);
- QuicCryptoClientConfig::CachedState* cached2 =
- crypto_config2->LookupOrCreate(host_port_proxy_pair2.first.host());
- EXPECT_EQ(cached1->source_address_token(), cached2->source_address_token());
- EXPECT_TRUE(cached2->proof_valid());
+ vector<string> cannoncial_suffixes;
+ cannoncial_suffixes.push_back(string(".c.youtube.com"));
+ cannoncial_suffixes.push_back(string(".googlevideo.com"));
+
+ for (unsigned i = 0; i < cannoncial_suffixes.size(); ++i) {
+ string r1_host_name("r1");
+ string r2_host_name("r2");
+ r1_host_name.append(cannoncial_suffixes[i]);
+ r2_host_name.append(cannoncial_suffixes[i]);
+
+ HostPortProxyPair host_port_proxy_pair1(HostPortPair(r1_host_name, 80),
+ ProxyServer::Direct());
+
+ QuicCryptoClientConfig* crypto_config1 =
+ QuicStreamFactoryPeer::GetOrCreateCryptoConfig(&factory_,
+ host_port_proxy_pair1);
+ DCHECK(crypto_config1);
+ QuicCryptoClientConfig::CachedState* cached1 =
+ crypto_config1->LookupOrCreate(host_port_proxy_pair1.first.host());
+ EXPECT_FALSE(cached1->proof_valid());
+ EXPECT_TRUE(cached1->source_address_token().empty());
+
+ // Mutate the cached1 to have different data.
+ // TODO(rtenneti): mutate other members of CachedState.
+ cached1->set_source_address_token(r1_host_name);
+ cached1->SetProofValid();
+
+ HostPortProxyPair host_port_proxy_pair2(HostPortPair(r2_host_name, 80),
+ ProxyServer::Direct());
+ QuicCryptoClientConfig* crypto_config2 =
+ QuicStreamFactoryPeer::GetOrCreateCryptoConfig(&factory_,
+ host_port_proxy_pair2);
+ DCHECK(crypto_config2);
+ QuicCryptoClientConfig::CachedState* cached2 =
+ crypto_config2->LookupOrCreate(host_port_proxy_pair2.first.host());
+ EXPECT_EQ(cached1->source_address_token(), cached2->source_address_token());
+ EXPECT_TRUE(cached2->proof_valid());
+ }
}
TEST_F(QuicStreamFactoryTest, CryptoConfigWhenProofIsInvalid) {
- HostPortProxyPair host_port_proxy_pair1(HostPortPair("r1.c.youtube.com", 80),
- ProxyServer::Direct());
-
- QuicCryptoClientConfig* crypto_config1 =
- QuicStreamFactoryPeer::GetOrCreateCryptoConfig(&factory_,
- host_port_proxy_pair1);
- DCHECK(crypto_config1);
- QuicCryptoClientConfig::CachedState* cached1 =
- crypto_config1->LookupOrCreate(host_port_proxy_pair1.first.host());
- EXPECT_FALSE(cached1->proof_valid());
- EXPECT_TRUE(cached1->source_address_token().empty());
-
- // Mutate the cached1 to have different data.
- // TODO(rtenneti): mutate other members of CachedState.
- cached1->set_source_address_token("c.youtube.com");
- cached1->SetProofInvalid();
-
- HostPortProxyPair host_port_proxy_pair2(HostPortPair("r2.c.youtube.com", 80),
- ProxyServer::Direct());
- QuicCryptoClientConfig* crypto_config2 =
- QuicStreamFactoryPeer::GetOrCreateCryptoConfig(&factory_,
- host_port_proxy_pair2);
- DCHECK(crypto_config2);
- QuicCryptoClientConfig::CachedState* cached2 =
- crypto_config2->LookupOrCreate(host_port_proxy_pair2.first.host());
- EXPECT_NE(cached1->source_address_token(), cached2->source_address_token());
- EXPECT_TRUE(cached2->source_address_token().empty());
- EXPECT_FALSE(cached2->proof_valid());
+ vector<string> cannoncial_suffixes;
+ cannoncial_suffixes.push_back(string(".c.youtube.com"));
+ cannoncial_suffixes.push_back(string(".googlevideo.com"));
+
+ for (unsigned i = 0; i < cannoncial_suffixes.size(); ++i) {
+ string r3_host_name("r3");
+ string r4_host_name("r4");
+ r3_host_name.append(cannoncial_suffixes[i]);
+ r4_host_name.append(cannoncial_suffixes[i]);
+
+ HostPortProxyPair host_port_proxy_pair1(HostPortPair(r3_host_name, 80),
+ ProxyServer::Direct());
+
+ QuicCryptoClientConfig* crypto_config1 =
+ QuicStreamFactoryPeer::GetOrCreateCryptoConfig(&factory_,
+ host_port_proxy_pair1);
+ DCHECK(crypto_config1);
+ QuicCryptoClientConfig::CachedState* cached1 =
+ crypto_config1->LookupOrCreate(host_port_proxy_pair1.first.host());
+ EXPECT_FALSE(cached1->proof_valid());
+ EXPECT_TRUE(cached1->source_address_token().empty());
+
+ // Mutate the cached1 to have different data.
+ // TODO(rtenneti): mutate other members of CachedState.
+ cached1->set_source_address_token(r3_host_name);
+ cached1->SetProofInvalid();
+
+ HostPortProxyPair host_port_proxy_pair2(HostPortPair(r4_host_name, 80),
+ ProxyServer::Direct());
+ QuicCryptoClientConfig* crypto_config2 =
+ QuicStreamFactoryPeer::GetOrCreateCryptoConfig(&factory_,
+ host_port_proxy_pair2);
+ DCHECK(crypto_config2);
+ QuicCryptoClientConfig::CachedState* cached2 =
+ crypto_config2->LookupOrCreate(host_port_proxy_pair2.first.host());
+ EXPECT_NE(cached1->source_address_token(), cached2->source_address_token());
+ EXPECT_TRUE(cached2->source_address_token().empty());
+ EXPECT_FALSE(cached2->proof_valid());
+ }
}
} // namespace test
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698