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

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

Issue 1002043002: Revert of Add MarkAlternativeServiceRecentlyBroken. (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 | « net/http/http_server_properties_impl.cc ('k') | net/http/http_server_properties_manager.h » ('j') | 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, 1.0); 342 impl_.SetAlternateProtocol(test_host_port_pair, 443, NPN_SPDY_3, 1.0);
343 impl_.SetBrokenAlternateProtocol(test_host_port_pair); 343 impl_.SetBrokenAlternateProtocol(test_host_port_pair);
344 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair)); 344 ASSERT_TRUE(HasAlternateProtocol(test_host_port_pair));
345 const AlternativeService alternative_service(NPN_SPDY_3, 345 const AlternativeService alternative_service(NPN_SPDY_3,
346 test_host_port_pair.host(), 443); 346 test_host_port_pair.host(), 443);
347 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service)); 347 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service));
348 impl_.ClearAlternateProtocol(test_host_port_pair); 348 impl_.ClearAlternateProtocol(test_host_port_pair);
349 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); 349 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
350 } 350 }
351 351
352 TEST_F(AlternateProtocolServerPropertiesTest, MarkRecentlyBroken) {
353 HostPortPair host_port_pair("foo", 80);
354 impl_.SetAlternateProtocol(host_port_pair, 443, NPN_SPDY_4, 1.0);
355
356 const AlternativeService alternative_service(NPN_SPDY_4, "foo", 443);
357 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
358 EXPECT_FALSE(impl_.WasAlternateProtocolRecentlyBroken(host_port_pair));
359
360 impl_.MarkAlternativeServiceRecentlyBroken(alternative_service);
361 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
362 EXPECT_TRUE(impl_.WasAlternateProtocolRecentlyBroken(host_port_pair));
363
364 impl_.ConfirmAlternateProtocol(host_port_pair);
365 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
366 EXPECT_FALSE(impl_.WasAlternateProtocolRecentlyBroken(host_port_pair));
367 }
368
369 TEST_F(AlternateProtocolServerPropertiesTest, Forced) { 352 TEST_F(AlternateProtocolServerPropertiesTest, Forced) {
370 // Test forced alternate protocols. 353 // Test forced alternate protocols.
371 354
372 AlternateProtocolInfo default_protocol(1234, NPN_SPDY_3, 1); 355 AlternateProtocolInfo default_protocol(1234, NPN_SPDY_3, 1);
373 HttpServerPropertiesImpl::ForceAlternateProtocol(default_protocol); 356 HttpServerPropertiesImpl::ForceAlternateProtocol(default_protocol);
374 357
375 // Verify the forced protocol. 358 // Verify the forced protocol.
376 HostPortPair test_host_port_pair("foo", 80); 359 HostPortPair test_host_port_pair("foo", 80);
377 EXPECT_TRUE(HasAlternateProtocol(test_host_port_pair)); 360 EXPECT_TRUE(HasAlternateProtocol(test_host_port_pair));
378 AlternateProtocolInfo alternate = 361 AlternateProtocolInfo alternate =
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); 738 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond());
756 739
757 impl_.Clear(); 740 impl_.Clear();
758 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server); 741 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server);
759 EXPECT_EQ(NULL, stats3); 742 EXPECT_EQ(NULL, stats3);
760 } 743 }
761 744
762 } // namespace 745 } // namespace
763 746
764 } // namespace net 747 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | net/http/http_server_properties_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698