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

Unified Diff: components/search_engines/template_url_unittest.cc

Issue 2524733008: Fix for google:instantExtendedEnabledKey replacement (Closed)
Patch Set: Added unittest Created 4 years, 1 month 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 | « components/search_engines/template_url.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/search_engines/template_url_unittest.cc
diff --git a/components/search_engines/template_url_unittest.cc b/components/search_engines/template_url_unittest.cc
index 43f001e7bf7ab35fe637afad84d46f1f27c4cf34..9fd790c9ae200003a6594a6ba961e2b0e948c4ca 100644
--- a/components/search_engines/template_url_unittest.cc
+++ b/components/search_engines/template_url_unittest.cc
@@ -1895,3 +1895,25 @@ TEST_F(TemplateURLTest, MatchesData) {
TemplateURL url(data);
EXPECT_TRUE(TemplateURL::MatchesData(&url, &data, search_terms_data_));
}
+
+// Test for correct replacement of GoogleInstantExtendedEnabledKey param.
+TEST_F(TemplateURLTest, GoogleInstantExtendedEnabledReplacement) {
+ TemplateURLData data;
+ data.SetURL(
+ "{google:baseURL}search/"
+ "?{google:instantExtendedEnabledKey}&q={searchTerms}");
+ data.SetShortName(ASCIIToUTF16("Google"));
+ data.SetKeyword(ASCIIToUTF16("google.com"));
+ data.search_terms_replacement_key = "{google:instantExtendedEnabledKey}";
+ TemplateURL turl(data);
+ EXPECT_TRUE(TemplateURL::MatchesData(&turl, &data, search_terms_data_));
+ // Expect that replacement of search_terms_replacement_key in TemplateURL
+ // constructor is correct.
+ EXPECT_EQ("espv", turl.search_terms_replacement_key());
+ // Expect that replacement of {google:instantExtendedEnabledKey} in search url
+ // is correct.
+ GURL search_generated = turl.GenerateSearchURL(search_terms_data_);
+ EXPECT_EQ("http://www.google.com/search/?espv&q=blah.blah.blah.blah.blah",
+ search_generated.spec());
+ EXPECT_TRUE(turl.HasSearchTermsReplacementKey(search_generated));
+}
« no previous file with comments | « components/search_engines/template_url.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698