Index: net/http/http_server_properties_manager_unittest.cc |
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc |
index c22ed26f0c4453a7c1d5b08944d33b24f51afd76..d7269c57699372a0941496084e559de53a205671 100644 |
--- a/net/http/http_server_properties_manager_unittest.cc |
+++ b/net/http/http_server_properties_manager_unittest.cc |
@@ -22,6 +22,7 @@ |
#include "base/threading/thread_task_runner_handle.h" |
#include "base/values.h" |
#include "net/base/ip_address.h" |
+#include "net/http/http_network_session.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "url/gurl.h" |
@@ -161,6 +162,7 @@ class HttpServerPropertiesManagerTest : public testing::TestWithParam<int> { |
void SetUp() override { |
one_day_from_now_ = base::Time::Now() + base::TimeDelta::FromDays(1); |
+ advertised_versions_ = HttpNetworkSession::Params().quic_supported_versions; |
pref_delegate_ = new MockPrefDelegate; |
http_server_props_manager_.reset( |
new StrictMock<TestingHttpServerPropertiesManager>( |
@@ -234,6 +236,7 @@ class HttpServerPropertiesManagerTest : public testing::TestWithParam<int> { |
std::unique_ptr<TestingHttpServerPropertiesManager> |
http_server_props_manager_; |
base::Time one_day_from_now_; |
+ QuicVersionVector advertised_versions_; |
// Overrides the main thread's message loop with a mock tick clock. Making the |
// main thread the |pref_test_task_runner_| matches expectations better than |
@@ -725,10 +728,12 @@ TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServiceInfos) { |
const AlternativeService alternative_service(kProtoHTTP2, "mail.google.com", |
443); |
http_server_props_manager_->SetAlternativeService( |
- spdy_server_mail, alternative_service, one_day_from_now_); |
+ spdy_server_mail, alternative_service, one_day_from_now_, |
+ advertised_versions_); |
// ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once. |
http_server_props_manager_->SetAlternativeService( |
- spdy_server_mail, alternative_service, one_day_from_now_); |
+ spdy_server_mail, alternative_service, one_day_from_now_, |
+ advertised_versions_); |
// Run the task. |
EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); |
@@ -757,12 +762,12 @@ TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) { |
AlternativeServiceInfoVector alternative_service_info_vector; |
const AlternativeService alternative_service1(kProtoHTTP2, "mail.google.com", |
443); |
- alternative_service_info_vector.push_back( |
- AlternativeServiceInfo(alternative_service1, one_day_from_now_)); |
+ alternative_service_info_vector.push_back(AlternativeServiceInfo( |
+ alternative_service1, one_day_from_now_, advertised_versions_)); |
const AlternativeService alternative_service2(kProtoQUIC, "mail.google.com", |
1234); |
- alternative_service_info_vector.push_back( |
- AlternativeServiceInfo(alternative_service2, one_day_from_now_)); |
+ alternative_service_info_vector.push_back(AlternativeServiceInfo( |
+ alternative_service2, one_day_from_now_, advertised_versions_)); |
http_server_props_manager_->SetAlternativeServices( |
spdy_server_mail, alternative_service_info_vector); |
// ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once. |
@@ -821,7 +826,8 @@ TEST_P(HttpServerPropertiesManagerTest, ConfirmAlternativeService) { |
ExpectScheduleUpdatePrefsOnNetworkThread(); |
http_server_props_manager_->SetAlternativeService( |
- spdy_server_mail, alternative_service, one_day_from_now_); |
+ spdy_server_mail, alternative_service, one_day_from_now_, |
+ advertised_versions_); |
EXPECT_FALSE(http_server_props_manager_->IsAlternativeServiceBroken( |
alternative_service)); |
@@ -994,7 +1000,8 @@ TEST_P(HttpServerPropertiesManagerTest, Clear) { |
AlternativeService alternative_service(kProtoHTTP2, "mail.google.com", |
1234); |
http_server_props_manager_->SetAlternativeService( |
- spdy_server, alternative_service, one_day_from_now_); |
+ spdy_server, alternative_service, one_day_from_now_, |
+ advertised_versions_); |
http_server_props_manager_->SetSupportsQuic(true, actual_address); |
ServerNetworkStats stats; |
stats.srtt = base::TimeDelta::FromMicroseconds(10); |
@@ -1163,14 +1170,14 @@ TEST_P(HttpServerPropertiesManagerTest, UpdatePrefsWithCache) { |
AlternativeService www_alternative_service1(kProtoHTTP2, "", 443); |
base::Time expiration1; |
ASSERT_TRUE(base::Time::FromUTCString("2036-12-01 10:00:00", &expiration1)); |
- alternative_service_info_vector.push_back( |
- AlternativeServiceInfo(www_alternative_service1, expiration1)); |
+ alternative_service_info_vector.push_back(AlternativeServiceInfo( |
+ www_alternative_service1, expiration1, advertised_versions_)); |
AlternativeService www_alternative_service2(kProtoHTTP2, "www.google.com", |
1234); |
base::Time expiration2; |
ASSERT_TRUE(base::Time::FromUTCString("2036-12-31 10:00:00", &expiration2)); |
- alternative_service_info_vector.push_back( |
- AlternativeServiceInfo(www_alternative_service2, expiration2)); |
+ alternative_service_info_vector.push_back(AlternativeServiceInfo( |
+ www_alternative_service2, expiration2, advertised_versions_)); |
ASSERT_TRUE(http_server_props_manager_->SetAlternativeServices( |
server_www, alternative_service_info_vector)); |
@@ -1178,7 +1185,8 @@ TEST_P(HttpServerPropertiesManagerTest, UpdatePrefsWithCache) { |
444); |
base::Time expiration3 = base::Time::Max(); |
ASSERT_TRUE(http_server_props_manager_->SetAlternativeService( |
- server_mail, mail_alternative_service, expiration3)); |
+ server_mail, mail_alternative_service, expiration3, |
+ advertised_versions_)); |
// #3: Set ServerNetworkStats. |
ServerNetworkStats stats; |
@@ -1349,8 +1357,8 @@ TEST_P(HttpServerPropertiesManagerTest, |
kProtoHTTP2, "broken.example.com", 443); |
const base::Time time_one_day_later = |
base::Time::Now() + base::TimeDelta::FromDays(1); |
- alternative_service_info_vector.push_back( |
- AlternativeServiceInfo(broken_alternative_service, time_one_day_later)); |
+ alternative_service_info_vector.push_back(AlternativeServiceInfo( |
+ broken_alternative_service, time_one_day_later, advertised_versions_)); |
// #1: MarkAlternativeServiceBroken(). |
http_server_props_manager_->MarkAlternativeServiceBroken( |
broken_alternative_service); |
@@ -1359,13 +1367,13 @@ TEST_P(HttpServerPropertiesManagerTest, |
kProtoHTTP2, "expired.example.com", 443); |
const base::Time time_one_day_ago = |
base::Time::Now() - base::TimeDelta::FromDays(1); |
- alternative_service_info_vector.push_back( |
- AlternativeServiceInfo(expired_alternative_service, time_one_day_ago)); |
+ alternative_service_info_vector.push_back(AlternativeServiceInfo( |
+ expired_alternative_service, time_one_day_ago, advertised_versions_)); |
const AlternativeService valid_alternative_service( |
kProtoHTTP2, "valid.example.com", 443); |
- alternative_service_info_vector.push_back( |
- AlternativeServiceInfo(valid_alternative_service, time_one_day_later)); |
+ alternative_service_info_vector.push_back(AlternativeServiceInfo( |
+ valid_alternative_service, time_one_day_later, advertised_versions_)); |
const url::SchemeHostPort server("https", "www.example.com", 443); |
// #2: SetAlternativeService(). |