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

Unified Diff: chrome/browser/search_engines/template_url_unittest.cc

Issue 10382164: Correctly ignore unknown parameters in prepopulated URLs. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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_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: chrome/browser/search_engines/template_url_unittest.cc
===================================================================
--- chrome/browser/search_engines/template_url_unittest.cc (revision 137035)
+++ chrome/browser/search_engines/template_url_unittest.cc (working copy)
@@ -166,19 +166,19 @@
// TemplateURLRef to handle parsing the URL parameters differently.
TEST_F(TemplateURLTest, SetPrepopulatedAndParse) {
TemplateURLData data;
- data.SetURL("http://foo{fhqwhgads}");
+ data.SetURL("http://foo{fhqwhgads}bar");
TemplateURL url(NULL, data);
TemplateURLRef::Replacements replacements;
bool valid = false;
- EXPECT_EQ("http://foo{fhqwhgads}",
- url.url_ref().ParseURL("http://foo{fhqwhgads}", &replacements, &valid));
+ EXPECT_EQ("http://foo{fhqwhgads}bar", url.url_ref().ParseURL(
+ "http://foo{fhqwhgads}bar", &replacements, &valid));
EXPECT_TRUE(replacements.empty());
EXPECT_TRUE(valid);
data.prepopulate_id = 123;
TemplateURL url2(NULL, data);
- EXPECT_EQ("http://foo", url2.url_ref().ParseURL("http://foo{fhqwhgads}",
- &replacements, &valid));
+ EXPECT_EQ("http://foobar", url2.url_ref().ParseURL("http://foo{fhqwhgads}bar",
+ &replacements, &valid));
EXPECT_TRUE(replacements.empty());
EXPECT_TRUE(valid);
}
@@ -505,7 +505,7 @@
}
TEST_F(TemplateURLTest, ParseParameterUnknown) {
- std::string parsed_url("{fhqwhgads}");
+ std::string parsed_url("{fhqwhgads}abc");
TemplateURLData data;
data.SetURL(parsed_url);
TemplateURL url(NULL, data);
@@ -514,16 +514,16 @@
// By default, TemplateURLRef should not consider itself prepopulated.
// Therefore we should not replace the unknown parameter.
EXPECT_FALSE(url.url_ref().ParseParameter(0, 10, &parsed_url, &replacements));
- EXPECT_EQ("{fhqwhgads}", parsed_url);
+ EXPECT_EQ("{fhqwhgads}abc", parsed_url);
EXPECT_TRUE(replacements.empty());
// If the TemplateURLRef is prepopulated, we should remove unknown parameters.
- parsed_url = "{fhqwhgads}";
+ parsed_url = "{fhqwhgads}abc";
data.prepopulate_id = 1;
TemplateURL url2(NULL, data);
EXPECT_FALSE(url2.url_ref().ParseParameter(0, 10, &parsed_url,
&replacements));
- EXPECT_EQ(std::string(), parsed_url);
+ EXPECT_EQ("abc", parsed_url);
EXPECT_TRUE(replacements.empty());
}
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698