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

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

Issue 2645713003: [Prerender] Cleanup prerender_util (Closed)
Patch Set: Review comments Created 3 years, 11 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/prerender/prerender_util_unittest.cc
diff --git a/chrome/browser/prerender/prerender_util_unittest.cc b/chrome/browser/prerender/prerender_util_unittest.cc
index 3e316cbb7def50d1b0f52be5f7b7d7db2a17d16a..3cba3ee73249fef09fe266a5cd9cf580acdb7eba 100644
--- a/chrome/browser/prerender/prerender_util_unittest.cc
+++ b/chrome/browser/prerender/prerender_util_unittest.cc
@@ -9,54 +9,23 @@
namespace prerender {
-// Ensure that extracting a urlencoded URL in the url= query string component
-// works.
-TEST(PrerenderUtilTest, ExtractURLInQueryStringTest) {
- GURL result;
- EXPECT_TRUE(MaybeGetQueryStringBasedAliasURL(
- GURL(
- "http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBcQFjAA&url=h"
- "ttp%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=AFQjCNF8nJ2MpBFfr"
- "1ijO39_f22bcKyccw&sig2=2ymyGpO0unJwU1d4kdCUjQ"),
- &result));
- ASSERT_EQ(GURL(
- "http://www.abercrombie.com/webapp/wcs/stores/servlet/StoreLo"
- "cator?catalogId=&storeId=10051&langId=-1").spec(),
- result.spec());
- EXPECT_FALSE(MaybeGetQueryStringBasedAliasURL(
- GURL("http://www.google.com/url?sadf=test&blah=blahblahblah"), &result));
- EXPECT_FALSE(MaybeGetQueryStringBasedAliasURL(
- GURL("http://www.google.com/?url=INVALIDurlsAREsoMUCHfun.com"), &result));
- EXPECT_TRUE(MaybeGetQueryStringBasedAliasURL(
- GURL("http://www.google.com/?url=http://validURLSareGREAT.com"),
- &result));
- ASSERT_EQ(GURL("http://validURLSareGREAT.com").spec(), result.spec());
-}
+// Ensure that we detect GWS origin URLs correctly.
+TEST(PrerenderUtilTest, DetectGWSOriginURLTest) {
+ EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/#asdf")));
+ EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/")));
+ EXPECT_TRUE(IsGoogleOriginURL(GURL("https://www.google.com")));
+ EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/?a=b")));
+ EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/search?q=hi")));
+ EXPECT_TRUE(IsGoogleOriginURL(GURL("http://google.com")));
+ EXPECT_TRUE(IsGoogleOriginURL(GURL("http://WWW.GooGLE.CoM")));
+ EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.co.uk")));
+ // Non-standard ports are allowed for integration tests with the embedded
+ // server.
+ EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com:42/")));
-// Ensure that we detect Google search result URLs correctly.
-TEST(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")));
+ EXPECT_FALSE(IsGoogleOriginURL(GURL("http://news.google.com")));
+ EXPECT_FALSE(IsGoogleOriginURL(GURL("http://www.chromium.org")));
+ EXPECT_FALSE(IsGoogleOriginURL(GURL("what://www.google.com")));
}
} // namespace prerender
« no previous file with comments | « chrome/browser/prerender/prerender_util.cc ('k') | chrome/test/data/prerender/prerender_loader_with_replace_state.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698