summaryrefslogtreecommitdiff
path: root/chromium/components/google
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/google')
-rw-r--r--chromium/components/google/core/common/google_switches.cc6
-rw-r--r--chromium/components/google/core/common/google_switches.h1
-rw-r--r--chromium/components/google/core/common/google_util.cc9
-rw-r--r--chromium/components/google/core/common/google_util.h6
4 files changed, 10 insertions, 12 deletions
diff --git a/chromium/components/google/core/common/google_switches.cc b/chromium/components/google/core/common/google_switches.cc
index 4fbc0dc710e..3af14e8dceb 100644
--- a/chromium/components/google/core/common/google_switches.cc
+++ b/chromium/components/google/core/common/google_switches.cc
@@ -9,4 +9,10 @@ namespace switches {
// Specifies an alternate URL to use for speaking to Google. Useful for testing.
const char kGoogleBaseURL[] = "google-base-url";
+// When set, this will ignore the PortPermission passed in the google_util.h
+// methods and ignore the port numbers. This makes it easier to run tests for
+// features that use these methods (directly or indirectly) with the
+// EmbeddedTestServer, which is more representative of production.
+const char kIgnoreGooglePortNumbers[] = "ignore-google-port-numbers";
+
} // namespace switches
diff --git a/chromium/components/google/core/common/google_switches.h b/chromium/components/google/core/common/google_switches.h
index 43e8239aba6..452b4cefa5f 100644
--- a/chromium/components/google/core/common/google_switches.h
+++ b/chromium/components/google/core/common/google_switches.h
@@ -10,6 +10,7 @@ namespace switches {
// All switches in alphabetical order. The switches should be documented
// alongside the definition of their values in the .cc file.
extern const char kGoogleBaseURL[];
+extern const char kIgnoreGooglePortNumbers[];
} // namespace switches
diff --git a/chromium/components/google/core/common/google_util.cc b/chromium/components/google/core/common/google_util.cc
index a8ad7f36f9c..3c7d10d0238 100644
--- a/chromium/components/google/core/common/google_util.cc
+++ b/chromium/components/google/core/common/google_util.cc
@@ -45,8 +45,6 @@ namespace {
bool gUseMockLinkDoctorBaseURLForTesting = false;
-bool g_ignore_port_numbers = false;
-
bool IsPathHomePageBase(base::StringPiece path) {
return (path == "/") || (path == "/webhp");
}
@@ -104,6 +102,9 @@ bool IsValidHostName(base::StringPiece host,
// is DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard
// port for its scheme (80 for HTTP, 443 for HTTPS).
bool IsValidURL(const GURL& url, PortPermission port_permission) {
+ static bool g_ignore_port_numbers =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kIgnoreGooglePortNumbers);
return url.is_valid() && url.SchemeIsHTTPOrHTTPS() &&
(url.port().empty() || g_ignore_port_numbers ||
(port_permission == ALLOW_NON_STANDARD_PORTS));
@@ -364,8 +365,4 @@ const std::vector<std::string>& GetGoogleRegistrableDomains() {
return *kGoogleRegisterableDomains;
}
-void IgnorePortNumbersForGoogleURLChecksForTesting() {
- g_ignore_port_numbers = true;
-}
-
} // namespace google_util
diff --git a/chromium/components/google/core/common/google_util.h b/chromium/components/google/core/common/google_util.h
index cda6b868cba..65b269abdec 100644
--- a/chromium/components/google/core/common/google_util.h
+++ b/chromium/components/google/core/common/google_util.h
@@ -118,12 +118,6 @@ bool IsGoogleAssociatedDomainUrl(const GURL& url);
// unregistering themselves.
const std::vector<std::string>& GetGoogleRegistrableDomains();
-// When called, this will ignore the PortPermission passed in the above methods
-// and ignore the port numbers. This makes it easier to run tests for features
-// that use these methods (directly or indirectly) with the EmbeddedTestServer,
-// which is more representative of production.
-void IgnorePortNumbersForGoogleURLChecksForTesting();
-
} // namespace google_util
#endif // COMPONENTS_GOOGLE_CORE_COMMON_GOOGLE_UTIL_H_