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

Unified Diff: net/http/http_server_properties_impl_unittest.cc

Issue 1572753003: QUIC - Allow cronet apps to specify how many server configs are to be (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments in Patch set 4 Created 4 years, 11 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_server_properties_manager.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 cf24fc751fdf8afe516ce49fc240a35fca408277..a4e81310ee00678c1dc83bab1120045093149819 100644
--- a/net/http/http_server_properties_impl_unittest.cc
+++ b/net/http/http_server_properties_impl_unittest.cc
@@ -1389,6 +1389,11 @@ TEST_F(QuicServerInfoServerPropertiesTest, Initialize) {
HostPortPair google_server("www.google.com", 443);
QuicServerId google_quic_server_id(google_server, PRIVACY_MODE_ENABLED);
+ EXPECT_EQ(QuicServerInfoMap::NO_AUTO_EVICT,
+ impl_.quic_server_info_map().max_size());
+ impl_.SetMaxServerConfigsStoredInProperties(10);
+ EXPECT_EQ(10u, impl_.quic_server_info_map().max_size());
+
// Check empty map.
QuicServerInfoMap init_quic_server_info_map(QuicServerInfoMap::NO_AUTO_EVICT);
impl_.InitializeQuicServerInfoMap(&init_quic_server_info_map);
@@ -1449,6 +1454,22 @@ TEST_F(QuicServerInfoServerPropertiesTest, Initialize) {
++memory_map_it;
EXPECT_EQ(memory_map_it->first, mail_quic_server_id);
EXPECT_EQ(mail_server_info, memory_map_it->second);
+
+ // Shrink the size of |quic_server_info_map| and verify the MRU order is
+ // maintained.
+ impl_.SetMaxServerConfigsStoredInProperties(2);
+ EXPECT_EQ(2u, impl_.quic_server_info_map().max_size());
+
+ const QuicServerInfoMap& memory_map1 = impl_.quic_server_info_map();
+ ASSERT_EQ(2u, memory_map1.size());
+ QuicServerInfoMap::const_iterator memory_map1_it = memory_map1.begin();
+ EXPECT_EQ(memory_map1_it->first, docs_quic_server_id);
+ EXPECT_EQ(new_docs_server_info, memory_map1_it->second);
+ ++memory_map1_it;
+ EXPECT_EQ(memory_map1_it->first, google_quic_server_id);
+ EXPECT_EQ(google_server_info, memory_map1_it->second);
+ // |QuicServerInfo| for |mail_quic_server_id| shouldn't be there.
+ EXPECT_EQ(nullptr, impl_.GetQuicServerInfo(mail_quic_server_id));
}
TEST_F(QuicServerInfoServerPropertiesTest, SetQuicServerInfo) {
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | net/http/http_server_properties_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698