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

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

Issue 10108026: Transmit a X-Chrome-UMA-Enabled bit to Google domains from clients that have UMA enabled. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: MAD comment Created 8 years, 8 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 f51460c1f1615dc3d85af83058444c89db3472fe..2c6e746de118c69945066278a4d82e9f7733e6c3 100644
--- a/chrome/browser/google/google_util_unittest.cc
+++ b/chrome/browser/google/google_util_unittest.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/google/google_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+using google_util::IsGoogleDomainUrl;
using google_util::IsGoogleHomePageUrl;
using google_util::IsGoogleSearchUrl;
@@ -241,3 +242,37 @@ TEST(GoogleUtilTest, BadSearches) {
EXPECT_FALSE(IsGoogleSearchUrl(
"http://www.google.com/WEBHP#q=something"));
}
+
+TEST(GoogleUtilTest, GoogleDomains) {
+ // Test some good Google domains (valid TLDs).
+ EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.com",
+ google_util::ALLOW_SUBDOMAIN));
+ EXPECT_TRUE(IsGoogleDomainUrl("http://google.com",
+ google_util::ALLOW_SUBDOMAIN));
+ EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.ca",
+ google_util::ALLOW_SUBDOMAIN));
+ EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.biz.tj",
+ google_util::ALLOW_SUBDOMAIN));
+ EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.com/search?q=something",
+ google_util::ALLOW_SUBDOMAIN));
+ EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.com/webhp",
+ google_util::ALLOW_SUBDOMAIN));
+
+ // Test some bad Google domains (invalid TLDs).
+ EXPECT_FALSE(IsGoogleDomainUrl("http://www.google.notrealtld",
+ google_util::ALLOW_SUBDOMAIN));
+ EXPECT_FALSE(IsGoogleDomainUrl("http://www.google.faketld/search?q=something",
+ google_util::ALLOW_SUBDOMAIN));
+ EXPECT_FALSE(IsGoogleDomainUrl("http://www.yahoo.com",
+ google_util::ALLOW_SUBDOMAIN));
+
+ // Test subdomain checks.
+ EXPECT_TRUE(IsGoogleDomainUrl("http://images.google.com",
+ google_util::ALLOW_SUBDOMAIN));
+ EXPECT_FALSE(IsGoogleDomainUrl("http://images.google.com",
+ google_util::DISALLOW_SUBDOMAIN));
+ EXPECT_TRUE(IsGoogleDomainUrl("http://google.com",
+ google_util::DISALLOW_SUBDOMAIN));
+ EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.com",
+ google_util::DISALLOW_SUBDOMAIN));
battre 2012/04/17 20:33:02 do you want to add tests for scheme and port filte
SteveT 2012/04/17 23:26:44 Done.
+}

Powered by Google App Engine
This is Rietveld 408576698