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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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/autofill_helper.h" 5 #include "chrome/browser/sync/test/integration/autofill_helper.h"
6 6
7 #include "chrome/browser/autofill/personal_data_manager_factory.h" 7 #include "chrome/browser/autofill/personal_data_manager_factory.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/profile_sync_service.h" 9 #include "chrome/browser/sync/profile_sync_service.h"
10 #include "chrome/browser/sync/profile_sync_test_util.h" 10 #include "chrome/browser/sync/profile_sync_test_util.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 return GetAllKeys(profile_a) == GetAllKeys(profile_b); 234 return GetAllKeys(profile_a) == GetAllKeys(profile_b);
235 } 235 }
236 236
237 void SetProfiles(int profile, std::vector<AutofillProfile>* autofill_profiles) { 237 void SetProfiles(int profile, std::vector<AutofillProfile>* autofill_profiles) {
238 MockPersonalDataManagerObserver observer; 238 MockPersonalDataManagerObserver observer;
239 EXPECT_CALL(observer, OnPersonalDataChanged()). 239 EXPECT_CALL(observer, OnPersonalDataChanged()).
240 WillOnce(QuitUIMessageLoop()); 240 WillOnce(QuitUIMessageLoop());
241 PersonalDataManager* pdm = GetPersonalDataManager(profile); 241 PersonalDataManager* pdm = GetPersonalDataManager(profile);
242 pdm->AddObserver(&observer); 242 pdm->AddObserver(&observer);
243 pdm->SetProfiles(autofill_profiles); 243 pdm->SetProfiles(autofill_profiles);
244 MessageLoop::current()->Run(); 244 base::MessageLoop::current()->Run();
245 pdm->RemoveObserver(&observer); 245 pdm->RemoveObserver(&observer);
246 } 246 }
247 247
248 void SetCreditCards(int profile, std::vector<CreditCard>* credit_cards) { 248 void SetCreditCards(int profile, std::vector<CreditCard>* credit_cards) {
249 MockPersonalDataManagerObserver observer; 249 MockPersonalDataManagerObserver observer;
250 EXPECT_CALL(observer, OnPersonalDataChanged()). 250 EXPECT_CALL(observer, OnPersonalDataChanged()).
251 WillOnce(QuitUIMessageLoop()); 251 WillOnce(QuitUIMessageLoop());
252 PersonalDataManager* pdm = GetPersonalDataManager(profile); 252 PersonalDataManager* pdm = GetPersonalDataManager(profile);
253 pdm->AddObserver(&observer); 253 pdm->AddObserver(&observer);
254 pdm->SetCreditCards(credit_cards); 254 pdm->SetCreditCards(credit_cards);
255 MessageLoop::current()->Run(); 255 base::MessageLoop::current()->Run();
256 pdm->RemoveObserver(&observer); 256 pdm->RemoveObserver(&observer);
257 } 257 }
258 258
259 void AddProfile(int profile, const AutofillProfile& autofill_profile) { 259 void AddProfile(int profile, const AutofillProfile& autofill_profile) {
260 const std::vector<AutofillProfile*>& all_profiles = GetAllProfiles(profile); 260 const std::vector<AutofillProfile*>& all_profiles = GetAllProfiles(profile);
261 std::vector<AutofillProfile> autofill_profiles; 261 std::vector<AutofillProfile> autofill_profiles;
262 for (size_t i = 0; i < all_profiles.size(); ++i) 262 for (size_t i = 0; i < all_profiles.size(); ++i)
263 autofill_profiles.push_back(*all_profiles[i]); 263 autofill_profiles.push_back(*all_profiles[i]);
264 autofill_profiles.push_back(autofill_profile); 264 autofill_profiles.push_back(autofill_profile);
265 autofill_helper::SetProfiles(profile, &autofill_profiles); 265 autofill_helper::SetProfiles(profile, &autofill_profiles);
(...skipping 24 matching lines...) Expand all
290 } 290 }
291 291
292 const std::vector<AutofillProfile*>& GetAllProfiles( 292 const std::vector<AutofillProfile*>& GetAllProfiles(
293 int profile) { 293 int profile) {
294 MockPersonalDataManagerObserver observer; 294 MockPersonalDataManagerObserver observer;
295 EXPECT_CALL(observer, OnPersonalDataChanged()). 295 EXPECT_CALL(observer, OnPersonalDataChanged()).
296 WillOnce(QuitUIMessageLoop()); 296 WillOnce(QuitUIMessageLoop());
297 PersonalDataManager* pdm = GetPersonalDataManager(profile); 297 PersonalDataManager* pdm = GetPersonalDataManager(profile);
298 pdm->AddObserver(&observer); 298 pdm->AddObserver(&observer);
299 pdm->Refresh(); 299 pdm->Refresh();
300 MessageLoop::current()->Run(); 300 base::MessageLoop::current()->Run();
301 pdm->RemoveObserver(&observer); 301 pdm->RemoveObserver(&observer);
302 return pdm->web_profiles(); 302 return pdm->web_profiles();
303 } 303 }
304 304
305 int GetProfileCount(int profile) { 305 int GetProfileCount(int profile) {
306 return GetAllProfiles(profile).size(); 306 return GetAllProfiles(profile).size();
307 } 307 }
308 308
309 int GetKeyCount(int profile) { 309 int GetKeyCount(int profile) {
310 return GetAllKeys(profile).size(); 310 return GetAllKeys(profile).size();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if (!ProfilesMatch(0, i)) { 350 if (!ProfilesMatch(0, i)) {
351 LOG(ERROR) << "Profile " << i << "does not contain the same autofill " 351 LOG(ERROR) << "Profile " << i << "does not contain the same autofill "
352 "profiles as profile 0."; 352 "profiles as profile 0.";
353 return false; 353 return false;
354 } 354 }
355 } 355 }
356 return true; 356 return true;
357 } 357 }
358 358
359 } // namespace autofill_helper 359 } // namespace autofill_helper
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_ui_util_unittest.cc ('k') | chrome/browser/sync/test/integration/bookmarks_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698