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

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

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 unique_ids.end()); 114 unique_ids.end());
115 unique_ids.insert(urls[turl_i]->prepopulate_id); 115 unique_ids.insert(urls[turl_i]->prepopulate_id);
116 } 116 }
117 } 117 }
118 } 118 }
119 119
120 // Verifies that default search providers from the preferences file 120 // Verifies that default search providers from the preferences file
121 // override the built-in ones. 121 // override the built-in ones.
122 TEST_F(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) { 122 TEST_F(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) {
123 prefs_.SetUserPref(prefs::kSearchProviderOverridesVersion, 123 prefs_.SetUserPref(prefs::kSearchProviderOverridesVersion,
124 new base::FundamentalValue(1)); 124 new base::Value(1));
125 base::ListValue* overrides = new base::ListValue; 125 base::ListValue* overrides = new base::ListValue;
126 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); 126 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
127 // Set only the minimal required settings for a search provider configuration. 127 // Set only the minimal required settings for a search provider configuration.
128 entry->SetString("name", "foo"); 128 entry->SetString("name", "foo");
129 entry->SetString("keyword", "fook"); 129 entry->SetString("keyword", "fook");
130 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}"); 130 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}");
131 entry->SetString("favicon_url", "http://foi.com/favicon.ico"); 131 entry->SetString("favicon_url", "http://foi.com/favicon.ico");
132 entry->SetString("encoding", "UTF-8"); 132 entry->SetString("encoding", "UTF-8");
133 entry->SetInteger("id", 1001); 133 entry->SetInteger("id", 1001);
134 overrides->Append(entry->CreateDeepCopy()); 134 overrides->Append(entry->CreateDeepCopy());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 prefs_.SetUserPref(prefs::kSearchProviderOverrides, overrides); 200 prefs_.SetUserPref(prefs::kSearchProviderOverrides, overrides);
201 201
202 t_urls = 202 t_urls =
203 TemplateURLPrepopulateData::GetPrepopulatedEngines(&prefs_, 203 TemplateURLPrepopulateData::GetPrepopulatedEngines(&prefs_,
204 &default_index); 204 &default_index);
205 EXPECT_EQ(2u, t_urls.size()); 205 EXPECT_EQ(2u, t_urls.size());
206 } 206 }
207 207
208 TEST_F(TemplateURLPrepopulateDataTest, ClearProvidersFromPrefs) { 208 TEST_F(TemplateURLPrepopulateDataTest, ClearProvidersFromPrefs) {
209 prefs_.SetUserPref(prefs::kSearchProviderOverridesVersion, 209 prefs_.SetUserPref(prefs::kSearchProviderOverridesVersion,
210 new base::FundamentalValue(1)); 210 new base::Value(1));
211 base::ListValue* overrides = new base::ListValue; 211 base::ListValue* overrides = new base::ListValue;
212 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); 212 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
213 // Set only the minimal required settings for a search provider configuration. 213 // Set only the minimal required settings for a search provider configuration.
214 entry->SetString("name", "foo"); 214 entry->SetString("name", "foo");
215 entry->SetString("keyword", "fook"); 215 entry->SetString("keyword", "fook");
216 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}"); 216 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}");
217 entry->SetString("favicon_url", "http://foi.com/favicon.ico"); 217 entry->SetString("favicon_url", "http://foi.com/favicon.ico");
218 entry->SetString("encoding", "UTF-8"); 218 entry->SetString("encoding", "UTF-8");
219 entry->SetInteger("id", 1001); 219 entry->SetInteger("id", 1001);
220 overrides->Append(std::move(entry)); 220 overrides->Append(std::move(entry));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 const std::vector<const PrepopulatedEngine*> all_engines = 356 const std::vector<const PrepopulatedEngine*> all_engines =
357 TemplateURLPrepopulateData::GetAllPrepopulatedEngines(); 357 TemplateURLPrepopulateData::GetAllPrepopulatedEngines();
358 for (const PrepopulatedEngine* engine : all_engines) { 358 for (const PrepopulatedEngine* engine : all_engines) {
359 std::unique_ptr<TemplateURLData> data = 359 std::unique_ptr<TemplateURLData> data =
360 TemplateURLPrepopulateData::MakeTemplateURLDataFromPrepopulatedEngine( 360 TemplateURLPrepopulateData::MakeTemplateURLDataFromPrepopulatedEngine(
361 *engine); 361 *engine);
362 EXPECT_EQ(engine->type, 362 EXPECT_EQ(engine->type,
363 TemplateURL(*data).GetEngineType(SearchTermsData())); 363 TemplateURL(*data).GetEngineType(SearchTermsData()));
364 } 364 }
365 } 365 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698