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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/google/google_util.cc ('k') | chrome/browser/google_apis/base_operations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 5 #include "base/command_line.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/google/google_url_tracker.h" 7 #include "chrome/browser/google/google_url_tracker.h"
8 #include "chrome/browser/google/google_util.h" 8 #include "chrome/browser/google/google_util.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/")); 46 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/"));
47 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/webhp")); 47 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/webhp"));
48 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/webhp?rlz=TEST")); 48 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/webhp?rlz=TEST"));
49 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/ig")); 49 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/ig"));
50 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/ig/foo")); 50 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/ig/foo"));
51 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/ig?rlz=TEST")); 51 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/ig?rlz=TEST"));
52 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/ig/foo?rlz=TEST")); 52 EXPECT_TRUE(IsGoogleHomePageUrl("https://www.google.com/ig/foo?rlz=TEST"));
53 } 53 }
54 54
55 TEST(GoogleUtilTest, BadHomePages) { 55 TEST(GoogleUtilTest, BadHomePages) {
56 EXPECT_FALSE(IsGoogleHomePageUrl("")); 56 EXPECT_FALSE(IsGoogleHomePageUrl(std::string()));
57 57
58 // If specified, only the "www" subdomain is OK. 58 // If specified, only the "www" subdomain is OK.
59 EXPECT_FALSE(IsGoogleHomePageUrl("http://maps.google.com")); 59 EXPECT_FALSE(IsGoogleHomePageUrl("http://maps.google.com"));
60 EXPECT_FALSE(IsGoogleHomePageUrl("http://foo.google.com")); 60 EXPECT_FALSE(IsGoogleHomePageUrl("http://foo.google.com"));
61 61
62 // No non-standard port numbers. 62 // No non-standard port numbers.
63 EXPECT_FALSE(IsGoogleHomePageUrl("http://www.google.com:1234")); 63 EXPECT_FALSE(IsGoogleHomePageUrl("http://www.google.com:1234"));
64 EXPECT_FALSE(IsGoogleHomePageUrl("https://www.google.com:5678")); 64 EXPECT_FALSE(IsGoogleHomePageUrl("https://www.google.com:5678"));
65 65
66 // Invalid TLDs. 66 // Invalid TLDs.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 // Some paths are outright invalid as searches. 231 // Some paths are outright invalid as searches.
232 EXPECT_FALSE(IsGoogleSearchUrl( 232 EXPECT_FALSE(IsGoogleSearchUrl(
233 "http://www.google.com/notreal?q=something")); 233 "http://www.google.com/notreal?q=something"));
234 EXPECT_FALSE(IsGoogleSearchUrl( 234 EXPECT_FALSE(IsGoogleSearchUrl(
235 "http://www.google.com/chrome?q=something")); 235 "http://www.google.com/chrome?q=something"));
236 EXPECT_FALSE(IsGoogleSearchUrl( 236 EXPECT_FALSE(IsGoogleSearchUrl(
237 "http://www.google.com/search/nogood?q=something")); 237 "http://www.google.com/search/nogood?q=something"));
238 EXPECT_FALSE(IsGoogleSearchUrl( 238 EXPECT_FALSE(IsGoogleSearchUrl(
239 "http://www.google.com/webhp/nogood#q=something")); 239 "http://www.google.com/webhp/nogood#q=something"));
240 EXPECT_FALSE(IsGoogleSearchUrl("")); 240 EXPECT_FALSE(IsGoogleSearchUrl(std::string()));
241 241
242 // Case sensitive paths. 242 // Case sensitive paths.
243 EXPECT_FALSE(IsGoogleSearchUrl( 243 EXPECT_FALSE(IsGoogleSearchUrl(
244 "http://www.google.com/SEARCH?q=something")); 244 "http://www.google.com/SEARCH?q=something"));
245 EXPECT_FALSE(IsGoogleSearchUrl( 245 EXPECT_FALSE(IsGoogleSearchUrl(
246 "http://www.google.com/WEBHP#q=something")); 246 "http://www.google.com/WEBHP#q=something"));
247 } 247 }
248 248
249 TEST(GoogleUtilTest, GoogleDomains) { 249 TEST(GoogleUtilTest, GoogleDomains) {
250 // Test some good Google domains (valid TLDs). 250 // Test some good Google domains (valid TLDs).
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 EXPECT_TRUE(IsGoogleDomainUrl("http://test.foo.com:1234", 339 EXPECT_TRUE(IsGoogleDomainUrl("http://test.foo.com:1234",
340 google_util::DISALLOW_SUBDOMAIN, 340 google_util::DISALLOW_SUBDOMAIN,
341 google_util::DISALLOW_NON_STANDARD_PORTS)); 341 google_util::DISALLOW_NON_STANDARD_PORTS));
342 EXPECT_FALSE(IsGoogleDomainUrl("file://test.foo.com:1234", 342 EXPECT_FALSE(IsGoogleDomainUrl("file://test.foo.com:1234",
343 google_util::DISALLOW_SUBDOMAIN, 343 google_util::DISALLOW_SUBDOMAIN,
344 google_util::DISALLOW_NON_STANDARD_PORTS)); 344 google_util::DISALLOW_NON_STANDARD_PORTS));
345 EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.com", 345 EXPECT_TRUE(IsGoogleDomainUrl("http://www.google.com",
346 google_util::DISALLOW_SUBDOMAIN, 346 google_util::DISALLOW_SUBDOMAIN,
347 google_util::DISALLOW_NON_STANDARD_PORTS)); 347 google_util::DISALLOW_NON_STANDARD_PORTS));
348 } 348 }
OLDNEW
« no previous file with comments | « chrome/browser/google/google_util.cc ('k') | chrome/browser/google_apis/base_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698