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

Unified Diff: chrome/browser/prerender/prerender_util_unittest.cc

Issue 7812011: Tighten conditions for when a URL is a search result, and move (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « chrome/browser/prerender/prerender_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_util_unittest.cc
===================================================================
--- chrome/browser/prerender/prerender_util_unittest.cc (revision 98877)
+++ chrome/browser/prerender/prerender_util_unittest.cc (working copy)
@@ -34,7 +34,6 @@
// Ensure that extracting an experiment in the lpe= query string component
// works.
TEST_F(PrerenderUtilTest, ExtractExperimentInQueryStringTest) {
- GURL result;
EXPECT_EQ(GetQueryStringBasedExperiment(
GURL("http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBcQFjAA&url=http%3A%2F%2Fwww.abercrombie.com%2Fwebapp%2Fwcs%2Fstores%2Fservlet%2FStoreLocator%3FcatalogId%3D%26storeId%3D10051%26langId%3D-1&rct=j&q=allinurl%3A%26&ei=KLyUTYGSEdTWiAKUmLCdCQ&usg=AFQjCNF8nJ2MpBFfr1ijO39_f22bcKyccw&sig2=2ymyGpO0unJwU1d4kdCUjQ&lpe=4&asdf=test")), 4);
EXPECT_EQ(GetQueryStringBasedExperiment(
@@ -49,4 +48,28 @@
GURL("http://www.google.com/test.php?lpe=10")), kNoExperiment);
}
+// Ensure that we detect Google search result URLs correctly.
+TEST_F(PrerenderUtilTest, DetectGoogleSearchREsultURLTest) {
+ EXPECT_TRUE(IsGoogleSearchResultURL(GURL("http://www.google.com/#asdf")));
+ EXPECT_TRUE(IsGoogleSearchResultURL(GURL("http://www.google.com/")));
+ EXPECT_TRUE(IsGoogleSearchResultURL(GURL("http://www.google.com/?a=b")));
+ EXPECT_TRUE(IsGoogleSearchResultURL(
+ GURL("http://www.google.com/search?q=hi")));
+ EXPECT_TRUE(IsGoogleSearchResultURL(GURL("http://www.google.com/search")));
+ EXPECT_TRUE(IsGoogleSearchResultURL(GURL("http://www.google.com/webhp")));
+ EXPECT_TRUE(IsGoogleSearchResultURL(
+ GURL("http://www.google.com/webhp?a=b#123")));
+ EXPECT_FALSE(IsGoogleSearchResultURL(GURL("http://www.google.com/imgres")));
+ EXPECT_FALSE(IsGoogleSearchResultURL(
+ GURL("http://www.google.com/imgres?q=hi")));
+ EXPECT_FALSE(IsGoogleSearchResultURL(
+ GURL("http://www.google.com/imgres?q=hi#123")));
+ EXPECT_FALSE(IsGoogleSearchResultURL(GURL("http://google.com/search")));
+ EXPECT_TRUE(IsGoogleSearchResultURL(GURL("http://WWW.GooGLE.CoM/search")));
+ EXPECT_FALSE(IsGoogleSearchResultURL(GURL("http://WWW.GooGLE.CoM/SeArcH")));
+ EXPECT_TRUE(IsGoogleSearchResultURL(GURL("http://www.google.co.uk/search")));
+ EXPECT_FALSE(IsGoogleSearchResultURL(GURL("http://google.co.uk/search")));
+ EXPECT_FALSE(IsGoogleSearchResultURL(GURL("http://www.chromium.org/search")));
+}
+
} // namespace prerender
« no previous file with comments | « chrome/browser/prerender/prerender_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698