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

Side by Side Diff: net/http/http_server_properties_impl_unittest.cc

Issue 182383016: HttpServerProperties - Implement MRU for AlternateProtocolMap. Persist (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Used MRUCache for AlternateProtocolMap. 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 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/http/http_server_properties_impl.h" 5 #include "net/http/http_server_properties_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 impl_.Clear(); 199 impl_.Clear();
200 EXPECT_FALSE(impl_.HasAlternateProtocol(test_host_port_pair)); 200 EXPECT_FALSE(impl_.HasAlternateProtocol(test_host_port_pair));
201 } 201 }
202 202
203 TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { 203 TEST_F(AlternateProtocolServerPropertiesTest, Initialize) {
204 HostPortPair test_host_port_pair1("foo1", 80); 204 HostPortPair test_host_port_pair1("foo1", 80);
205 impl_.SetBrokenAlternateProtocol(test_host_port_pair1); 205 impl_.SetBrokenAlternateProtocol(test_host_port_pair1);
206 HostPortPair test_host_port_pair2("foo2", 80); 206 HostPortPair test_host_port_pair2("foo2", 80);
207 impl_.SetAlternateProtocol(test_host_port_pair2, 443, NPN_SPDY_3); 207 impl_.SetAlternateProtocol(test_host_port_pair2, 443, NPN_SPDY_3);
208 208
209 AlternateProtocolMap alternate_protocol_map; 209 AlternateProtocolMap alternate_protocol_map(
210 AlternateProtocolMap::NO_AUTO_EVICT);
210 PortAlternateProtocolPair port_alternate_protocol_pair; 211 PortAlternateProtocolPair port_alternate_protocol_pair;
211 port_alternate_protocol_pair.port = 123; 212 port_alternate_protocol_pair.port = 123;
212 port_alternate_protocol_pair.protocol = NPN_SPDY_3; 213 port_alternate_protocol_pair.protocol = NPN_SPDY_3;
213 alternate_protocol_map[test_host_port_pair2] = port_alternate_protocol_pair; 214 alternate_protocol_map.Put(test_host_port_pair2,
215 port_alternate_protocol_pair);
214 impl_.InitializeAlternateProtocolServers(&alternate_protocol_map); 216 impl_.InitializeAlternateProtocolServers(&alternate_protocol_map);
215 217
216 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair1)); 218 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair1));
217 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair2)); 219 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair2));
218 port_alternate_protocol_pair = 220 port_alternate_protocol_pair =
219 impl_.GetAlternateProtocol(test_host_port_pair1); 221 impl_.GetAlternateProtocol(test_host_port_pair1);
220 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, port_alternate_protocol_pair.protocol); 222 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, port_alternate_protocol_pair.protocol);
221 port_alternate_protocol_pair = 223 port_alternate_protocol_pair =
222 impl_.GetAlternateProtocol(test_host_port_pair2); 224 impl_.GetAlternateProtocol(test_host_port_pair2);
223 EXPECT_EQ(123, port_alternate_protocol_pair.port); 225 EXPECT_EQ(123, port_alternate_protocol_pair.port);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 EXPECT_EQ(value3, flags_and_value3_ret.second); 431 EXPECT_EQ(value3, flags_and_value3_ret.second);
430 432
431 impl_.Clear(); 433 impl_.Clear();
432 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_google).size()); 434 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_google).size());
433 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_docs).size()); 435 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_docs).size());
434 } 436 }
435 437
436 } // namespace 438 } // namespace
437 439
438 } // namespace net 440 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698