OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/google/core/browser/google_switches.h" | 9 #include "components/google/core/browser/google_switches.h" |
10 #include "components/pref_registry/testing_pref_service_syncable.h" | 10 #include "components/pref_registry/testing_pref_service_syncable.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 } | 28 } |
29 | 29 |
30 std::string GetHostFromTemplateURLData(const TemplateURLData& data) { | 30 std::string GetHostFromTemplateURLData(const TemplateURLData& data) { |
31 return TemplateURL(data).url_ref().GetHost(SearchTermsData()); | 31 return TemplateURL(data).url_ref().GetHost(SearchTermsData()); |
32 } | 32 } |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 class TemplateURLPrepopulateDataTest : public testing::Test { | 36 class TemplateURLPrepopulateDataTest : public testing::Test { |
37 public: | 37 public: |
38 virtual void SetUp() override { | 38 void SetUp() override { |
39 TemplateURLPrepopulateData::RegisterProfilePrefs(prefs_.registry()); | 39 TemplateURLPrepopulateData::RegisterProfilePrefs(prefs_.registry()); |
40 } | 40 } |
41 | 41 |
42 protected: | 42 protected: |
43 user_prefs::TestingPrefServiceSyncable prefs_; | 43 user_prefs::TestingPrefServiceSyncable prefs_; |
44 }; | 44 }; |
45 | 45 |
46 // Verifies the set of prepopulate data doesn't contain entries with duplicate | 46 // Verifies the set of prepopulate data doesn't contain entries with duplicate |
47 // ids. | 47 // ids. |
48 TEST_F(TemplateURLPrepopulateDataTest, UniqueIDs) { | 48 TEST_F(TemplateURLPrepopulateDataTest, UniqueIDs) { |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType("invalid:search:url")); | 340 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType("invalid:search:url")); |
341 | 341 |
342 // URL that doesn't look Google-related, but matches a Google base URL | 342 // URL that doesn't look Google-related, but matches a Google base URL |
343 // specified on the command line. | 343 // specified on the command line. |
344 const std::string foo_url("http://www.foo.com/search?q={searchTerms}"); | 344 const std::string foo_url("http://www.foo.com/search?q={searchTerms}"); |
345 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType(foo_url)); | 345 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType(foo_url)); |
346 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL, | 346 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL, |
347 "http://www.foo.com/"); | 347 "http://www.foo.com/"); |
348 EXPECT_EQ(SEARCH_ENGINE_GOOGLE, GetEngineType(foo_url)); | 348 EXPECT_EQ(SEARCH_ENGINE_GOOGLE, GetEngineType(foo_url)); |
349 } | 349 } |
OLD | NEW |