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

Side by Side Diff: chrome/browser/search_engines/template_url_service_test_util.cc

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweaks Created 6 years, 5 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 "chrome/browser/search_engines/template_url_service_test_util.h" 5 #include "chrome/browser/search_engines/template_url_service_test_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (!enabled) { 153 if (!enabled) {
154 value->SetBoolean(DefaultSearchManager::kDisabledByPolicy, true); 154 value->SetBoolean(DefaultSearchManager::kDisabledByPolicy, true);
155 pref_service->SetManagedPref( 155 pref_service->SetManagedPref(
156 DefaultSearchManager::kDefaultSearchProviderDataPrefName, 156 DefaultSearchManager::kDefaultSearchProviderDataPrefName,
157 value.release()); 157 value.release());
158 return; 158 return;
159 } 159 }
160 160
161 EXPECT_FALSE(keyword.empty()); 161 EXPECT_FALSE(keyword.empty());
162 EXPECT_FALSE(search_url.empty()); 162 EXPECT_FALSE(search_url.empty());
163 value->Set(DefaultSearchManager::kShortName, 163 value->Set(DefaultSearchManager::kShortName, new base::StringValue(name));
164 base::Value::CreateStringValue(name)); 164 value->Set(DefaultSearchManager::kKeyword, new base::StringValue(keyword));
165 value->Set(DefaultSearchManager::kKeyword, 165 value->Set(DefaultSearchManager::kURL, new base::StringValue(search_url));
166 base::Value::CreateStringValue(keyword));
167 value->Set(DefaultSearchManager::kURL,
168 base::Value::CreateStringValue(search_url));
169 value->Set(DefaultSearchManager::kSuggestionsURL, 166 value->Set(DefaultSearchManager::kSuggestionsURL,
170 base::Value::CreateStringValue(suggest_url)); 167 new base::StringValue(suggest_url));
171 value->Set(DefaultSearchManager::kFaviconURL, 168 value->Set(DefaultSearchManager::kFaviconURL,
172 base::Value::CreateStringValue(icon_url)); 169 new base::StringValue(icon_url));
173 value->Set(DefaultSearchManager::kSearchTermsReplacementKey, 170 value->Set(DefaultSearchManager::kSearchTermsReplacementKey,
174 base::Value::CreateStringValue(search_terms_replacement_key)); 171 new base::StringValue(search_terms_replacement_key));
175 172
176 std::vector<std::string> encodings_items; 173 std::vector<std::string> encodings_items;
177 base::SplitString(encodings, ';', &encodings_items); 174 base::SplitString(encodings, ';', &encodings_items);
178 scoped_ptr<base::ListValue> encodings_list(new base::ListValue); 175 scoped_ptr<base::ListValue> encodings_list(new base::ListValue);
179 for (std::vector<std::string>::const_iterator it = encodings_items.begin(); 176 for (std::vector<std::string>::const_iterator it = encodings_items.begin();
180 it != encodings_items.end(); 177 it != encodings_items.end();
181 ++it) { 178 ++it) {
182 encodings_list->AppendString(*it); 179 encodings_list->AppendString(*it);
183 } 180 }
184 value->Set(DefaultSearchManager::kInputEncodings, encodings_list.release()); 181 value->Set(DefaultSearchManager::kInputEncodings, encodings_list.release());
185 182
186 scoped_ptr<base::ListValue> alternate_url_list(new base::ListValue()); 183 scoped_ptr<base::ListValue> alternate_url_list(new base::ListValue());
187 if (!alternate_url.empty()) 184 if (!alternate_url.empty())
188 alternate_url_list->Append(base::Value::CreateStringValue(alternate_url)); 185 alternate_url_list->Append(new base::StringValue(alternate_url));
189 value->Set(DefaultSearchManager::kAlternateURLs, 186 value->Set(DefaultSearchManager::kAlternateURLs,
190 alternate_url_list.release()); 187 alternate_url_list.release());
191 188
192 pref_service->SetManagedPref( 189 pref_service->SetManagedPref(
193 DefaultSearchManager::kDefaultSearchProviderDataPrefName, 190 DefaultSearchManager::kDefaultSearchProviderDataPrefName,
194 value.release()); 191 value.release());
195 } 192 }
196 193
197 void TemplateURLServiceTestUtilBase::RemoveManagedDefaultSearchPreferences() { 194 void TemplateURLServiceTestUtilBase::RemoveManagedDefaultSearchPreferences() {
198 TestingPrefServiceSyncable* pref_service = profile()->GetTestingPrefService(); 195 TestingPrefServiceSyncable* pref_service = profile()->GetTestingPrefService();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 228
232 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); 229 UIThreadSearchTermsData::SetGoogleBaseURL(std::string());
233 230
234 // Flush the message loop to make application verifiers happy. 231 // Flush the message loop to make application verifiers happy.
235 base::RunLoop().RunUntilIdle(); 232 base::RunLoop().RunUntilIdle();
236 } 233 }
237 234
238 TestingProfile* TemplateURLServiceTestUtil::profile() const { 235 TestingProfile* TemplateURLServiceTestUtil::profile() const {
239 return profile_.get(); 236 return profile_.get();
240 } 237 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698