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

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

Issue 21395002: [InstantExtended] Fixing how PageLoadSRP is emitted. Previously it was emitted only for Instant sea… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: this time actually fixing merge error correctly Created 7 years, 4 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
diff --git a/chrome/browser/search_engines/template_url_unittest.cc b/chrome/browser/search_engines/template_url_unittest.cc
index a4d38a53261bbf9b5073aa453be878711ec935c6..3a3ffa812fe28ed83f6928be3bf4e82788fff073 100644
--- a/chrome/browser/search_engines/template_url_unittest.cc
+++ b/chrome/browser/search_engines/template_url_unittest.cc
@@ -1168,3 +1168,35 @@ TEST_F(TemplateURLTest, ExtraQueryParams) {
EXPECT_EQ("http://www.google.com/search?q=abc#oq=def&x",
url.url_ref().ReplaceSearchTerms(search_terms));
}
+
+// Test the IsSearchResults function.
+TEST_F(TemplateURLTest, IsSearchResults) {
+ TemplateURLData data;
+ data.SetURL("http://bar/search?q={searchTerms}");
+ data.instant_url = "http://bar/instant#q={searchTerms}";
+ data.alternate_urls.push_back("http://bar/?q={searchTerms}");
+ data.alternate_urls.push_back("http://bar/#q={searchTerms}");
+ data.alternate_urls.push_back("http://bar/search#q{searchTerms}");
+ data.alternate_urls.push_back("http://bar/webhp#q={searchTerms}");
+ TemplateURL search_provider(NULL, data);
+
+ const struct {
+ const char* const url;
+ bool result;
+ } url_data[] = {
+ { "http://bar/search?q=foo&oq=foo", true, },
+ { "http://bar/?q=foo&oq=foo", true, },
+ { "http://bar/#output=search&q=foo&oq=foo", true, },
+ { "http://bar/webhp#q=foo&oq=foo", true, },
+ { "http://bar/#q=foo&oq=foo", true, },
+ { "http://bar/?ext=foo&q=foo#ref=bar", true, },
+ { "http://bar/url?url=http://www.foo.com/&q=foo#ref=bar", false, },
+ { "http://bar/", false, },
+ { "http://foo/", false, },
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(url_data); ++i) {
+ EXPECT_EQ(url_data[i].result,
+ search_provider.IsSearchURL(GURL(url_data[i].url)));
+ }
+}
« no previous file with comments | « chrome/browser/search_engines/template_url_service.cc ('k') | chrome/browser/ui/omnibox/omnibox_current_page_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698