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

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

Issue 1205633002: Set alternative service even if it is broken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-add Patch Set 1. See tests passing in trybot output. Created 5 years, 6 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') | 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 ASSERT_TRUE(HasAlternativeService(test_host_port_pair)); 358 ASSERT_TRUE(HasAlternativeService(test_host_port_pair));
359 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service1)); 359 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service1));
360 360
361 const AlternativeService alternative_service2(NPN_SPDY_4, "foo", 1234); 361 const AlternativeService alternative_service2(NPN_SPDY_4, "foo", 1234);
362 impl_.SetAlternativeService(test_host_port_pair, alternative_service2, 1.0); 362 impl_.SetAlternativeService(test_host_port_pair, alternative_service2, 1.0);
363 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service1)); 363 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service1));
364 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service2)); 364 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service2));
365 EXPECT_EQ(1234, impl_.GetAlternativeService(test_host_port_pair).port); 365 EXPECT_EQ(1234, impl_.GetAlternativeService(test_host_port_pair).port);
366 } 366 }
367 367
368 // A broken alternative service in the mapping carries meaningful information,
369 // therefore it should not be ignored by SetAlternativeService().
370 TEST_F(AlternateProtocolServerPropertiesTest, AddBroken) {
371 HostPortPair test_host_port_pair("foo", 80);
372 ASSERT_FALSE(HasAlternativeService(test_host_port_pair));
373
374 const AlternativeService alternative_service(NPN_SPDY_4, "foo", 443);
375 impl_.MarkAlternativeServiceBroken(alternative_service);
376 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service));
377
378 impl_.SetAlternativeService(test_host_port_pair, alternative_service, 1.0);
379 ASSERT_TRUE(HasAlternativeService(test_host_port_pair));
Ryan Hamilton 2015/06/24 18:55:21 What will GetAlternateService return? Does this te
Bence 2015/06/24 20:30:46 GetAlternativeService() will return alternative_se
380 }
Ryan Hamilton 2015/06/24 18:55:21 Also, your CL comment mentions the interaction wit
Bence 2015/06/24 20:30:46 Good point. I combined the two tests into one, be
381
368 TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) { 382 TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) {
369 HostPortPair test_host_port_pair("foo", 80); 383 HostPortPair test_host_port_pair("foo", 80);
370 const AlternativeService alternative_service(NPN_SPDY_4, "foo", 443); 384 const AlternativeService alternative_service(NPN_SPDY_4, "foo", 443);
371 impl_.SetAlternativeService(test_host_port_pair, alternative_service, 1.0); 385 impl_.SetAlternativeService(test_host_port_pair, alternative_service, 1.0);
372 impl_.MarkAlternativeServiceBroken(alternative_service); 386 impl_.MarkAlternativeServiceBroken(alternative_service);
373 ASSERT_TRUE(HasAlternativeService(test_host_port_pair)); 387 ASSERT_TRUE(HasAlternativeService(test_host_port_pair));
374 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service)); 388 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service));
375 impl_.ClearAlternativeService(test_host_port_pair); 389 impl_.ClearAlternativeService(test_host_port_pair);
376 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); 390 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
377 } 391 }
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); 803 EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond());
790 804
791 impl_.Clear(); 805 impl_.Clear();
792 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server); 806 const ServerNetworkStats* stats3 = impl_.GetServerNetworkStats(foo_server);
793 EXPECT_EQ(NULL, stats3); 807 EXPECT_EQ(NULL, stats3);
794 } 808 }
795 809
796 } // namespace 810 } // namespace
797 811
798 } // namespace net 812 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698