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

Side by Side Diff: chrome/browser/net/http_server_properties_manager_unittest.cc

Issue 25977005: [SPDY] Do not advertise SPDY/2 by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 "chrome/browser/net/http_server_properties_manager.h" 5 #include "chrome/browser/net/http_server_properties_manager.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 // Verify AlternateProtocol. 212 // Verify AlternateProtocol.
213 ASSERT_TRUE(http_server_props_manager_->HasAlternateProtocol( 213 ASSERT_TRUE(http_server_props_manager_->HasAlternateProtocol(
214 net::HostPortPair::FromString("www.google.com:80"))); 214 net::HostPortPair::FromString("www.google.com:80")));
215 ASSERT_TRUE(http_server_props_manager_->HasAlternateProtocol( 215 ASSERT_TRUE(http_server_props_manager_->HasAlternateProtocol(
216 net::HostPortPair::FromString("mail.google.com:80"))); 216 net::HostPortPair::FromString("mail.google.com:80")));
217 net::PortAlternateProtocolPair port_alternate_protocol = 217 net::PortAlternateProtocolPair port_alternate_protocol =
218 http_server_props_manager_->GetAlternateProtocol( 218 http_server_props_manager_->GetAlternateProtocol(
219 net::HostPortPair::FromString("www.google.com:80")); 219 net::HostPortPair::FromString("www.google.com:80"));
220 EXPECT_EQ(443, port_alternate_protocol.port); 220 EXPECT_EQ(443, port_alternate_protocol.port);
221 EXPECT_EQ(net::NPN_SPDY_2, port_alternate_protocol.protocol); 221 EXPECT_EQ(net::NPN_SPDY_3, port_alternate_protocol.protocol);
222 port_alternate_protocol = 222 port_alternate_protocol =
223 http_server_props_manager_->GetAlternateProtocol( 223 http_server_props_manager_->GetAlternateProtocol(
224 net::HostPortPair::FromString("mail.google.com:80")); 224 net::HostPortPair::FromString("mail.google.com:80"));
225 EXPECT_EQ(444, port_alternate_protocol.port); 225 EXPECT_EQ(444, port_alternate_protocol.port);
226 EXPECT_EQ(net::NPN_SPDY_3, port_alternate_protocol.protocol); 226 EXPECT_EQ(net::NPN_SPDY_3, port_alternate_protocol.protocol);
227 227
228 // Verify pipeline capability. 228 // Verify pipeline capability.
229 EXPECT_EQ(net::PIPELINE_CAPABLE, 229 EXPECT_EQ(net::PIPELINE_CAPABLE,
230 http_server_props_manager_->GetPipelineCapability( 230 http_server_props_manager_->GetPipelineCapability(
231 net::HostPortPair::FromString("www.google.com:80"))); 231 net::HostPortPair::FromString("www.google.com:80")));
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); 353 Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
354 } 354 }
355 355
356 TEST_F(HttpServerPropertiesManagerTest, HasAlternateProtocol) { 356 TEST_F(HttpServerPropertiesManagerTest, HasAlternateProtocol) {
357 ExpectPrefsUpdate(); 357 ExpectPrefsUpdate();
358 358
359 net::HostPortPair spdy_server_mail("mail.google.com", 80); 359 net::HostPortPair spdy_server_mail("mail.google.com", 80);
360 EXPECT_FALSE( 360 EXPECT_FALSE(
361 http_server_props_manager_->HasAlternateProtocol(spdy_server_mail)); 361 http_server_props_manager_->HasAlternateProtocol(spdy_server_mail));
362 http_server_props_manager_->SetAlternateProtocol( 362 http_server_props_manager_->SetAlternateProtocol(
363 spdy_server_mail, 443, net::NPN_SPDY_2); 363 spdy_server_mail, 443, net::NPN_SPDY_3);
364 364
365 // Run the task. 365 // Run the task.
366 loop_.RunUntilIdle(); 366 loop_.RunUntilIdle();
367 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); 367 Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
368 368
369 ASSERT_TRUE( 369 ASSERT_TRUE(
370 http_server_props_manager_->HasAlternateProtocol(spdy_server_mail)); 370 http_server_props_manager_->HasAlternateProtocol(spdy_server_mail));
371 net::PortAlternateProtocolPair port_alternate_protocol = 371 net::PortAlternateProtocolPair port_alternate_protocol =
372 http_server_props_manager_->GetAlternateProtocol(spdy_server_mail); 372 http_server_props_manager_->GetAlternateProtocol(spdy_server_mail);
373 EXPECT_EQ(443, port_alternate_protocol.port); 373 EXPECT_EQ(443, port_alternate_protocol.port);
374 EXPECT_EQ(net::NPN_SPDY_2, port_alternate_protocol.protocol); 374 EXPECT_EQ(net::NPN_SPDY_3, port_alternate_protocol.protocol);
375 } 375 }
376 376
377 TEST_F(HttpServerPropertiesManagerTest, PipelineCapability) { 377 TEST_F(HttpServerPropertiesManagerTest, PipelineCapability) {
378 ExpectPrefsUpdate(); 378 ExpectPrefsUpdate();
379 379
380 net::HostPortPair known_pipeliner("pipeline.com", 8080); 380 net::HostPortPair known_pipeliner("pipeline.com", 8080);
381 net::HostPortPair bad_pipeliner("wordpress.com", 80); 381 net::HostPortPair bad_pipeliner("wordpress.com", 80);
382 EXPECT_EQ(net::PIPELINE_UNKNOWN, 382 EXPECT_EQ(net::PIPELINE_UNKNOWN,
383 http_server_props_manager_->GetPipelineCapability(known_pipeliner)); 383 http_server_props_manager_->GetPipelineCapability(known_pipeliner));
384 EXPECT_EQ(net::PIPELINE_UNKNOWN, 384 EXPECT_EQ(net::PIPELINE_UNKNOWN,
(...skipping 15 matching lines...) Expand all
400 http_server_props_manager_->GetPipelineCapability(bad_pipeliner)); 400 http_server_props_manager_->GetPipelineCapability(bad_pipeliner));
401 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); 401 Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
402 } 402 }
403 403
404 TEST_F(HttpServerPropertiesManagerTest, Clear) { 404 TEST_F(HttpServerPropertiesManagerTest, Clear) {
405 ExpectPrefsUpdate(); 405 ExpectPrefsUpdate();
406 406
407 net::HostPortPair spdy_server_mail("mail.google.com", 443); 407 net::HostPortPair spdy_server_mail("mail.google.com", 443);
408 http_server_props_manager_->SetSupportsSpdy(spdy_server_mail, true); 408 http_server_props_manager_->SetSupportsSpdy(spdy_server_mail, true);
409 http_server_props_manager_->SetAlternateProtocol( 409 http_server_props_manager_->SetAlternateProtocol(
410 spdy_server_mail, 443, net::NPN_SPDY_2); 410 spdy_server_mail, 443, net::NPN_SPDY_3);
411 411
412 const net::SpdySettingsIds id1 = net::SETTINGS_UPLOAD_BANDWIDTH; 412 const net::SpdySettingsIds id1 = net::SETTINGS_UPLOAD_BANDWIDTH;
413 const net::SpdySettingsFlags flags1 = net::SETTINGS_FLAG_PLEASE_PERSIST; 413 const net::SpdySettingsFlags flags1 = net::SETTINGS_FLAG_PLEASE_PERSIST;
414 const uint32 value1 = 31337; 414 const uint32 value1 = 31337;
415 http_server_props_manager_->SetSpdySetting( 415 http_server_props_manager_->SetSpdySetting(
416 spdy_server_mail, id1, flags1, value1); 416 spdy_server_mail, id1, flags1, value1);
417 417
418 net::HostPortPair known_pipeliner("pipeline.com", 8080); 418 net::HostPortPair known_pipeliner("pipeline.com", 8080);
419 http_server_props_manager_->SetPipelineCapability(known_pipeliner, 419 http_server_props_manager_->SetPipelineCapability(known_pipeliner,
420 net::PIPELINE_CAPABLE); 420 net::PIPELINE_CAPABLE);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 // Run the task after shutdown, but before deletion. 528 // Run the task after shutdown, but before deletion.
529 loop_.RunUntilIdle(); 529 loop_.RunUntilIdle();
530 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); 530 Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
531 http_server_props_manager_.reset(); 531 http_server_props_manager_.reset();
532 loop_.RunUntilIdle(); 532 loop_.RunUntilIdle();
533 } 533 }
534 534
535 } // namespace 535 } // namespace
536 536
537 } // namespace chrome_browser_net 537 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698