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

Unified Diff: chrome/browser/google/google_util_unittest.cc

Issue 10908226: Introduces a search term extraction mechanism working for arbitrary search providers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed keyword_table_unittest Created 8 years, 3 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/google/google_util_unittest.cc
diff --git a/chrome/browser/google/google_util_unittest.cc b/chrome/browser/google/google_util_unittest.cc
index 174b91cd5e91103d3c9eec648767da721702324f..cf4c6100310831e803e765b2997e5cb10d3b34c6 100644
--- a/chrome/browser/google/google_util_unittest.cc
+++ b/chrome/browser/google/google_util_unittest.cc
@@ -12,7 +12,6 @@
using google_util::IsGoogleDomainUrl;
using google_util::IsGoogleHomePageUrl;
using google_util::IsGoogleSearchUrl;
-using google_util::IsInstantExtendedAPIGoogleSearchUrl;
TEST(GoogleUtilTest, GoodHomePagesNonSecure) {
// Valid home page hosts.
@@ -247,35 +246,6 @@ TEST(GoogleUtilTest, BadSearches) {
"http://www.google.com/WEBHP#q=something"));
}
-TEST(GoogleUtilTest, IsInstantExtendedAPIGoogleSearchUrl) {
- EXPECT_TRUE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/search?q=something&espv=1"));
- EXPECT_TRUE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/search?q=something&espv=3"));
- EXPECT_TRUE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/search?q=something&espv=42"));
-
- EXPECT_FALSE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/search?q=something&espv="));
- EXPECT_FALSE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/search?q=something&espv=0"));
- EXPECT_FALSE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/search?q=something&espv=00"));
-
- EXPECT_FALSE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.foo.com/search?q=something&espv=0"));
- EXPECT_FALSE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.foo.com/search?q=something&espv=1"));
- EXPECT_FALSE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/bing?q=something&espv=1"));
- EXPECT_FALSE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/search?q=something&vespv=1"));
- EXPECT_FALSE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/search?q=something&espvx=1"));
- EXPECT_FALSE(IsInstantExtendedAPIGoogleSearchUrl(
- "http://www.google.com/search#q=something&espv=1"));
-}
-
TEST(GoogleUtilTest, GoogleDomains) {
// Test some good Google domains (valid TLDs).
EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.com",
@@ -376,53 +346,3 @@ TEST(GoogleUtilTest, GoogleDomains) {
google_util::DISALLOW_SUBDOMAIN,
google_util::DISALLOW_NON_STANDARD_PORTS));
}
-
-TEST(GoogleUtilTest, SearchTerms) {
- // Simple searches.
- EXPECT_EQ(string16(), google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/search?q=tractor+supply"));
- EXPECT_EQ(ASCIIToUTF16("tractor supply"),
- google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/search?q=tractor+supply&espv=1"));
- // espv=1 only applies in query.
- EXPECT_EQ(string16(), google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/search?q=potato#espv=1"));
-
- // Instant searches.
- EXPECT_EQ(string16(), google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/webhp#q=tractor+supply"));
- EXPECT_EQ(ASCIIToUTF16("tractor supply"),
- google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/webhp?espv=1#q=tractor+supply"));
- // espv=1 only applies in query.
- EXPECT_EQ(string16(), google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/webhp?#espv=1&q=potato"));
-
- // Both query and ref components have a search term.
- EXPECT_EQ(ASCIIToUTF16("tractor supply"),
- google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/webhp?q=potato&espv=1#q=tractor+supply"));
-
- // Blank queries.
- EXPECT_EQ(string16(), google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/search?q=&q=potato&espv=1"));
- EXPECT_EQ(string16(), google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/webhp?espv=1#q=&q=tractor+supply"));
-
- // Multiple non-empty queries.
- EXPECT_EQ(ASCIIToUTF16("tractor supply"),
- google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/search?q=tractor+supply&q=potato&espv=1"));
- EXPECT_EQ(ASCIIToUTF16("tractor supply"),
- google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/webhp?espv=1#q=tractor+supply&q=potato"));
-
- // Blank terms in ref override non-blank terms in query.
- EXPECT_EQ(string16(), google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/search?q=potato&espv=1#q="));
-
- // Blank terms in query do not override non-blank terms in ref.
- EXPECT_EQ(ASCIIToUTF16("tractor supply"),
- google_util::GetSearchTermsFromGoogleSearchURL(
- "http://google.com/search?q=&espv=1#q=tractor+supply"));
-}

Powered by Google App Engine
This is Rietveld 408576698