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

Unified Diff: net/http/http_server_properties_manager_unittest.cc

Issue 1860343002: SHP 1: Change SupportsSpdy dict to use SchemeHostPort as the key. No change to Pref data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git sync Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_server_properties_manager.cc ('k') | net/http/http_stream_factory_impl_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16df3f3cb6bce081c3bcd6011509944816041926..ca55dc4ddf8517301295ac7d66a674332690e8fa 100644
--- a/net/http/http_server_properties_manager_unittest.cc
+++ b/net/http/http_server_properties_manager_unittest.cc
@@ -18,7 +18,6 @@
#include "net/base/ip_address.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "url/gurl.h"
namespace net {
@@ -234,6 +233,10 @@ TEST_P(HttpServerPropertiesManagerTest,
base::DictionaryValue* server_pref_dict = new base::DictionaryValue;
HostPortPair google_server("www.google.com", 80);
+ // TODO(zhongyi): change scheme to http once Pref data is also migrated
+ // SchemeHostPort.
+ url::SchemeHostPort google_scheme_host_port("https", "www.google.com", 80);
+ url::SchemeHostPort mail_scheme_host_port("https", "mail.google.com", 80);
HostPortPair mail_server("mail.google.com", 80);
// Set supports_spdy for www.google.com:80.
@@ -348,11 +351,16 @@ TEST_P(HttpServerPropertiesManagerTest,
Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
// Verify SupportsSpdy.
- EXPECT_TRUE(
- http_server_props_manager_->SupportsRequestPriority(google_server));
- EXPECT_TRUE(http_server_props_manager_->SupportsRequestPriority(mail_server));
+ EXPECT_TRUE(http_server_props_manager_->SupportsRequestPriority(
+ google_scheme_host_port));
+ EXPECT_TRUE(http_server_props_manager_->SupportsRequestPriority(
+ mail_scheme_host_port));
+ HostPortPair foo_server = HostPortPair::FromString("foo.google.com:1337");
+ url::SchemeHostPort foo_scheme_host_port("http", foo_server.host(),
+ foo_server.port());
+
EXPECT_FALSE(http_server_props_manager_->SupportsRequestPriority(
- HostPortPair::FromString("foo.google.com:1337")));
+ foo_scheme_host_port));
// Verify alternative service.
if (GetParam() == 4) {
@@ -489,8 +497,12 @@ TEST_P(HttpServerPropertiesManagerTest, BadCachedHostPortPair) {
Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
// Verify that nothing is set.
+ HostPortPair google_server = HostPortPair::FromString("www.google.com:65536");
+ url::SchemeHostPort google_scheme_host_port("http", google_server.host(),
+ google_server.port());
+
EXPECT_FALSE(http_server_props_manager_->SupportsRequestPriority(
- HostPortPair::FromString("www.google.com:65536")));
+ google_scheme_host_port));
EXPECT_FALSE(
HasAlternativeService(HostPortPair::FromString("www.google.com:65536")));
const ServerNetworkStats* stats1 =
@@ -558,17 +570,17 @@ TEST_P(HttpServerPropertiesManagerTest, SupportsSpdy) {
// Add mail.google.com:443 as a supporting spdy server.
HostPortPair spdy_server_mail("mail.google.com", 443);
+ url::SchemeHostPort spdy_server("https", "mail.google.com", 443);
EXPECT_FALSE(
- http_server_props_manager_->SupportsRequestPriority(spdy_server_mail));
- http_server_props_manager_->SetSupportsSpdy(spdy_server_mail, true);
+ http_server_props_manager_->SupportsRequestPriority(spdy_server));
+ http_server_props_manager_->SetSupportsSpdy(spdy_server, true);
// ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once.
- http_server_props_manager_->SetSupportsSpdy(spdy_server_mail, true);
+ http_server_props_manager_->SetSupportsSpdy(spdy_server, true);
// Run the task.
base::RunLoop().RunUntilIdle();
- EXPECT_TRUE(
- http_server_props_manager_->SupportsRequestPriority(spdy_server_mail));
+ EXPECT_TRUE(http_server_props_manager_->SupportsRequestPriority(spdy_server));
Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
}
@@ -884,7 +896,8 @@ TEST_P(HttpServerPropertiesManagerTest, Clear) {
ExpectScheduleUpdatePrefsOnNetworkThreadRepeatedly();
HostPortPair spdy_server_mail("mail.google.com", 443);
- http_server_props_manager_->SetSupportsSpdy(spdy_server_mail, true);
+ url::SchemeHostPort spdy_server("https", "mail.google.com", 443);
+ http_server_props_manager_->SetSupportsSpdy(spdy_server, true);
AlternativeService alternative_service(NPN_HTTP_2, "mail.google.com", 1234);
http_server_props_manager_->SetAlternativeService(
spdy_server_mail, alternative_service, one_day_from_now_);
@@ -908,8 +921,7 @@ TEST_P(HttpServerPropertiesManagerTest, Clear) {
// Run the task.
base::RunLoop().RunUntilIdle();
- EXPECT_TRUE(
- http_server_props_manager_->SupportsRequestPriority(spdy_server_mail));
+ EXPECT_TRUE(http_server_props_manager_->SupportsRequestPriority(spdy_server));
EXPECT_TRUE(HasAlternativeService(spdy_server_mail));
IPAddress address;
EXPECT_TRUE(http_server_props_manager_->GetSupportsQuic(&address));
@@ -939,7 +951,7 @@ TEST_P(HttpServerPropertiesManagerTest, Clear) {
base::RunLoop().Run();
EXPECT_FALSE(
- http_server_props_manager_->SupportsRequestPriority(spdy_server_mail));
+ http_server_props_manager_->SupportsRequestPriority(spdy_server));
EXPECT_FALSE(HasAlternativeService(spdy_server_mail));
EXPECT_FALSE(http_server_props_manager_->GetSupportsQuic(&address));
const ServerNetworkStats* stats2 =
« no previous file with comments | « net/http/http_server_properties_manager.cc ('k') | net/http/http_stream_factory_impl_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698