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

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

Issue 10444117: Escape search terms correctly in the path portion of a custom search engine. (Closed) Base URL: svn://svn.chromium.org/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
Index: chrome/browser/search_engines/template_url_unittest.cc
===================================================================
--- chrome/browser/search_engines/template_url_unittest.cc (revision 139570)
+++ chrome/browser/search_engines/template_url_unittest.cc (working copy)
@@ -76,16 +76,15 @@
const char* url;
const string16 terms;
const std::string output;
- bool valid_url;
} search_term_cases[] = {
{ "http://foo{searchTerms}", ASCIIToUTF16("sea rch/bar"),
- "http://foosea%20rch%2Fbar", false },
+ "http://foosea%20rch/bar" },
{ "http://foo{searchTerms}?boo=abc", ASCIIToUTF16("sea rch/bar"),
- "http://foosea%20rch%2Fbar?boo=abc", false },
+ "http://foosea%20rch/bar?boo=abc" },
{ "http://foo/?boo={searchTerms}", ASCIIToUTF16("sea rch/bar"),
- "http://foo/?boo=sea+rch%2Fbar", true },
+ "http://foo/?boo=sea+rch%2Fbar" },
{ "http://en.wikipedia.org/{searchTerms}", ASCIIToUTF16("wiki/?"),
- "http://en.wikipedia.org/wiki%2F%3F", true }
+ "http://en.wikipedia.org/wiki/%3F" }
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(search_term_cases); ++i) {
const SearchTermsCase& value = search_term_cases[i];
@@ -94,11 +93,10 @@
TemplateURL url(NULL, data);
EXPECT_TRUE(url.url_ref().IsValid());
ASSERT_TRUE(url.url_ref().SupportsReplacement());
- std::string result = url.url_ref().ReplaceSearchTerms(value.terms,
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16());
- EXPECT_EQ(value.output, result);
- GURL result_url(result);
- EXPECT_EQ(value.valid_url, result_url.is_valid());
+ GURL result(url.url_ref().ReplaceSearchTerms(value.terms,
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
+ ASSERT_TRUE(result.is_valid());
+ EXPECT_EQ(value.output, result.spec());
}
}
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | content/browser/accessibility/browser_accessibility_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698