diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 10:22:43 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 12:36:28 +0000 |
commit | 271a6c3487a14599023a9106329505597638d793 (patch) | |
tree | e040d58ffc86c1480b79ca8528020ca9ec919bf8 /chromium/net/http/http_server_properties_manager_unittest.cc | |
parent | 7b2ffa587235a47d4094787d72f38102089f402a (diff) | |
download | qtwebengine-chromium-271a6c3487a14599023a9106329505597638d793.tar.gz |
BASELINE: Update Chromium to 77.0.3865.59
Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/net/http/http_server_properties_manager_unittest.cc')
-rw-r--r-- | chromium/net/http/http_server_properties_manager_unittest.cc | 200 |
1 files changed, 63 insertions, 137 deletions
diff --git a/chromium/net/http/http_server_properties_manager_unittest.cc b/chromium/net/http/http_server_properties_manager_unittest.cc index 59762bcc1f7..4921d2e610b 100644 --- a/chromium/net/http/http_server_properties_manager_unittest.cc +++ b/chromium/net/http/http_server_properties_manager_unittest.cc @@ -98,20 +98,17 @@ class MockPrefDelegate : public net::HttpServerPropertiesManager::PrefDelegate { } // namespace -// TODO(rtenneti): After we stop supporting version 3 and everyone has migrated -// to version 4, delete the following code. -static const int kHttpServerPropertiesVersions[] = {3, 4, 5}; - -class HttpServerPropertiesManagerTest : public testing::TestWithParam<int>, +class HttpServerPropertiesManagerTest : public testing::Test, public WithScopedTaskEnvironment { protected: HttpServerPropertiesManagerTest() : WithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::MainThreadType::MOCK_TIME) {} + base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { one_day_from_now_ = base::Time::Now() + base::TimeDelta::FromDays(1); - advertised_versions_ = HttpNetworkSession::Params().quic_supported_versions; + advertised_versions_ = + HttpNetworkSession::Params().quic_params.supported_versions; pref_delegate_ = new MockPrefDelegate; http_server_props_manager_ = std::make_unique<HttpServerPropertiesManager>( @@ -141,6 +138,13 @@ class HttpServerPropertiesManagerTest : public testing::TestWithParam<int>, return !alternative_service_info_vector.empty(); } + // Returns a dictionary with only the version field populated. + static base::DictionaryValue DictWithVersion() { + base::DictionaryValue http_server_properties_dict; + http_server_properties_dict.SetInteger("version", 5); + return http_server_properties_dict; + } + MockPrefDelegate* pref_delegate_; // Owned by HttpServerPropertiesManager. std::unique_ptr<HttpServerPropertiesManager> http_server_props_manager_; base::Time one_day_from_now_; @@ -150,11 +154,7 @@ class HttpServerPropertiesManagerTest : public testing::TestWithParam<int>, DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManagerTest); }; -INSTANTIATE_TEST_SUITE_P(/* no prefix */, - HttpServerPropertiesManagerTest, - ::testing::ValuesIn(kHttpServerPropertiesVersions)); - -TEST_P(HttpServerPropertiesManagerTest, +TEST_F(HttpServerPropertiesManagerTest, SingleUpdateForTwoSpdyServerPrefChanges) { // Set up the prefs for https://www.google.com and https://mail.google.com and // then set it twice. Only expect a single cache update. @@ -186,15 +186,11 @@ TEST_P(HttpServerPropertiesManagerTest, // Set the server preference for https://www.google.com. auto servers_dict = std::make_unique<base::DictionaryValue>(); - servers_dict->SetWithoutPathExpansion( - GetParam() >= 5 ? "https://www.google.com" : "www.google.com:443", - std::move(server_pref_dict)); - std::unique_ptr<base::ListValue> servers_list; - if (GetParam() >= 4) { - servers_list = std::make_unique<base::ListValue>(); - servers_list->Append(std::move(servers_dict)); - servers_dict = std::make_unique<base::DictionaryValue>(); - } + servers_dict->SetWithoutPathExpansion("https://www.google.com", + std::move(server_pref_dict)); + auto servers_list = std::make_unique<base::ListValue>(); + servers_list->Append(std::move(servers_dict)); + servers_dict = std::make_unique<base::DictionaryValue>(); // Set the preference for mail.google.com server. auto server_pref_dict1 = std::make_unique<base::DictionaryValue>(); @@ -218,26 +214,12 @@ TEST_P(HttpServerPropertiesManagerTest, server_pref_dict1->SetWithoutPathExpansion("network_stats", std::move(stats1)); // Set the server preference for https://mail.google.com. - servers_dict->SetWithoutPathExpansion( - GetParam() >= 5 ? "https://mail.google.com" : "mail.google.com:443", - std::move(server_pref_dict1)); - base::DictionaryValue http_server_properties_dict; - if (GetParam() >= 4) { - servers_list->AppendIfNotPresent(std::move(servers_dict)); - if (GetParam() == 5) { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, -1); - } else { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, - GetParam()); - } - http_server_properties_dict.SetWithoutPathExpansion( - "servers", std::move(servers_list)); - } else { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, - GetParam()); - http_server_properties_dict.SetWithoutPathExpansion( - "servers", std::move(servers_dict)); - } + servers_dict->SetWithoutPathExpansion("https://mail.google.com", + std::move(server_pref_dict1)); + servers_list->Append(std::move(servers_dict)); + base::DictionaryValue http_server_properties_dict = DictWithVersion(); + http_server_properties_dict.SetWithoutPathExpansion("servers", + std::move(servers_list)); auto supports_quic = std::make_unique<base::DictionaryValue>(); supports_quic->SetBoolean("used_quic", true); supports_quic->SetString("address", "127.0.0.1"); @@ -343,7 +325,7 @@ TEST_P(HttpServerPropertiesManagerTest, play_quic_server_id)); } -TEST_P(HttpServerPropertiesManagerTest, BadCachedHostPortPair) { +TEST_F(HttpServerPropertiesManagerTest, BadCachedHostPortPair) { auto server_pref_dict = std::make_unique<base::DictionaryValue>(); // Set supports_spdy for www.google.com:65536. @@ -367,24 +349,11 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedHostPortPair) { auto servers_dict = std::make_unique<base::DictionaryValue>(); servers_dict->SetWithoutPathExpansion("www.google.com:65536", std::move(server_pref_dict)); - base::DictionaryValue http_server_properties_dict; - if (GetParam() >= 4) { auto servers_list = std::make_unique<base::ListValue>(); servers_list->Append(std::move(servers_dict)); - if (GetParam() == 5) { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, -1); - } else { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, - GetParam()); - } + base::DictionaryValue http_server_properties_dict = DictWithVersion(); http_server_properties_dict.SetWithoutPathExpansion( "servers", std::move(servers_list)); - } else { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, - GetParam()); - http_server_properties_dict.SetWithoutPathExpansion( - "servers", std::move(servers_dict)); - } // Set quic_server_info for www.google.com:65536. auto quic_servers_dict = std::make_unique<base::DictionaryValue>(); @@ -421,7 +390,7 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedHostPortPair) { EXPECT_EQ(0u, http_server_props_manager_->quic_server_info_map().size()); } -TEST_P(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) { +TEST_F(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) { auto server_pref_dict = std::make_unique<base::DictionaryValue>(); // Set supports_spdy for www.google.com:80. @@ -440,24 +409,11 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) { auto servers_dict = std::make_unique<base::DictionaryValue>(); servers_dict->SetWithoutPathExpansion("www.google.com:80", std::move(server_pref_dict)); - base::DictionaryValue http_server_properties_dict; - if (GetParam() >= 4) { auto servers_list = std::make_unique<base::ListValue>(); servers_list->Append(std::move(servers_dict)); - if (GetParam() == 5) { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, -1); - } else { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, - GetParam()); - } + base::DictionaryValue http_server_properties_dict = DictWithVersion(); http_server_properties_dict.SetWithoutPathExpansion( "servers", std::move(servers_list)); - } else { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, - GetParam()); - http_server_properties_dict.SetWithoutPathExpansion( - "servers", std::move(servers_dict)); - } // Set up the pref. pref_delegate_->SetPrefs(http_server_properties_dict); @@ -473,7 +429,7 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) { HasAlternativeService(url::SchemeHostPort("http", "www.google.com", 80))); } -TEST_P(HttpServerPropertiesManagerTest, SupportsSpdy) { +TEST_F(HttpServerPropertiesManagerTest, SupportsSpdy) { // Add mail.google.com:443 as a supporting spdy server. url::SchemeHostPort spdy_server("https", "mail.google.com", 443); EXPECT_FALSE( @@ -502,7 +458,7 @@ TEST_P(HttpServerPropertiesManagerTest, SupportsSpdy) { // scheduled if multiple updates happen in a given time period. Subsequent pref // update could also be scheduled once the previous scheduled update is // completed. -TEST_P(HttpServerPropertiesManagerTest, +TEST_F(HttpServerPropertiesManagerTest, SinglePrefUpdateForTwoSpdyServerCacheChanges) { // Post an update task. SetSupportsSpdy calls ScheduleUpdatePrefs with a delay // of 60ms. @@ -545,7 +501,7 @@ TEST_P(HttpServerPropertiesManagerTest, EXPECT_EQ(1, pref_delegate_->GetAndClearNumPrefUpdates()); } -TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServiceInfos) { +TEST_F(HttpServerPropertiesManagerTest, GetAlternativeServiceInfos) { url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80); EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); const AlternativeService alternative_service(kProtoHTTP2, "mail.google.com", @@ -569,7 +525,7 @@ TEST_P(HttpServerPropertiesManagerTest, GetAlternativeServiceInfos) { alternative_service_info_vector[0].alternative_service()); } -TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) { +TEST_F(HttpServerPropertiesManagerTest, SetAlternativeServices) { url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80); EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); AlternativeServiceInfoVector alternative_service_info_vector; @@ -603,7 +559,7 @@ TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServices) { alternative_service_info_vector2[1].alternative_service()); } -TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServicesEmpty) { +TEST_F(HttpServerPropertiesManagerTest, SetAlternativeServicesEmpty) { url::SchemeHostPort spdy_server_mail("http", "mail.google.com", 80); EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); const AlternativeService alternative_service(kProtoHTTP2, "mail.google.com", @@ -617,7 +573,7 @@ TEST_P(HttpServerPropertiesManagerTest, SetAlternativeServicesEmpty) { EXPECT_FALSE(HasAlternativeService(spdy_server_mail)); } -TEST_P(HttpServerPropertiesManagerTest, ConfirmAlternativeService) { +TEST_F(HttpServerPropertiesManagerTest, ConfirmAlternativeService) { url::SchemeHostPort spdy_server_mail; AlternativeService alternative_service; @@ -663,7 +619,7 @@ TEST_P(HttpServerPropertiesManagerTest, ConfirmAlternativeService) { alternative_service)); } -TEST_P(HttpServerPropertiesManagerTest, +TEST_F(HttpServerPropertiesManagerTest, ConfirmBrokenUntilDefaultNetworkChanges) { url::SchemeHostPort spdy_server_mail; AlternativeService alternative_service; @@ -712,7 +668,7 @@ TEST_P(HttpServerPropertiesManagerTest, alternative_service)); } -TEST_P(HttpServerPropertiesManagerTest, +TEST_F(HttpServerPropertiesManagerTest, OnDefaultNetworkChangedWithBrokenUntilDefaultNetworkChanges) { url::SchemeHostPort spdy_server_mail; AlternativeService alternative_service; @@ -761,7 +717,7 @@ TEST_P(HttpServerPropertiesManagerTest, alternative_service)); } -TEST_P(HttpServerPropertiesManagerTest, OnDefaultNetworkChangedWithBrokenOnly) { +TEST_F(HttpServerPropertiesManagerTest, OnDefaultNetworkChangedWithBrokenOnly) { url::SchemeHostPort spdy_server_mail; AlternativeService alternative_service; @@ -807,7 +763,7 @@ TEST_P(HttpServerPropertiesManagerTest, OnDefaultNetworkChangedWithBrokenOnly) { alternative_service)); } -TEST_P(HttpServerPropertiesManagerTest, SupportsQuic) { +TEST_F(HttpServerPropertiesManagerTest, SupportsQuic) { IPAddress address; EXPECT_FALSE(http_server_props_manager_->GetSupportsQuic(&address)); @@ -831,7 +787,7 @@ TEST_P(HttpServerPropertiesManagerTest, SupportsQuic) { EXPECT_EQ(0u, GetPendingMainThreadTaskCount()); } -TEST_P(HttpServerPropertiesManagerTest, ServerNetworkStats) { +TEST_F(HttpServerPropertiesManagerTest, ServerNetworkStats) { url::SchemeHostPort mail_server("http", "mail.google.com", 80); const ServerNetworkStats* stats = http_server_props_manager_->GetServerNetworkStats(mail_server); @@ -869,7 +825,7 @@ TEST_P(HttpServerPropertiesManagerTest, ServerNetworkStats) { http_server_props_manager_->GetServerNetworkStats(mail_server)); } -TEST_P(HttpServerPropertiesManagerTest, QuicServerInfo) { +TEST_F(HttpServerPropertiesManagerTest, QuicServerInfo) { quic::QuicServerId mail_quic_server_id("mail.google.com", 80, false); EXPECT_EQ(nullptr, http_server_props_manager_->GetQuicServerInfo(mail_quic_server_id)); @@ -896,7 +852,7 @@ TEST_P(HttpServerPropertiesManagerTest, QuicServerInfo) { EXPECT_EQ(0u, GetPendingMainThreadTaskCount()); } -TEST_P(HttpServerPropertiesManagerTest, Clear) { +TEST_F(HttpServerPropertiesManagerTest, Clear) { const url::SchemeHostPort spdy_server("https", "mail.google.com", 443); const IPAddress actual_address(127, 0, 0, 1); const quic::QuicServerId mail_quic_server_id("mail.google.com", 80, false); @@ -972,11 +928,10 @@ TEST_P(HttpServerPropertiesManagerTest, Clear) { // https://crbug.com/444956: Add 200 alternative_service servers followed by // supports_quic and verify we have read supports_quic from prefs. -TEST_P(HttpServerPropertiesManagerTest, BadSupportsQuic) { +TEST_F(HttpServerPropertiesManagerTest, BadSupportsQuic) { auto servers_dict = std::make_unique<base::DictionaryValue>(); - std::unique_ptr<base::ListValue> servers_list; - if (GetParam() >= 4) - servers_list = std::make_unique<base::ListValue>(); + std::unique_ptr<base::ListValue> servers_list = + std::make_unique<base::ListValue>(); for (int i = 1; i <= 200; ++i) { // Set up alternative_service for www.google.com:i. @@ -988,46 +943,21 @@ TEST_P(HttpServerPropertiesManagerTest, BadSupportsQuic) { auto server_pref_dict = std::make_unique<base::DictionaryValue>(); server_pref_dict->SetWithoutPathExpansion( "alternative_service", std::move(alternative_service_list)); - if (GetParam() >= 5) { servers_dict->SetWithoutPathExpansion( StringPrintf("https://www.google.com:%d", i), std::move(server_pref_dict)); - } else { - servers_dict->SetWithoutPathExpansion( - StringPrintf("www.google.com:%d", i), std::move(server_pref_dict)); - } - if (GetParam() >= 4) { servers_list->AppendIfNotPresent(std::move(servers_dict)); servers_dict = std::make_unique<base::DictionaryValue>(); - } } // Set the server preference for http://mail.google.com server. auto server_pref_dict1 = std::make_unique<base::DictionaryValue>(); - if (GetParam() >= 5) { servers_dict->SetWithoutPathExpansion("https://mail.google.com", std::move(server_pref_dict1)); - } else { - servers_dict->SetWithoutPathExpansion("mail.google.com:80", - std::move(server_pref_dict1)); - } - base::DictionaryValue http_server_properties_dict; - if (GetParam() >= 4) { servers_list->AppendIfNotPresent(std::move(servers_dict)); - if (GetParam() == 5) { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, -1); - } else { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, - GetParam()); - } + base::DictionaryValue http_server_properties_dict = DictWithVersion(); http_server_properties_dict.SetWithoutPathExpansion( "servers", std::move(servers_list)); - } else { - HttpServerPropertiesManager::SetVersion(&http_server_properties_dict, - GetParam()); - http_server_properties_dict.SetWithoutPathExpansion( - "servers", std::move(servers_dict)); - } // Set up SupportsQuic for 127.0.0.1 auto supports_quic = std::make_unique<base::DictionaryValue>(); @@ -1043,11 +973,7 @@ TEST_P(HttpServerPropertiesManagerTest, BadSupportsQuic) { // Verify alternative service. for (int i = 1; i <= 200; ++i) { GURL server_gurl; - if (GetParam() >= 5) { - server_gurl = GURL(StringPrintf("https://www.google.com:%d", i)); - } else { server_gurl = GURL(StringPrintf("https://www.google.com:%d", i)); - } url::SchemeHostPort server(server_gurl); AlternativeServiceInfoVector alternative_service_info_vector = http_server_props_manager_->GetAlternativeServiceInfos(server); @@ -1064,7 +990,7 @@ TEST_P(HttpServerPropertiesManagerTest, BadSupportsQuic) { EXPECT_EQ("127.0.0.1", address.ToString()); } -TEST_P(HttpServerPropertiesManagerTest, UpdatePrefsWithCache) { +TEST_F(HttpServerPropertiesManagerTest, UpdatePrefsWithCache) { const url::SchemeHostPort server_www("https", "www.google.com", 80); const url::SchemeHostPort server_mail("https", "mail.google.com", 80); @@ -1210,7 +1136,7 @@ TEST_P(HttpServerPropertiesManagerTest, UpdatePrefsWithCache) { EXPECT_EQ(expected_json, preferences_json); } -TEST_P(HttpServerPropertiesManagerTest, +TEST_F(HttpServerPropertiesManagerTest, SingleCacheUpdateForMultipleUpdatesScheduled) { EXPECT_EQ(0u, GetPendingMainThreadTaskCount()); // Update cache. @@ -1241,7 +1167,7 @@ TEST_P(HttpServerPropertiesManagerTest, EXPECT_EQ(0, pref_delegate_->GetAndClearNumPrefUpdates()); } -TEST_P(HttpServerPropertiesManagerTest, AddToAlternativeServiceMap) { +TEST_F(HttpServerPropertiesManagerTest, AddToAlternativeServiceMap) { std::unique_ptr<base::Value> server_value = base::JSONReader::ReadDeprecated( "{\"alternative_service\":[{\"port\":443,\"protocol_str\":\"h2\"}," "{\"port\":123,\"protocol_str\":\"quic\"," @@ -1293,7 +1219,7 @@ TEST_P(HttpServerPropertiesManagerTest, AddToAlternativeServiceMap) { } // Regression test for https://crbug.com/615497. -TEST_P(HttpServerPropertiesManagerTest, DoNotLoadAltSvcForInsecureOrigins) { +TEST_F(HttpServerPropertiesManagerTest, DoNotLoadAltSvcForInsecureOrigins) { std::unique_ptr<base::Value> server_value = base::JSONReader::ReadDeprecated( "{\"alternative_service\":[{\"port\":443,\"protocol_str\":\"h2\"," "\"expiration\":\"9223372036854775807\"}]}"); @@ -1311,7 +1237,7 @@ TEST_P(HttpServerPropertiesManagerTest, DoNotLoadAltSvcForInsecureOrigins) { } // Do not persist expired alternative service entries to disk. -TEST_P(HttpServerPropertiesManagerTest, DoNotPersistExpiredAlternativeService) { +TEST_F(HttpServerPropertiesManagerTest, DoNotPersistExpiredAlternativeService) { AlternativeServiceInfoVector alternative_service_info_vector; const AlternativeService broken_alternative_service( @@ -1386,7 +1312,7 @@ TEST_P(HttpServerPropertiesManagerTest, DoNotPersistExpiredAlternativeService) { } // Test that expired alternative service entries on disk are ignored. -TEST_P(HttpServerPropertiesManagerTest, DoNotLoadExpiredAlternativeService) { +TEST_F(HttpServerPropertiesManagerTest, DoNotLoadExpiredAlternativeService) { auto alternative_service_list = std::make_unique<base::ListValue>(); auto expired_dict = std::make_unique<base::DictionaryValue>(); expired_dict->SetString("protocol_str", "h2"); @@ -1429,7 +1355,7 @@ TEST_P(HttpServerPropertiesManagerTest, DoNotLoadExpiredAlternativeService) { } // Make sure prefs are updated on destruction. -TEST_P(HttpServerPropertiesManagerTest, UpdatePrefsOnShutdown) { +TEST_F(HttpServerPropertiesManagerTest, UpdatePrefsOnShutdown) { int pref_updates = 0; pref_delegate_->set_extra_update_prefs_callback( base::Bind([](int* updates) { (*updates)++; }, &pref_updates)); @@ -1437,7 +1363,7 @@ TEST_P(HttpServerPropertiesManagerTest, UpdatePrefsOnShutdown) { EXPECT_EQ(1, pref_updates); } -TEST_P(HttpServerPropertiesManagerTest, PersistAdvertisedVersionsToPref) { +TEST_F(HttpServerPropertiesManagerTest, PersistAdvertisedVersionsToPref) { const url::SchemeHostPort server_www("https", "www.google.com", 80); const url::SchemeHostPort server_mail("https", "mail.google.com", 80); @@ -1449,7 +1375,7 @@ TEST_P(HttpServerPropertiesManagerTest, PersistAdvertisedVersionsToPref) { ASSERT_TRUE(base::Time::FromUTCString("2036-12-01 10:00:00", &expiration1)); quic::ParsedQuicVersionVector advertised_versions = { quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, - quic::QUIC_VERSION_44), + quic::QUIC_VERSION_46), quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, quic::QUIC_VERSION_39)}; alternative_service_info_vector.push_back( @@ -1499,7 +1425,7 @@ TEST_P(HttpServerPropertiesManagerTest, PersistAdvertisedVersionsToPref) { "{\"quic_servers\":{\"https://mail.google.com:80\":{" "\"server_info\":\"quic_server_info1\"}},\"servers\":[" "{\"https://www.google.com:80\":{\"alternative_service\":[{" - "\"advertised_versions\":[39,44],\"expiration\":\"13756212000000000\"," + "\"advertised_versions\":[39,46],\"expiration\":\"13756212000000000\"," "\"port\":443,\"protocol_str\":\"quic\"},{\"advertised_versions\":[]," "\"expiration\":\"13758804000000000\",\"host\":\"www.google.com\"," "\"port\":1234,\"protocol_str\":\"h2\"}]}}," @@ -1517,13 +1443,13 @@ TEST_P(HttpServerPropertiesManagerTest, PersistAdvertisedVersionsToPref) { EXPECT_EQ(expected_json, preferences_json); } -TEST_P(HttpServerPropertiesManagerTest, ReadAdvertisedVersionsFromPref) { +TEST_F(HttpServerPropertiesManagerTest, ReadAdvertisedVersionsFromPref) { std::unique_ptr<base::Value> server_value = base::JSONReader::ReadDeprecated( "{\"alternative_service\":[" "{\"port\":443,\"protocol_str\":\"quic\"}," "{\"port\":123,\"protocol_str\":\"quic\"," "\"expiration\":\"9223372036854775807\"," - "\"advertised_versions\":[44,39]}]}"); + "\"advertised_versions\":[46,39]}]}"); ASSERT_TRUE(server_value); base::DictionaryValue* server_dict; ASSERT_TRUE(server_value->GetAsDictionary(&server_dict)); @@ -1564,18 +1490,18 @@ TEST_P(HttpServerPropertiesManagerTest, ReadAdvertisedVersionsFromPref) { quic::QUIC_VERSION_39), loaded_advertised_versions[0]); EXPECT_EQ(quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, - quic::QUIC_VERSION_44), + quic::QUIC_VERSION_46), loaded_advertised_versions[1]); } -TEST_P(HttpServerPropertiesManagerTest, +TEST_F(HttpServerPropertiesManagerTest, UpdatePrefWhenAdvertisedVersionsChange) { const url::SchemeHostPort server_www("https", "www.google.com", 80); // #1: Set alternate protocol. AlternativeServiceInfoVector alternative_service_info_vector; // Quic alternative service set with a single QUIC version: - // quic::QUIC_VERSION_44. + // quic::QUIC_VERSION_46. AlternativeService quic_alternative_service1(kProtoQUIC, "", 443); base::Time expiration1; ASSERT_TRUE(base::Time::FromUTCString("2036-12-01 10:00:00", &expiration1)); @@ -1624,7 +1550,7 @@ TEST_P(HttpServerPropertiesManagerTest, // Quic alternative service set with two advertised QUIC versions. quic::ParsedQuicVersionVector advertised_versions = { quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, - quic::QUIC_VERSION_44), + quic::QUIC_VERSION_46), quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, quic::QUIC_VERSION_39)}; alternative_service_info_vector_2.push_back( @@ -1644,7 +1570,7 @@ TEST_P(HttpServerPropertiesManagerTest, "{\"quic_servers\":{\"https://mail.google.com:80\":" "{\"server_info\":\"quic_server_info1\"}},\"servers\":[" "{\"https://www.google.com:80\":" - "{\"alternative_service\":[{\"advertised_versions\":[39,44]," + "{\"alternative_service\":[{\"advertised_versions\":[39,46]," "\"expiration\":\"13756212000000000\",\"port\":443," "\"protocol_str\":\"quic\"}]}}],\"supports_quic\":" "{\"address\":\"127.0.0.1\",\"used_quic\":true},\"version\":5}"; @@ -1659,7 +1585,7 @@ TEST_P(HttpServerPropertiesManagerTest, quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, quic::QUIC_VERSION_39), quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, - quic::QUIC_VERSION_44)}; + quic::QUIC_VERSION_46)}; alternative_service_info_vector_3.push_back( AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( quic_alternative_service1, expiration1, advertised_versions_2)); @@ -1671,7 +1597,7 @@ TEST_P(HttpServerPropertiesManagerTest, EXPECT_EQ(0, pref_delegate_->GetAndClearNumPrefUpdates()); } -TEST_P(HttpServerPropertiesManagerTest, UpdateCacheWithPrefs) { +TEST_F(HttpServerPropertiesManagerTest, UpdateCacheWithPrefs) { AlternativeService cached_broken_service(kProtoQUIC, "cached_broken", 443); AlternativeService cached_broken_service2(kProtoQUIC, "cached_broken2", 443); AlternativeService cached_recently_broken_service(kProtoQUIC, |