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

Unified Diff: chrome/browser/search/search_unittest.cc

Issue 1911573002: Teach SiteInstance::GetSiteForURL() about blob and filesystem URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add search unittest. 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 | « chrome/browser/search/search.cc ('k') | content/browser/site_instance_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « chrome/browser/search/search.cc ('k') | content/browser/site_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698