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

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

Issue 2901093004: Add and persist a new field in AlternativeServiceInfo to list QUIC verisons advertised (Closed)
Patch Set: self review Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_manager.h" 5 #include "net/http/http_server_properties_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/test/scoped_mock_time_message_loop_task_runner.h" 19 #include "base/test/scoped_mock_time_message_loop_task_runner.h"
20 #include "base/test/test_mock_time_task_runner.h" 20 #include "base/test/test_mock_time_task_runner.h"
21 #include "base/test/test_simple_task_runner.h" 21 #include "base/test/test_simple_task_runner.h"
22 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
23 #include "base/values.h" 23 #include "base/values.h"
24 #include "net/base/ip_address.h" 24 #include "net/base/ip_address.h"
25 #include "net/http/http_network_session.h"
25 #include "testing/gmock/include/gmock/gmock.h" 26 #include "testing/gmock/include/gmock/gmock.h"
26 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
27 #include "url/gurl.h" 28 #include "url/gurl.h"
28 29
29 namespace net { 30 namespace net {
30 31
31 namespace { 32 namespace {
32 33
33 using base::StringPrintf; 34 using base::StringPrintf;
34 using base::TestMockTimeTaskRunner; 35 using base::TestMockTimeTaskRunner;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // TODO(rtenneti): After we stop supporting version 3 and everyone has migrated 155 // TODO(rtenneti): After we stop supporting version 3 and everyone has migrated
155 // to version 4, delete the following code. 156 // to version 4, delete the following code.
156 static const int kHttpServerPropertiesVersions[] = {3, 4, 5}; 157 static const int kHttpServerPropertiesVersions[] = {3, 4, 5};
157 158
158 class HttpServerPropertiesManagerTest : public testing::TestWithParam<int> { 159 class HttpServerPropertiesManagerTest : public testing::TestWithParam<int> {
159 protected: 160 protected:
160 HttpServerPropertiesManagerTest() = default; 161 HttpServerPropertiesManagerTest() = default;
161 162
162 void SetUp() override { 163 void SetUp() override {
163 one_day_from_now_ = base::Time::Now() + base::TimeDelta::FromDays(1); 164 one_day_from_now_ = base::Time::Now() + base::TimeDelta::FromDays(1);
165 advertised_versions_ = HttpNetworkSession::Params().quic_supported_versions;
164 pref_delegate_ = new MockPrefDelegate; 166 pref_delegate_ = new MockPrefDelegate;
165 http_server_props_manager_.reset( 167 http_server_props_manager_.reset(
166 new StrictMock<TestingHttpServerPropertiesManager>( 168 new StrictMock<TestingHttpServerPropertiesManager>(
167 pref_delegate_, pref_test_task_runner_.task_runner(), 169 pref_delegate_, pref_test_task_runner_.task_runner(),
168 net_test_task_runner_)); 170 net_test_task_runner_));
169 171
170 EXPECT_FALSE(http_server_props_manager_->IsInitialized()); 172 EXPECT_FALSE(http_server_props_manager_->IsInitialized());
171 ExpectCacheUpdate(); 173 ExpectCacheUpdate();
172 EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); 174 EXPECT_FALSE(net_test_task_runner_->HasPendingTask());
173 pref_test_task_runner_->RunUntilIdle(); 175 pref_test_task_runner_->RunUntilIdle();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 bool HasAlternativeService(const url::SchemeHostPort& server) { 229 bool HasAlternativeService(const url::SchemeHostPort& server) {
228 const AlternativeServiceInfoVector alternative_service_info_vector = 230 const AlternativeServiceInfoVector alternative_service_info_vector =
229 http_server_props_manager_->GetAlternativeServiceInfos(server); 231 http_server_props_manager_->GetAlternativeServiceInfos(server);
230 return !alternative_service_info_vector.empty(); 232 return !alternative_service_info_vector.empty();
231 } 233 }
232 234
233 MockPrefDelegate* pref_delegate_; // Owned by HttpServerPropertiesManager. 235 MockPrefDelegate* pref_delegate_; // Owned by HttpServerPropertiesManager.
234 std::unique_ptr<TestingHttpServerPropertiesManager> 236 std::unique_ptr<TestingHttpServerPropertiesManager>
235 http_server_props_manager_; 237 http_server_props_manager_;
236 base::Time one_day_from_now_; 238 base::Time one_day_from_now_;
239 QuicVersionVector advertised_versions_;
237 240
238 // Overrides the main thread's message loop with a mock tick clock. Making the 241 // Overrides the main thread's message loop with a mock tick clock. Making the
239 // main thread the |pref_test_task_runner_| matches expectations better than 242 // main thread the |pref_test_task_runner_| matches expectations better than
240 // having an independent TestMockTimeTaskRunner and makes tests easier to 243 // having an independent TestMockTimeTaskRunner and makes tests easier to
241 // write. 244 // write.
242 base::ScopedMockTimeMessageLoopTaskRunner pref_test_task_runner_; 245 base::ScopedMockTimeMessageLoopTaskRunner pref_test_task_runner_;
243 246
244 // Mock the net task runner as well. 247 // Mock the net task runner as well.
245 scoped_refptr<TestMockTimeTaskRunner> net_test_task_runner_ = 248 scoped_refptr<TestMockTimeTaskRunner> net_test_task_runner_ =
246 new TestMockTimeTaskRunner; 249 new TestMockTimeTaskRunner;
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 721
719 TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServiceInfos) { 722 TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServiceInfos) {
720 ExpectPrefsUpdate(1); 723 ExpectPrefsUpdate(1);
721 ExpectScheduleUpdatePrefsOnNetworkThread(); 724 ExpectScheduleUpdatePrefsOnNetworkThread();
722 725
723 url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80); 726 url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80);
724 EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); 727 EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
725 const AlternativeService alternative_service(kProtoHTTP2, "mail.google.com", 728 const AlternativeService alternative_service(kProtoHTTP2, "mail.google.com",
726 443); 729 443);
727 http_server_props_manager_->SetAlternativeService( 730 http_server_props_manager_->SetAlternativeService(
728 spdy_server_mail, alternative_service, one_day_from_now_); 731 spdy_server_mail, alternative_service, one_day_from_now_,
732 advertised_versions_);
729 // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once. 733 // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once.
730 http_server_props_manager_->SetAlternativeService( 734 http_server_props_manager_->SetAlternativeService(
731 spdy_server_mail, alternative_service, one_day_from_now_); 735 spdy_server_mail, alternative_service, one_day_from_now_,
736 advertised_versions_);
732 737
733 // Run the task. 738 // Run the task.
734 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); 739 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask());
735 EXPECT_TRUE(net_test_task_runner_->HasPendingTask()); 740 EXPECT_TRUE(net_test_task_runner_->HasPendingTask());
736 net_test_task_runner_->FastForwardUntilNoTasksRemain(); 741 net_test_task_runner_->FastForwardUntilNoTasksRemain();
737 EXPECT_TRUE(pref_test_task_runner_->HasPendingTask()); 742 EXPECT_TRUE(pref_test_task_runner_->HasPendingTask());
738 EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); 743 EXPECT_FALSE(net_test_task_runner_->HasPendingTask());
739 pref_test_task_runner_->FastForwardUntilNoTasksRemain(); 744 pref_test_task_runner_->FastForwardUntilNoTasksRemain();
740 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); 745 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask());
741 EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); 746 EXPECT_FALSE(net_test_task_runner_->HasPendingTask());
742 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); 747 Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
743 748
744 AlternativeServiceInfoVector alternative_service_info_vector = 749 AlternativeServiceInfoVector alternative_service_info_vector =
745 http_server_props_manager_->GetAlternativeServiceInfos(spdy_server_mail); 750 http_server_props_manager_->GetAlternativeServiceInfos(spdy_server_mail);
746 ASSERT_EQ(1u, alternative_service_info_vector.size()); 751 ASSERT_EQ(1u, alternative_service_info_vector.size());
747 EXPECT_EQ(alternative_service, 752 EXPECT_EQ(alternative_service,
748 alternative_service_info_vector[0].alternative_service); 753 alternative_service_info_vector[0].alternative_service);
749 } 754 }
750 755
751 TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) { 756 TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) {
752 ExpectPrefsUpdate(1); 757 ExpectPrefsUpdate(1);
753 ExpectScheduleUpdatePrefsOnNetworkThread(); 758 ExpectScheduleUpdatePrefsOnNetworkThread();
754 759
755 url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80); 760 url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80);
756 EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); 761 EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
757 AlternativeServiceInfoVector alternative_service_info_vector; 762 AlternativeServiceInfoVector alternative_service_info_vector;
758 const AlternativeService alternative_service1(kProtoHTTP2, "mail.google.com", 763 const AlternativeService alternative_service1(kProtoHTTP2, "mail.google.com",
759 443); 764 443);
760 alternative_service_info_vector.push_back( 765 alternative_service_info_vector.push_back(AlternativeServiceInfo(
761 AlternativeServiceInfo(alternative_service1, one_day_from_now_)); 766 alternative_service1, one_day_from_now_, advertised_versions_));
762 const AlternativeService alternative_service2(kProtoQUIC, "mail.google.com", 767 const AlternativeService alternative_service2(kProtoQUIC, "mail.google.com",
763 1234); 768 1234);
764 alternative_service_info_vector.push_back( 769 alternative_service_info_vector.push_back(AlternativeServiceInfo(
765 AlternativeServiceInfo(alternative_service2, one_day_from_now_)); 770 alternative_service2, one_day_from_now_, advertised_versions_));
766 http_server_props_manager_->SetAlternativeServices( 771 http_server_props_manager_->SetAlternativeServices(
767 spdy_server_mail, alternative_service_info_vector); 772 spdy_server_mail, alternative_service_info_vector);
768 // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once. 773 // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once.
769 http_server_props_manager_->SetAlternativeServices( 774 http_server_props_manager_->SetAlternativeServices(
770 spdy_server_mail, alternative_service_info_vector); 775 spdy_server_mail, alternative_service_info_vector);
771 776
772 // Run the task. 777 // Run the task.
773 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); 778 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask());
774 EXPECT_TRUE(net_test_task_runner_->HasPendingTask()); 779 EXPECT_TRUE(net_test_task_runner_->HasPendingTask());
775 net_test_task_runner_->FastForwardUntilNoTasksRemain(); 780 net_test_task_runner_->FastForwardUntilNoTasksRemain();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 { 819 {
815 TestMockTimeTaskRunner::ScopedContext scoped_context(net_test_task_runner_); 820 TestMockTimeTaskRunner::ScopedContext scoped_context(net_test_task_runner_);
816 821
817 spdy_server_mail = url::SchemeHostPort("http", "mail.google.com", 80); 822 spdy_server_mail = url::SchemeHostPort("http", "mail.google.com", 80);
818 EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); 823 EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
819 alternative_service = 824 alternative_service =
820 AlternativeService(kProtoHTTP2, "mail.google.com", 443); 825 AlternativeService(kProtoHTTP2, "mail.google.com", 443);
821 826
822 ExpectScheduleUpdatePrefsOnNetworkThread(); 827 ExpectScheduleUpdatePrefsOnNetworkThread();
823 http_server_props_manager_->SetAlternativeService( 828 http_server_props_manager_->SetAlternativeService(
824 spdy_server_mail, alternative_service, one_day_from_now_); 829 spdy_server_mail, alternative_service, one_day_from_now_,
830 advertised_versions_);
825 831
826 EXPECT_FALSE(http_server_props_manager_->IsAlternativeServiceBroken( 832 EXPECT_FALSE(http_server_props_manager_->IsAlternativeServiceBroken(
827 alternative_service)); 833 alternative_service));
828 EXPECT_FALSE( 834 EXPECT_FALSE(
829 http_server_props_manager_->WasAlternativeServiceRecentlyBroken( 835 http_server_props_manager_->WasAlternativeServiceRecentlyBroken(
830 alternative_service)); 836 alternative_service));
831 837
832 ExpectScheduleUpdatePrefsOnNetworkThread(); 838 ExpectScheduleUpdatePrefsOnNetworkThread();
833 http_server_props_manager_->MarkAlternativeServiceBroken( 839 http_server_props_manager_->MarkAlternativeServiceBroken(
834 alternative_service); 840 alternative_service);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 const QuicServerId mail_quic_server_id("mail.google.com", 80); 993 const QuicServerId mail_quic_server_id("mail.google.com", 80);
988 const std::string quic_server_info1("quic_server_info1"); 994 const std::string quic_server_info1("quic_server_info1");
989 995
990 { 996 {
991 TestMockTimeTaskRunner::ScopedContext scoped_context(net_test_task_runner_); 997 TestMockTimeTaskRunner::ScopedContext scoped_context(net_test_task_runner_);
992 998
993 http_server_props_manager_->SetSupportsSpdy(spdy_server, true); 999 http_server_props_manager_->SetSupportsSpdy(spdy_server, true);
994 AlternativeService alternative_service(kProtoHTTP2, "mail.google.com", 1000 AlternativeService alternative_service(kProtoHTTP2, "mail.google.com",
995 1234); 1001 1234);
996 http_server_props_manager_->SetAlternativeService( 1002 http_server_props_manager_->SetAlternativeService(
997 spdy_server, alternative_service, one_day_from_now_); 1003 spdy_server, alternative_service, one_day_from_now_,
1004 advertised_versions_);
998 http_server_props_manager_->SetSupportsQuic(true, actual_address); 1005 http_server_props_manager_->SetSupportsQuic(true, actual_address);
999 ServerNetworkStats stats; 1006 ServerNetworkStats stats;
1000 stats.srtt = base::TimeDelta::FromMicroseconds(10); 1007 stats.srtt = base::TimeDelta::FromMicroseconds(10);
1001 http_server_props_manager_->SetServerNetworkStats(spdy_server, stats); 1008 http_server_props_manager_->SetServerNetworkStats(spdy_server, stats);
1002 1009
1003 http_server_props_manager_->SetQuicServerInfo(mail_quic_server_id, 1010 http_server_props_manager_->SetQuicServerInfo(mail_quic_server_id,
1004 quic_server_info1); 1011 quic_server_info1);
1005 } 1012 }
1006 1013
1007 // Run the task. 1014 // Run the task.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 ExpectScheduleUpdatePrefsOnNetworkThreadRepeatedly(5); 1163 ExpectScheduleUpdatePrefsOnNetworkThreadRepeatedly(5);
1157 1164
1158 const url::SchemeHostPort server_www("https", "www.google.com", 80); 1165 const url::SchemeHostPort server_www("https", "www.google.com", 80);
1159 const url::SchemeHostPort server_mail("https", "mail.google.com", 80); 1166 const url::SchemeHostPort server_mail("https", "mail.google.com", 80);
1160 1167
1161 // #1 & #2: Set alternate protocol. 1168 // #1 & #2: Set alternate protocol.
1162 AlternativeServiceInfoVector alternative_service_info_vector; 1169 AlternativeServiceInfoVector alternative_service_info_vector;
1163 AlternativeService www_alternative_service1(kProtoHTTP2, "", 443); 1170 AlternativeService www_alternative_service1(kProtoHTTP2, "", 443);
1164 base::Time expiration1; 1171 base::Time expiration1;
1165 ASSERT_TRUE(base::Time::FromUTCString("2036-12-01 10:00:00", &expiration1)); 1172 ASSERT_TRUE(base::Time::FromUTCString("2036-12-01 10:00:00", &expiration1));
1166 alternative_service_info_vector.push_back( 1173 alternative_service_info_vector.push_back(AlternativeServiceInfo(
1167 AlternativeServiceInfo(www_alternative_service1, expiration1)); 1174 www_alternative_service1, expiration1, advertised_versions_));
1168 AlternativeService www_alternative_service2(kProtoHTTP2, "www.google.com", 1175 AlternativeService www_alternative_service2(kProtoHTTP2, "www.google.com",
1169 1234); 1176 1234);
1170 base::Time expiration2; 1177 base::Time expiration2;
1171 ASSERT_TRUE(base::Time::FromUTCString("2036-12-31 10:00:00", &expiration2)); 1178 ASSERT_TRUE(base::Time::FromUTCString("2036-12-31 10:00:00", &expiration2));
1172 alternative_service_info_vector.push_back( 1179 alternative_service_info_vector.push_back(AlternativeServiceInfo(
1173 AlternativeServiceInfo(www_alternative_service2, expiration2)); 1180 www_alternative_service2, expiration2, advertised_versions_));
1174 ASSERT_TRUE(http_server_props_manager_->SetAlternativeServices( 1181 ASSERT_TRUE(http_server_props_manager_->SetAlternativeServices(
1175 server_www, alternative_service_info_vector)); 1182 server_www, alternative_service_info_vector));
1176 1183
1177 AlternativeService mail_alternative_service(kProtoHTTP2, "foo.google.com", 1184 AlternativeService mail_alternative_service(kProtoHTTP2, "foo.google.com",
1178 444); 1185 444);
1179 base::Time expiration3 = base::Time::Max(); 1186 base::Time expiration3 = base::Time::Max();
1180 ASSERT_TRUE(http_server_props_manager_->SetAlternativeService( 1187 ASSERT_TRUE(http_server_props_manager_->SetAlternativeService(
1181 server_mail, mail_alternative_service, expiration3)); 1188 server_mail, mail_alternative_service, expiration3,
1189 advertised_versions_));
1182 1190
1183 // #3: Set ServerNetworkStats. 1191 // #3: Set ServerNetworkStats.
1184 ServerNetworkStats stats; 1192 ServerNetworkStats stats;
1185 stats.srtt = base::TimeDelta::FromInternalValue(42); 1193 stats.srtt = base::TimeDelta::FromInternalValue(42);
1186 http_server_props_manager_->SetServerNetworkStats(server_mail, stats); 1194 http_server_props_manager_->SetServerNetworkStats(server_mail, stats);
1187 1195
1188 // #4: Set quic_server_info string. 1196 // #4: Set quic_server_info string.
1189 QuicServerId mail_quic_server_id("mail.google.com", 80); 1197 QuicServerId mail_quic_server_id("mail.google.com", 80);
1190 std::string quic_server_info1("quic_server_info1"); 1198 std::string quic_server_info1("quic_server_info1");
1191 http_server_props_manager_->SetQuicServerInfo(mail_quic_server_id, 1199 http_server_props_manager_->SetQuicServerInfo(mail_quic_server_id,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 1350
1343 { 1351 {
1344 TestMockTimeTaskRunner::ScopedContext scoped_context(net_test_task_runner_); 1352 TestMockTimeTaskRunner::ScopedContext scoped_context(net_test_task_runner_);
1345 1353
1346 AlternativeServiceInfoVector alternative_service_info_vector; 1354 AlternativeServiceInfoVector alternative_service_info_vector;
1347 1355
1348 const AlternativeService broken_alternative_service( 1356 const AlternativeService broken_alternative_service(
1349 kProtoHTTP2, "broken.example.com", 443); 1357 kProtoHTTP2, "broken.example.com", 443);
1350 const base::Time time_one_day_later = 1358 const base::Time time_one_day_later =
1351 base::Time::Now() + base::TimeDelta::FromDays(1); 1359 base::Time::Now() + base::TimeDelta::FromDays(1);
1352 alternative_service_info_vector.push_back( 1360 alternative_service_info_vector.push_back(AlternativeServiceInfo(
1353 AlternativeServiceInfo(broken_alternative_service, time_one_day_later)); 1361 broken_alternative_service, time_one_day_later, advertised_versions_));
1354 // #1: MarkAlternativeServiceBroken(). 1362 // #1: MarkAlternativeServiceBroken().
1355 http_server_props_manager_->MarkAlternativeServiceBroken( 1363 http_server_props_manager_->MarkAlternativeServiceBroken(
1356 broken_alternative_service); 1364 broken_alternative_service);
1357 1365
1358 const AlternativeService expired_alternative_service( 1366 const AlternativeService expired_alternative_service(
1359 kProtoHTTP2, "expired.example.com", 443); 1367 kProtoHTTP2, "expired.example.com", 443);
1360 const base::Time time_one_day_ago = 1368 const base::Time time_one_day_ago =
1361 base::Time::Now() - base::TimeDelta::FromDays(1); 1369 base::Time::Now() - base::TimeDelta::FromDays(1);
1362 alternative_service_info_vector.push_back( 1370 alternative_service_info_vector.push_back(AlternativeServiceInfo(
1363 AlternativeServiceInfo(expired_alternative_service, time_one_day_ago)); 1371 expired_alternative_service, time_one_day_ago, advertised_versions_));
1364 1372
1365 const AlternativeService valid_alternative_service( 1373 const AlternativeService valid_alternative_service(
1366 kProtoHTTP2, "valid.example.com", 443); 1374 kProtoHTTP2, "valid.example.com", 443);
1367 alternative_service_info_vector.push_back( 1375 alternative_service_info_vector.push_back(AlternativeServiceInfo(
1368 AlternativeServiceInfo(valid_alternative_service, time_one_day_later)); 1376 valid_alternative_service, time_one_day_later, advertised_versions_));
1369 1377
1370 const url::SchemeHostPort server("https", "www.example.com", 443); 1378 const url::SchemeHostPort server("https", "www.example.com", 443);
1371 // #2: SetAlternativeService(). 1379 // #2: SetAlternativeService().
1372 ASSERT_TRUE(http_server_props_manager_->SetAlternativeServices( 1380 ASSERT_TRUE(http_server_props_manager_->SetAlternativeServices(
1373 server, alternative_service_info_vector)); 1381 server, alternative_service_info_vector));
1374 } 1382 }
1375 1383
1376 // Update cache. 1384 // Update cache.
1377 ExpectPrefsUpdate(1); 1385 ExpectPrefsUpdate(1);
1378 1386
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 pref_test_task_runner_->FastForwardUntilNoTasksRemain(); 1565 pref_test_task_runner_->FastForwardUntilNoTasksRemain();
1558 EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); 1566 EXPECT_FALSE(net_test_task_runner_->HasPendingTask());
1559 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); 1567 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask());
1560 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); 1568 Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
1561 http_server_props_manager_.reset(); 1569 http_server_props_manager_.reset();
1562 EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); 1570 EXPECT_FALSE(net_test_task_runner_->HasPendingTask());
1563 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); 1571 EXPECT_FALSE(pref_test_task_runner_->HasPendingTask());
1564 } 1572 }
1565 1573
1566 } // namespace net 1574 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698