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

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

Issue 9252029: SPDY - default to SPDY/2.1 protocol in unittests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync with trunk Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { 205 TEST_F(AlternateProtocolServerPropertiesTest, Initialize) {
206 HostPortPair test_host_port_pair1("foo1", 80); 206 HostPortPair test_host_port_pair1("foo1", 80);
207 impl_.SetBrokenAlternateProtocol(test_host_port_pair1); 207 impl_.SetBrokenAlternateProtocol(test_host_port_pair1);
208 HostPortPair test_host_port_pair2("foo2", 80); 208 HostPortPair test_host_port_pair2("foo2", 80);
209 impl_.SetAlternateProtocol( 209 impl_.SetAlternateProtocol(
210 test_host_port_pair2, 443, NPN_SPDY_1); 210 test_host_port_pair2, 443, NPN_SPDY_1);
211 211
212 AlternateProtocolMap alternate_protocol_map; 212 AlternateProtocolMap alternate_protocol_map;
213 PortAlternateProtocolPair port_alternate_protocol_pair; 213 PortAlternateProtocolPair port_alternate_protocol_pair;
214 port_alternate_protocol_pair.port = 123; 214 port_alternate_protocol_pair.port = 123;
215 port_alternate_protocol_pair.protocol = NPN_SPDY_2; 215 port_alternate_protocol_pair.protocol = NPN_SPDY_21;
216 alternate_protocol_map[test_host_port_pair2] = port_alternate_protocol_pair; 216 alternate_protocol_map[test_host_port_pair2] = port_alternate_protocol_pair;
217 impl_.InitializeAlternateProtocolServers(&alternate_protocol_map); 217 impl_.InitializeAlternateProtocolServers(&alternate_protocol_map);
218 218
219 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair1)); 219 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair1));
220 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair2)); 220 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair2));
221 port_alternate_protocol_pair = 221 port_alternate_protocol_pair =
222 impl_.GetAlternateProtocol(test_host_port_pair1); 222 impl_.GetAlternateProtocol(test_host_port_pair1);
223 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, port_alternate_protocol_pair.protocol); 223 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, port_alternate_protocol_pair.protocol);
224 port_alternate_protocol_pair = 224 port_alternate_protocol_pair =
225 impl_.GetAlternateProtocol(test_host_port_pair2); 225 impl_.GetAlternateProtocol(test_host_port_pair2);
226 EXPECT_EQ(123, port_alternate_protocol_pair.port); 226 EXPECT_EQ(123, port_alternate_protocol_pair.port);
227 EXPECT_EQ(NPN_SPDY_2, port_alternate_protocol_pair.protocol); 227 EXPECT_EQ(NPN_SPDY_21, port_alternate_protocol_pair.protocol);
228 } 228 }
229 229
230 TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) { 230 TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) {
231 HostPortPair test_host_port_pair("foo", 80); 231 HostPortPair test_host_port_pair("foo", 80);
232 impl_.SetBrokenAlternateProtocol(test_host_port_pair); 232 impl_.SetBrokenAlternateProtocol(test_host_port_pair);
233 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair)); 233 ASSERT_TRUE(impl_.HasAlternateProtocol(test_host_port_pair));
234 PortAlternateProtocolPair alternate = 234 PortAlternateProtocolPair alternate =
235 impl_.GetAlternateProtocol(test_host_port_pair); 235 impl_.GetAlternateProtocol(test_host_port_pair);
236 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol); 236 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol);
237 237
238 impl_.SetAlternateProtocol( 238 impl_.SetAlternateProtocol(
239 test_host_port_pair, 239 test_host_port_pair,
240 1234, 240 1234,
241 NPN_SPDY_1); 241 NPN_SPDY_1);
242 alternate = impl_.GetAlternateProtocol(test_host_port_pair); 242 alternate = impl_.GetAlternateProtocol(test_host_port_pair);
243 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol) 243 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol)
244 << "Second attempt should be ignored."; 244 << "Second attempt should be ignored.";
245 } 245 }
246 246
247 TEST_F(AlternateProtocolServerPropertiesTest, Forced) { 247 TEST_F(AlternateProtocolServerPropertiesTest, Forced) {
248 // Test forced alternate protocols. 248 // Test forced alternate protocols.
249 249
250 PortAlternateProtocolPair default_protocol; 250 PortAlternateProtocolPair default_protocol;
251 default_protocol.port = 1234; 251 default_protocol.port = 1234;
252 default_protocol.protocol = NPN_SPDY_2; 252 default_protocol.protocol = NPN_SPDY_21;
253 HttpServerPropertiesImpl::ForceAlternateProtocol(default_protocol); 253 HttpServerPropertiesImpl::ForceAlternateProtocol(default_protocol);
254 254
255 // Verify the forced protocol. 255 // Verify the forced protocol.
256 HostPortPair test_host_port_pair("foo", 80); 256 HostPortPair test_host_port_pair("foo", 80);
257 EXPECT_TRUE( 257 EXPECT_TRUE(
258 impl_.HasAlternateProtocol(test_host_port_pair)); 258 impl_.HasAlternateProtocol(test_host_port_pair));
259 PortAlternateProtocolPair alternate = 259 PortAlternateProtocolPair alternate =
260 impl_.GetAlternateProtocol(test_host_port_pair); 260 impl_.GetAlternateProtocol(test_host_port_pair);
261 EXPECT_EQ(default_protocol.port, alternate.port); 261 EXPECT_EQ(default_protocol.port, alternate.port);
262 EXPECT_EQ(default_protocol.protocol, alternate.protocol); 262 EXPECT_EQ(default_protocol.protocol, alternate.protocol);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 EXPECT_EQ(93997U, spdy_setting3_ret.second); 393 EXPECT_EQ(93997U, spdy_setting3_ret.second);
394 394
395 impl_.Clear(); 395 impl_.Clear();
396 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_google).size()); 396 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_google).size());
397 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_docs).size()); 397 EXPECT_EQ(0U, impl_.GetSpdySettings(spdy_server_docs).size());
398 } 398 }
399 399
400 } // namespace 400 } // namespace
401 401
402 } // namespace net 402 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_pool_unittest.cc ('k') | net/http/http_stream_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698