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

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

Issue 1006813015: Add unittest for canonical host override. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBroken) { 499 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBroken) {
500 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); 500 HostPortPair test_host_port_pair("foo.c.youtube.com", 80);
501 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); 501 HostPortPair canonical_port_pair("bar.c.youtube.com", 80);
502 AlternativeService canonical_altsvc(QUIC, "bar.c.youtube.com", 1234); 502 AlternativeService canonical_altsvc(QUIC, "bar.c.youtube.com", 1234);
503 503
504 impl_.SetAlternativeService(canonical_port_pair, canonical_altsvc, 1.0); 504 impl_.SetAlternativeService(canonical_port_pair, canonical_altsvc, 1.0);
505 impl_.MarkAlternativeServiceBroken(canonical_altsvc); 505 impl_.MarkAlternativeServiceBroken(canonical_altsvc);
506 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); 506 EXPECT_FALSE(HasAlternativeService(test_host_port_pair));
507 } 507 }
508 508
509 // Adding an alternative service for a new host overrides canonical host.
510 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalOverride) {
511 HostPortPair test_host_port_pair("foo.c.youtube.com", 80);
512 HostPortPair bar_host_port_pair("bar.c.youtube.com", 80);
513 AlternativeService bar_alternative_service(QUIC, "bar.c.youtube.com", 1234);
514 impl_.SetAlternativeService(bar_host_port_pair, bar_alternative_service, 1.0);
515 AlternativeService altsvc = impl_.GetAlternativeService(test_host_port_pair);
516 EXPECT_EQ(1234, altsvc.port);
517
518 HostPortPair qux_host_port_pair("qux.c.youtube.com", 80);
519 AlternativeService qux_alternative_service(QUIC, "qux.c.youtube.com", 443);
520 impl_.SetAlternativeService(qux_host_port_pair, qux_alternative_service, 1.0);
521 altsvc = impl_.GetAlternativeService(test_host_port_pair);
522 EXPECT_EQ(443, altsvc.port);
523 }
524
509 TEST_F(AlternateProtocolServerPropertiesTest, ClearWithCanonical) { 525 TEST_F(AlternateProtocolServerPropertiesTest, ClearWithCanonical) {
510 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); 526 HostPortPair test_host_port_pair("foo.c.youtube.com", 80);
511 HostPortPair canonical_port_pair("bar.c.youtube.com", 80); 527 HostPortPair canonical_port_pair("bar.c.youtube.com", 80);
512 AlternativeService canonical_altsvc(QUIC, "bar.c.youtube.com", 1234); 528 AlternativeService canonical_altsvc(QUIC, "bar.c.youtube.com", 1234);
513 529
514 impl_.SetAlternativeService(canonical_port_pair, canonical_altsvc, 1.0); 530 impl_.SetAlternativeService(canonical_port_pair, canonical_altsvc, 1.0);
515 impl_.Clear(); 531 impl_.Clear();
516 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); 532 EXPECT_FALSE(HasAlternativeService(test_host_port_pair));
517 } 533 }
518 534
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); 818 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond());
803 819
804 impl_.Clear(); 820 impl_.Clear();
805 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server); 821 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server);
806 EXPECT_EQ(NULL, stats3); 822 EXPECT_EQ(NULL, stats3);
807 } 823 }
808 824
809 } // namespace 825 } // namespace
810 826
811 } // namespace net 827 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698