| Index: chrome/browser/search/search_unittest.cc
|
| diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc
|
| index 3d96e1e311568b16af2b4b96cfbd593535ed3bed..baa191526ce14a085aae0e4f910096025cc457af 100644
|
| --- a/chrome/browser/search/search_unittest.cc
|
| +++ b/chrome/browser/search/search_unittest.cc
|
| @@ -185,9 +185,11 @@ TEST_F(SearchTest, ShouldUseProcessPerSiteForInstantURL) {
|
| {"https://foo.com/instant?strk=0", false, ""},
|
| {"https://foo.com/url?strk", false, ""},
|
| {"https://foo.com/alt?strk", false, ""},
|
| + {"https://foo.com:80/instant", false, "HTTPS with port"},
|
| {"http://foo.com/instant", false, "Non-HTTPS"},
|
| {"http://foo.com/instant?strk", false, "Non-HTTPS"},
|
| {"http://foo.com/instant?strk=1", false, "Non-HTTPS"},
|
| + {"http://foo.com:443/instant", false, "Non-HTTPS"},
|
| {"https://foo.com/instant", false, "No search terms replacement"},
|
| {"https://foo.com/?strk", false, "Non-exact path"},
|
| };
|
| @@ -594,7 +596,6 @@ TEST_F(SearchTest,
|
| }
|
|
|
|
|
| -
|
| TEST_F(SearchTest, ShouldShowGoogleLocalNTP_Default) {
|
| EXPECT_TRUE(ShouldShowGoogleLocalNTP());
|
| }
|
| @@ -700,6 +701,40 @@ TEST_F(SearchTest, IsQueryExtractionAllowedForURL) {
|
| }
|
| }
|
|
|
| +// Regression test for https://crbug.com/605720: Set up a search provider backed
|
| +// by localhost on a specific port, like browsertests do. The chrome-search://
|
| +// URLs generated in this mode should not have ports.
|
| +TEST_F(SearchTest, SearchProviderWithPort) {
|
| + TemplateURLService* template_url_service =
|
| + TemplateURLServiceFactory::GetForProfile(profile());
|
| + TemplateURLData data;
|
| + data.SetShortName(base::ASCIIToUTF16("localhost"));
|
| + data.SetURL("https://[::1]:1993/url?bar={searchTerms}");
|
| + data.instant_url =
|
| + "https://[::1]:1993/instant?"
|
| + "{google:forceInstantResults}foo=foo#foo=foo&strk";
|
| + data.new_tab_url = "https://[::1]:1993/newtab?strk";
|
| + data.alternate_urls.push_back("https://[::1]:1993/alt#quux={searchTerms}");
|
| + data.search_terms_replacement_key = "strk";
|
| +
|
| + TemplateURL* template_url = new TemplateURL(data);
|
| + template_url_service->Add(template_url); // Takes ownership of |template_url|.
|
| + template_url_service->SetUserSelectedDefaultSearchProvider(template_url);
|
| +
|
| + EXPECT_TRUE(ShouldAssignURLToInstantRenderer(
|
| + GURL("https://[::1]:1993/newtab?lala"), profile()));
|
| + EXPECT_FALSE(ShouldAssignURLToInstantRenderer(
|
| + GURL("https://[::1]:1992/newtab?lala"), profile()));
|
| + EXPECT_EQ(GURL("chrome-search://remote-ntp/newtab?lala"),
|
| + GetEffectiveURLForInstant(GURL("https://[::1]:1993/newtab?lala"),
|
| + profile()));
|
| + EXPECT_EQ(GURL("chrome-search://[::1]/instant?strk"),
|
| + GetEffectiveURLForInstant(GURL("https://[::1]:1993/instant?strk"),
|
| + profile()));
|
| + EXPECT_FALSE(ShouldAssignURLToInstantRenderer(
|
| + GURL("https://[::1]:1993/unregistered-path?strk"), profile()));
|
| +}
|
| +
|
| class SearchURLTest : public SearchTest {
|
| protected:
|
| void SetSearchProvider(bool set_ntp_url, bool insecure_ntp_url) override {
|
|
|