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

Side by Side Diff: components/search_engines/template_url_prepopulate_data_unittest.cc

Issue 2562733003: Remove duplicated user_prefs::TestingPrefServiceSyncable (Closed)
Patch Set: Fixed usage from .mm files Created 4 years 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
OLDNEW
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 "components/search_engines/template_url_prepopulate_data.h" 5 #include "components/search_engines/template_url_prepopulate_data.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "components/google/core/browser/google_switches.h" 16 #include "components/google/core/browser/google_switches.h"
17 #include "components/pref_registry/testing_pref_service_syncable.h"
18 #include "components/search_engines/prepopulated_engines.h" 17 #include "components/search_engines/prepopulated_engines.h"
19 #include "components/search_engines/search_engines_pref_names.h" 18 #include "components/search_engines/search_engines_pref_names.h"
20 #include "components/search_engines/search_terms_data.h" 19 #include "components/search_engines/search_terms_data.h"
21 #include "components/search_engines/template_url.h" 20 #include "components/search_engines/template_url.h"
22 #include "components/search_engines/template_url_data_util.h" 21 #include "components/search_engines/template_url_data_util.h"
23 #include "components/search_engines/template_url_service.h" 22 #include "components/search_engines/template_url_service.h"
23 #include "components/sync_preferences/testing_pref_service_syncable.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 25
26 using base::ASCIIToUTF16; 26 using base::ASCIIToUTF16;
27 27
28 namespace { 28 namespace {
29 29
30 SearchEngineType GetEngineType(const std::string& url) { 30 SearchEngineType GetEngineType(const std::string& url) {
31 TemplateURLData data; 31 TemplateURLData data;
32 data.SetURL(url); 32 data.SetURL(url);
33 return TemplateURL(data).GetEngineType(SearchTermsData()); 33 return TemplateURL(data).GetEngineType(SearchTermsData());
34 } 34 }
35 35
36 std::string GetHostFromTemplateURLData(const TemplateURLData& data) { 36 std::string GetHostFromTemplateURLData(const TemplateURLData& data) {
37 return TemplateURL(data).url_ref().GetHost(SearchTermsData()); 37 return TemplateURL(data).url_ref().GetHost(SearchTermsData());
38 } 38 }
39 39
40 } // namespace 40 } // namespace
41 41
42 class TemplateURLPrepopulateDataTest : public testing::Test { 42 class TemplateURLPrepopulateDataTest : public testing::Test {
43 public: 43 public:
44 void SetUp() override { 44 void SetUp() override {
45 TemplateURLPrepopulateData::RegisterProfilePrefs(prefs_.registry()); 45 TemplateURLPrepopulateData::RegisterProfilePrefs(prefs_.registry());
46 } 46 }
47 47
48 protected: 48 protected:
49 user_prefs::TestingPrefServiceSyncable prefs_; 49 sync_preferences::TestingPrefServiceSyncable prefs_;
50 }; 50 };
51 51
52 // Verifies the set of prepopulate data doesn't contain entries with duplicate 52 // Verifies the set of prepopulate data doesn't contain entries with duplicate
53 // ids. 53 // ids.
54 TEST_F(TemplateURLPrepopulateDataTest, UniqueIDs) { 54 TEST_F(TemplateURLPrepopulateDataTest, UniqueIDs) {
55 const int kCountryIds[] = { 55 const int kCountryIds[] = {
56 'A'<<8|'D', 'A'<<8|'E', 'A'<<8|'F', 'A'<<8|'G', 'A'<<8|'I', 56 'A'<<8|'D', 'A'<<8|'E', 'A'<<8|'F', 'A'<<8|'G', 'A'<<8|'I',
57 'A'<<8|'L', 'A'<<8|'M', 'A'<<8|'N', 'A'<<8|'O', 'A'<<8|'Q', 57 'A'<<8|'L', 'A'<<8|'M', 'A'<<8|'N', 'A'<<8|'O', 'A'<<8|'Q',
58 'A'<<8|'R', 'A'<<8|'S', 'A'<<8|'T', 'A'<<8|'U', 'A'<<8|'W', 58 'A'<<8|'R', 'A'<<8|'S', 'A'<<8|'T', 'A'<<8|'U', 'A'<<8|'W',
59 'A'<<8|'X', 'A'<<8|'Z', 'B'<<8|'A', 'B'<<8|'B', 'B'<<8|'D', 59 'A'<<8|'X', 'A'<<8|'Z', 'B'<<8|'A', 'B'<<8|'B', 'B'<<8|'D',
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 using PrepopulatedEngine = TemplateURLPrepopulateData::PrepopulatedEngine; 362 using PrepopulatedEngine = TemplateURLPrepopulateData::PrepopulatedEngine;
363 const std::vector<const PrepopulatedEngine*> all_engines = 363 const std::vector<const PrepopulatedEngine*> all_engines =
364 TemplateURLPrepopulateData::GetAllPrepopulatedEngines(); 364 TemplateURLPrepopulateData::GetAllPrepopulatedEngines();
365 for (const PrepopulatedEngine* engine : all_engines) { 365 for (const PrepopulatedEngine* engine : all_engines) {
366 std::unique_ptr<TemplateURLData> data = 366 std::unique_ptr<TemplateURLData> data =
367 TemplateURLDataFromPrepopulatedEngine(*engine); 367 TemplateURLDataFromPrepopulatedEngine(*engine);
368 EXPECT_EQ(engine->type, 368 EXPECT_EQ(engine->type,
369 TemplateURL(*data).GetEngineType(SearchTermsData())); 369 TemplateURL(*data).GetEngineType(SearchTermsData()));
370 } 370 }
371 } 371 }
OLDNEW
« no previous file with comments | « components/search_engines/default_search_pref_migration_unittest.cc ('k') | components/signin/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698