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

Side by Side Diff: chrome/browser/google/google_util_unittest.cc

Issue 17022004: Replace --google-base-suggest-url and --instant-url with --google-base-url. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h"
6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/google/google_url_tracker.h" 5 #include "chrome/browser/google/google_url_tracker.h"
8 #include "chrome/browser/google/google_util.h" 6 #include "chrome/browser/google/google_util.h"
9 #include "chrome/common/chrome_switches.h"
10 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
11 8
12 using google_util::IsGoogleDomainUrl; 9 using google_util::IsGoogleDomainUrl;
13 using google_util::IsGoogleHomePageUrl; 10 using google_util::IsGoogleHomePageUrl;
14 using google_util::IsGoogleSearchUrl; 11 using google_util::IsGoogleSearchUrl;
15 12
16 TEST(GoogleUtilTest, GoodHomePagesNonSecure) { 13 TEST(GoogleUtilTest, GoodHomePagesNonSecure) {
17 // Valid home page hosts. 14 // Valid home page hosts.
18 EXPECT_TRUE(IsGoogleHomePageUrl(GoogleURLTracker::kDefaultGoogleHomepage)); 15 EXPECT_TRUE(IsGoogleHomePageUrl(GoogleURLTracker::kDefaultGoogleHomepage));
19 EXPECT_TRUE(IsGoogleHomePageUrl("http://google.com")); 16 EXPECT_TRUE(IsGoogleHomePageUrl("http://google.com"));
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 google_util::ALLOW_NON_STANDARD_PORTS)); 313 google_util::ALLOW_NON_STANDARD_PORTS));
317 EXPECT_TRUE(IsGoogleDomainUrl("https://www.google.com:443", 314 EXPECT_TRUE(IsGoogleDomainUrl("https://www.google.com:443",
318 google_util::DISALLOW_SUBDOMAIN, 315 google_util::DISALLOW_SUBDOMAIN,
319 google_util::ALLOW_NON_STANDARD_PORTS)); 316 google_util::ALLOW_NON_STANDARD_PORTS));
320 EXPECT_FALSE(IsGoogleDomainUrl("file://www.google.com", 317 EXPECT_FALSE(IsGoogleDomainUrl("file://www.google.com",
321 google_util::DISALLOW_SUBDOMAIN, 318 google_util::DISALLOW_SUBDOMAIN,
322 google_util::DISALLOW_NON_STANDARD_PORTS)); 319 google_util::DISALLOW_NON_STANDARD_PORTS));
323 EXPECT_FALSE(IsGoogleDomainUrl("doesnotexist://www.google.com", 320 EXPECT_FALSE(IsGoogleDomainUrl("doesnotexist://www.google.com",
324 google_util::DISALLOW_SUBDOMAIN, 321 google_util::DISALLOW_SUBDOMAIN,
325 google_util::DISALLOW_NON_STANDARD_PORTS)); 322 google_util::DISALLOW_NON_STANDARD_PORTS));
326
327 // Test overriding with --instant-url works.
328 EXPECT_FALSE(IsGoogleDomainUrl("http://test.foo.com",
329 google_util::DISALLOW_SUBDOMAIN,
330 google_util::DISALLOW_NON_STANDARD_PORTS));
331 EXPECT_FALSE(IsGoogleDomainUrl("http://test.foo.com:1234",
332 google_util::DISALLOW_SUBDOMAIN,
333 google_util::DISALLOW_NON_STANDARD_PORTS));
334 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
335 switches::kInstantURL, "http://test.foo.com:1234/bar");
336 EXPECT_FALSE(IsGoogleDomainUrl("http://test.foo.com",
337 google_util::DISALLOW_SUBDOMAIN,
338 google_util::DISALLOW_NON_STANDARD_PORTS));
339 EXPECT_TRUE(IsGoogleDomainUrl("http://test.foo.com:1234",
340 google_util::DISALLOW_SUBDOMAIN,
341 google_util::DISALLOW_NON_STANDARD_PORTS));
342 EXPECT_FALSE(IsGoogleDomainUrl("file://test.foo.com:1234",
343 google_util::DISALLOW_SUBDOMAIN,
344 google_util::DISALLOW_NON_STANDARD_PORTS));
345 EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.com",
346 google_util::DISALLOW_SUBDOMAIN,
347 google_util::DISALLOW_NON_STANDARD_PORTS));
348 } 323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698