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

Unified Diff: net/http/http_server_properties_impl_unittest.cc

Issue 188663002: Revert of HttpServerProperties - Implement MRU for AlternateProtocolMap. Persist (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | net/http/http_stream_factory_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_impl_unittest.cc
diff --git a/net/http/http_server_properties_impl_unittest.cc b/net/http/http_server_properties_impl_unittest.cc
index 7b59714edf447887b9a93303e8226ca8eb6baf3c..fab73705e505386fc08221e9acb8b51efac40806 100644
--- a/net/http/http_server_properties_impl_unittest.cc
+++ b/net/http/http_server_properties_impl_unittest.cc
@@ -206,26 +206,12 @@
HostPortPair test_host_port_pair2("foo2", 80);
impl_.SetAlternateProtocol(test_host_port_pair2, 443, NPN_SPDY_3);
- AlternateProtocolMap alternate_protocol_map(
- AlternateProtocolMap::NO_AUTO_EVICT);
+ AlternateProtocolMap alternate_protocol_map;
PortAlternateProtocolPair port_alternate_protocol_pair;
port_alternate_protocol_pair.port = 123;
port_alternate_protocol_pair.protocol = NPN_SPDY_3;
- alternate_protocol_map.Put(test_host_port_pair2,
- port_alternate_protocol_pair);
- HostPortPair test_host_port_pair3("foo3", 80);
- port_alternate_protocol_pair.port = 1234;
- alternate_protocol_map.Put(test_host_port_pair3,
- port_alternate_protocol_pair);
+ alternate_protocol_map[test_host_port_pair2] = port_alternate_protocol_pair;
impl_.InitializeAlternateProtocolServers(&alternate_protocol_map);
-
- // Verify test_host_port_pair3 is the MRU server.
- const net::AlternateProtocolMap& map = impl_.alternate_protocol_map();
- net::AlternateProtocolMap::const_iterator it = map.begin();
- it = map.begin();
- EXPECT_TRUE(it->first.Equals(test_host_port_pair3));
- EXPECT_EQ(1234, it->second.port);
- EXPECT_EQ(NPN_SPDY_3, it->second.protocol);
ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair1));
ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair2));
@@ -236,49 +222,6 @@
impl_.GetAlternateProtocol(test_host_port_pair2);
EXPECT_EQ(123, port_alternate_protocol_pair.port);
EXPECT_EQ(NPN_SPDY_3, port_alternate_protocol_pair.protocol);
-}
-
-TEST_F(AlternateProtocolServerPropertiesTest, MRUOfHasAlternateProtocol) {
- HostPortPair test_host_port_pair1("foo1", 80);
- impl_.SetAlternateProtocol(test_host_port_pair1, 443, NPN_SPDY_3);
- HostPortPair test_host_port_pair2("foo2", 80);
- impl_.SetAlternateProtocol(test_host_port_pair2, 1234, NPN_SPDY_3);
-
- const net::AlternateProtocolMap& map = impl_.alternate_protocol_map();
- net::AlternateProtocolMap::const_iterator it = map.begin();
- EXPECT_TRUE(it->first.Equals(test_host_port_pair2));
- EXPECT_EQ(1234, it->second.port);
- EXPECT_EQ(NPN_SPDY_3, it->second.protocol);
-
- // HasAlternateProtocol should reoder the AlternateProtocol map.
- ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair1));
- it = map.begin();
- EXPECT_TRUE(it->first.Equals(test_host_port_pair1));
- EXPECT_EQ(443, it->second.port);
- EXPECT_EQ(NPN_SPDY_3, it->second.protocol);
-}
-
-TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternateProtocol) {
- HostPortPair test_host_port_pair1("foo1", 80);
- impl_.SetAlternateProtocol(test_host_port_pair1, 443, NPN_SPDY_3);
- HostPortPair test_host_port_pair2("foo2", 80);
- impl_.SetAlternateProtocol(test_host_port_pair2, 1234, NPN_SPDY_3);
-
- const net::AlternateProtocolMap& map = impl_.alternate_protocol_map();
- net::AlternateProtocolMap::const_iterator it = map.begin();
- EXPECT_TRUE(it->first.Equals(test_host_port_pair2));
- EXPECT_EQ(1234, it->second.port);
- EXPECT_EQ(NPN_SPDY_3, it->second.protocol);
-
- // GetAlternateProtocol should reoder the AlternateProtocol map.
- PortAlternateProtocolPair alternate =
- impl_.GetAlternateProtocol(test_host_port_pair1);
- EXPECT_EQ(443, alternate.port);
- EXPECT_EQ(NPN_SPDY_3, alternate.protocol);
- it = map.begin();
- EXPECT_TRUE(it->first.Equals(test_host_port_pair1));
- EXPECT_EQ(443, it->second.port);
- EXPECT_EQ(NPN_SPDY_3, it->second.protocol);
}
TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) {
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | net/http/http_stream_factory_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698