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

Side by Side Diff: chrome/browser/sync/test/integration/search_engines_helper.cc

Issue 9982018: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us to eliminate t… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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
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/sync/test/integration/search_engines_helper.h" 5 #include "chrome/browser/sync/test/integration/search_engines_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 171
172 TemplateURL* CreateTestTemplateURL(int seed) { 172 TemplateURL* CreateTestTemplateURL(int seed) {
173 return CreateTestTemplateURL(seed, CreateKeyword(seed), 173 return CreateTestTemplateURL(seed, CreateKeyword(seed),
174 base::StringPrintf("0000-0000-0000-%04d", seed)); 174 base::StringPrintf("0000-0000-0000-%04d", seed));
175 } 175 }
176 176
177 TemplateURL* CreateTestTemplateURL(int seed, 177 TemplateURL* CreateTestTemplateURL(int seed,
178 const string16& keyword, 178 const string16& keyword,
179 const std::string& sync_guid) { 179 const std::string& sync_guid) {
180 return CreateTestTemplateURL(seed, 180 return CreateTestTemplateURL(seed, keyword,
181 base::StringPrintf("http://www.test%d.com/", seed), keyword, sync_guid); 181 base::StringPrintf("http://www.test%d.com/", seed), sync_guid);
182 } 182 }
183 183
184 TemplateURL* CreateTestTemplateURL(int seed, 184 TemplateURL* CreateTestTemplateURL(int seed,
185 const string16& keyword,
185 const std::string& url, 186 const std::string& url,
186 const string16& keyword,
187 const std::string& sync_guid) { 187 const std::string& sync_guid) {
188 TemplateURL* turl = new TemplateURL(); 188 TemplateURLData data;
189 turl->set_short_name(CreateKeyword(seed)); 189 data.short_name = CreateKeyword(seed);
190 turl->set_keyword(keyword); 190 data.SetKeyword(keyword);
191 turl->set_safe_for_autoreplace(true); 191 data.safe_for_autoreplace = true;
192 turl->set_date_created(base::Time::FromTimeT(100)); 192 data.SetURL(url);
193 turl->set_last_modified(base::Time::FromTimeT(100)); 193 data.favicon_url = GURL("http://favicon.url");
194 turl->SetPrepopulateId(999999); 194 data.date_created = base::Time::FromTimeT(100);
195 turl->set_sync_guid(sync_guid); 195 data.last_modified = base::Time::FromTimeT(100);
196 turl->SetURL(url); 196 data.prepopulate_id = 999999;
197 turl->set_favicon_url(GURL("http://favicon.url")); 197 data.sync_guid = sync_guid;
198 return turl; 198 return new TemplateURL(data);
199 } 199 }
200 200
201 void AddSearchEngine(int profile, int seed) { 201 void AddSearchEngine(int profile, int seed) {
202 GetServiceForProfile(profile)->Add(CreateTestTemplateURL(seed)); 202 GetServiceForProfile(profile)->Add(CreateTestTemplateURL(seed));
203 if (test()->use_verifier()) 203 if (test()->use_verifier())
204 GetVerifierService()->Add(CreateTestTemplateURL(seed)); 204 GetVerifierService()->Add(CreateTestTemplateURL(seed));
205 } 205 }
206 206
207 void EditSearchEngine(int profile, 207 void EditSearchEngine(int profile,
208 const string16& keyword, 208 const string16& keyword,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 service->SetDefaultSearchProvider(turl); 253 service->SetDefaultSearchProvider(turl);
254 if (test()->use_verifier()) { 254 if (test()->use_verifier()) {
255 const TemplateURL* verifier_turl = 255 const TemplateURL* verifier_turl =
256 GetVerifierService()->GetTemplateURLForKeyword(CreateKeyword(seed)); 256 GetVerifierService()->GetTemplateURLForKeyword(CreateKeyword(seed));
257 ASSERT_TRUE(verifier_turl); 257 ASSERT_TRUE(verifier_turl);
258 GetVerifierService()->SetDefaultSearchProvider(verifier_turl); 258 GetVerifierService()->SetDefaultSearchProvider(verifier_turl);
259 } 259 }
260 } 260 }
261 261
262 } // namespace search_engines_helper 262 } // namespace search_engines_helper
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698