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

Unified Diff: components/google/core/browser/google_util_unittest.cc

Issue 2861183002: Google search subdomains included for Safesearch (Closed)
Patch Set: Fixed review comments Created 3 years, 7 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: components/google/core/browser/google_util_unittest.cc
diff --git a/components/google/core/browser/google_util_unittest.cc b/components/google/core/browser/google_util_unittest.cc
index d30d03b56a5f6b8061c6c9afe33753d90dff0c13..ada7bc89c4de5bd069659321fea24207000dcd4e 100644
--- a/components/google/core/browser/google_util_unittest.cc
+++ b/components/google/core/browser/google_util_unittest.cc
@@ -64,6 +64,14 @@ TEST(GoogleUtilTest, GoodHomePagesNonSecure) {
EXPECT_TRUE(IsHomePage("http://www.google.com/ig/foo"));
EXPECT_TRUE(IsHomePage("http://www.google.com/ig?rlz=TEST"));
EXPECT_TRUE(IsHomePage("http://www.google.com/ig/foo?rlz=TEST"));
+
+ // Accepted subdomains.
+ EXPECT_TRUE(IsHomePage("http://ipv4.google.com/"));
+ EXPECT_TRUE(IsHomePage("http://ipv6.google.com/"));
+
+ // Trailing dots.
+ EXPECT_TRUE(IsHomePage("http://ipv4.google.com./"));
+ EXPECT_TRUE(IsHomePage("http://google.com./"));
}
TEST(GoogleUtilTest, GoodHomePagesSecure) {
@@ -121,6 +129,10 @@ TEST(GoogleUtilTest, BadHomePages) {
// Path is case sensitive.
EXPECT_FALSE(IsHomePage("https://www.google.com/WEBHP"));
+
+ // Only .com subdomain and no www.
+ EXPECT_FALSE(IsHomePage("http://ipv4.google.co.uk"));
+ EXPECT_FALSE(IsHomePage("http://www.ipv4.google.com"));
}
TEST(GoogleUtilTest, GoodSearches) {
@@ -136,8 +148,8 @@ TEST(GoogleUtilTest, GoodSearches) {
// It's actually valid for both to have the query parameter.
"%s://www.google.com/search?%s=something#q=other",
- // Queries with path "/webhp", "/" or "" need to have the query parameter in
- // the hash fragment.
+ // Queries with path "/webhp", "/" or "" need to have the query parameter
+ // in the hash fragment.
"%s://www.google.com/webhp#%s=something",
"%s://www.google.com/webhp#name=bob&%s=something",
"%s://www.google.com/webhp?name=bob#%s=something",
@@ -151,7 +163,19 @@ TEST(GoogleUtilTest, GoodSearches) {
"%s://www.google.com#%s=something",
"%s://www.google.com#name=bob&%s=something",
"%s://www.google.com?name=bob#%s=something",
- "%s://www.google.com?name=bob#age=24&%s=something"
+ "%s://www.google.com?name=bob#age=24&%s=something",
+
+ // Google subdomain queries.
+ "%s://ipv4.google.com/search?%s=something",
+ "%s://ipv4.google.com#name=bob&%s=something",
+ "%s://ipv6.google.com?name=bob#%s=something",
+ "%s://ipv6.google.com?name=bob#age=24&%s=something",
+
+ // Trailing dots in the hosts.
+ "%s://www.google.com./#%s=something",
+ "%s://www.google.de./#%s=something",
+ "%s://ipv4.google.com./#%s=something",
+ "%s://ipv6.google.com./#%s=something"
};
for (const std::string& pattern : patterns) {

Powered by Google App Engine
This is Rietveld 408576698