Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 EXPECT_EQ(canonical_altsvc.port, alternative_service.port); | 438 EXPECT_EQ(canonical_altsvc.port, alternative_service.port); |
| 439 EXPECT_EQ(canonical_altsvc.protocol, alternative_service.protocol); | 439 EXPECT_EQ(canonical_altsvc.protocol, alternative_service.protocol); |
| 440 | 440 |
| 441 // Verify the canonical suffix. | 441 // Verify the canonical suffix. |
| 442 EXPECT_EQ(".c.youtube.com", | 442 EXPECT_EQ(".c.youtube.com", |
| 443 impl_.GetCanonicalSuffix(test_host_port_pair.host())); | 443 impl_.GetCanonicalSuffix(test_host_port_pair.host())); |
| 444 EXPECT_EQ(".c.youtube.com", | 444 EXPECT_EQ(".c.youtube.com", |
| 445 impl_.GetCanonicalSuffix(canonical_port_pair.host())); | 445 impl_.GetCanonicalSuffix(canonical_port_pair.host())); |
| 446 } | 446 } |
| 447 | 447 |
| 448 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalDefaultHost) { | |
| 449 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); | |
| 450 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); | |
| 451 | |
| 452 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); | |
| 453 EXPECT_FALSE(HasAlternativeService(canonical_port_pair)); | |
| 454 | |
| 455 AlternativeService canonical_altsvc(QUIC, "", 1234); | |
| 456 impl_.SetAlternativeService(canonical_port_pair, canonical_altsvc, 1.0); | |
| 457 ASSERT_TRUE(HasAlternativeService(test_host_port_pair)); | |
| 458 const AlternativeService alternative_service = | |
| 459 impl_.GetAlternativeService(test_host_port_pair); | |
| 460 EXPECT_EQ(canonical_altsvc.protocol, alternative_service.protocol); | |
| 461 EXPECT_EQ(test_host_port_pair.host(), alternative_service.host); | |
|
Ryan Hamilton
2015/03/23 20:48:07
This is great! Nice.
That being said, I'm astound
| |
| 462 EXPECT_EQ(canonical_altsvc.port, alternative_service.port); | |
| 463 } | |
| 464 | |
| 448 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBelowThreshold) { | 465 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBelowThreshold) { |
| 449 impl_.SetAlternateProtocolProbabilityThreshold(0.02); | 466 impl_.SetAlternateProtocolProbabilityThreshold(0.02); |
| 450 | 467 |
| 451 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); | 468 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); |
| 452 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); | 469 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); |
| 453 AlternativeService canonical_altsvc(QUIC, "bar.c.youtube.com", 1234); | 470 AlternativeService canonical_altsvc(QUIC, "bar.c.youtube.com", 1234); |
| 454 | 471 |
| 455 impl_.SetAlternativeService(canonical_port_pair, canonical_altsvc, 0.01); | 472 impl_.SetAlternativeService(canonical_port_pair, canonical_altsvc, 0.01); |
| 456 EXPECT_FALSE(HasAlternativeService(canonical_port_pair)); | 473 EXPECT_FALSE(HasAlternativeService(canonical_port_pair)); |
| 457 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); | 474 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); | 802 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); |
| 786 | 803 |
| 787 impl_.Clear(); | 804 impl_.Clear(); |
| 788 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server); | 805 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server); |
| 789 EXPECT_EQ(NULL, stats3); | 806 EXPECT_EQ(NULL, stats3); |
| 790 } | 807 } |
| 791 | 808 |
| 792 } // namespace | 809 } // namespace |
| 793 | 810 |
| 794 } // namespace net | 811 } // namespace net |
| OLD | NEW |