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

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

Issue 12250033: Consolidate search terms extraction and Instant process determination. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style nit Created 7 years, 10 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') | chrome/browser/ui/browser_instant_controller.cc » ('j') | 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
diff --git a/chrome/browser/search_engines/template_url_unittest.cc b/chrome/browser/search_engines/template_url_unittest.cc
index 5550b034dbbcf509887c18b196c2ebb3c81dce0b..3273fa5b4cdf170d5f8bb751ec1a43b5adb87405 100644
--- a/chrome/browser/search_engines/template_url_unittest.cc
+++ b/chrome/browser/search_engines/template_url_unittest.cc
@@ -539,37 +539,35 @@ TEST_F(TemplateURLTest, RLZ) {
TEST_F(TemplateURLTest, HostAndSearchTermKey) {
struct TestData {
const std::string url;
- const std::string scheme;
const std::string host;
const std::string path;
const std::string search_term_key;
} test_data[] = {
- { "http://blah/?foo=bar&q={searchTerms}&b=x", "http", "blah", "/", "q"},
+ { "http://blah/?foo=bar&q={searchTerms}&b=x", "blah", "/", "q"},
// No query key should result in empty values.
- { "http://blah/{searchTerms}", "", "", "", ""},
+ { "http://blah/{searchTerms}", "", "", ""},
// No term should result in empty values.
- { "http://blah/", "", "", "", ""},
+ { "http://blah/", "", "", ""},
// Multiple terms should result in empty values.
- { "http://blah/?q={searchTerms}&x={searchTerms}", "", "", "", ""},
+ { "http://blah/?q={searchTerms}&x={searchTerms}", "", "", ""},
// Term in the host shouldn't match.
- { "http://{searchTerms}", "", "", "", ""},
+ { "http://{searchTerms}", "", "", ""},
- { "http://blah/?q={searchTerms}", "http", "blah", "/", "q"},
- { "https://blah/?q={searchTerms}", "https", "blah", "/", "q"},
+ { "http://blah/?q={searchTerms}", "blah", "/", "q"},
+ { "https://blah/?q={searchTerms}", "blah", "/", "q"},
// Single term with extra chars in value should match.
- { "http://blah/?q=stock:{searchTerms}", "http", "blah", "/", "q"},
+ { "http://blah/?q=stock:{searchTerms}", "blah", "/", "q"},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) {
TemplateURLData data;
data.SetURL(test_data[i].url);
TemplateURL url(NULL, data);
- EXPECT_EQ(test_data[i].scheme, url.url_ref().GetScheme());
EXPECT_EQ(test_data[i].host, url.url_ref().GetHost());
EXPECT_EQ(test_data[i].path, url.url_ref().GetPath());
EXPECT_EQ(test_data[i].search_term_key, url.url_ref().GetSearchTermKey());
@@ -927,95 +925,3 @@ TEST_F(TemplateURLTest, HasSearchTermsReplacementKey) {
EXPECT_TRUE(url.HasSearchTermsReplacementKey(
GURL("http://bing.com/#espv")));
}
-
-TEST_F(TemplateURLTest, IsInstantURL) {
- TemplateURLData data;
- data.SetURL("http://google.com/?q={searchTerms}");
- data.instant_url = "http://google.com/instant#q={searchTerms}";
- data.alternate_urls.push_back("http://google.com/alt/#q={searchTerms}");
- data.alternate_urls.push_back(
- "http://google.com/alt/?ext=foo&q={searchTerms}#ref=bar");
- data.search_terms_replacement_key = "espv";
- TemplateURL url(NULL, data);
-
- EXPECT_FALSE(url.IsInstantURL(
- GURL("http://google.com/")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?espv")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/#espv")));
-
- EXPECT_FALSE(url.IsInstantURL(
- GURL("http://google.com/?q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/instant?q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/instant?x=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?q=something&espv")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?q=something&espv=1")));
-
- EXPECT_FALSE(url.IsInstantURL(
- GURL("https://google.com/?q=something&espv=1")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?q=something&espv=0")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?espv&q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?espv=1&q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?espv=0&q=something")));
-
- EXPECT_FALSE(url.IsInstantURL(
- GURL("http://google.com/alt/#q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/alt/#q=something&espv")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/alt/#q=something&espv=1")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/alt/#q=something&espv=0")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/alt/#espv&q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/alt/#espv=1&q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/alt/#espv=0&q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?espv#q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?espv=1#q=something")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?q=something#espv")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/?q=something#espv=1")));
-
- EXPECT_TRUE(url.IsInstantURL(
- GURL("http://google.com/instant#q=something&espv=1")));
-
- EXPECT_FALSE(url.IsInstantURL(
- GURL("http://bing.com/?espv=1")));
-
- EXPECT_FALSE(url.IsInstantURL(
- GURL("http://bing.com/#espv=1")));
-}
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | chrome/browser/ui/browser_instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698