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

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

Issue 2083363002: Remove calls to deprecated MessageLoop methods in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/run_loop.h"
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" 11 #include "chrome/browser/autofill/personal_data_manager_factory.h"
11 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/sync/profile_sync_test_util.h" 14 #include "chrome/browser/sync/profile_sync_test_util.h"
14 #include "chrome/browser/sync/test/integration/multi_client_status_change_checke r.h" 15 #include "chrome/browser/sync/test/integration/multi_client_status_change_checke r.h"
15 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" 16 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
16 #include "chrome/browser/sync/test/integration/sync_test.h" 17 #include "chrome/browser/sync/test/integration/sync_test.h"
17 #include "chrome/browser/web_data_service_factory.h" 18 #include "chrome/browser/web_data_service_factory.h"
18 #include "components/autofill/core/browser/autofill_profile.h" 19 #include "components/autofill/core/browser/autofill_profile.h"
19 #include "components/autofill/core/browser/autofill_test_utils.h" 20 #include "components/autofill/core/browser/autofill_test_utils.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 return !checker.TimedOut(); 296 return !checker.TimedOut();
296 } 297 }
297 298
298 void SetProfiles(int profile, std::vector<AutofillProfile>* autofill_profiles) { 299 void SetProfiles(int profile, std::vector<AutofillProfile>* autofill_profiles) {
299 MockPersonalDataManagerObserver observer; 300 MockPersonalDataManagerObserver observer;
300 EXPECT_CALL(observer, OnPersonalDataChanged()). 301 EXPECT_CALL(observer, OnPersonalDataChanged()).
301 WillOnce(QuitUIMessageLoop()); 302 WillOnce(QuitUIMessageLoop());
302 PersonalDataManager* pdm = GetPersonalDataManager(profile); 303 PersonalDataManager* pdm = GetPersonalDataManager(profile);
303 pdm->AddObserver(&observer); 304 pdm->AddObserver(&observer);
304 pdm->SetProfiles(autofill_profiles); 305 pdm->SetProfiles(autofill_profiles);
305 base::MessageLoop::current()->Run(); 306 base::RunLoop().Run();
306 pdm->RemoveObserver(&observer); 307 pdm->RemoveObserver(&observer);
307 } 308 }
308 309
309 void SetCreditCards(int profile, std::vector<CreditCard>* credit_cards) { 310 void SetCreditCards(int profile, std::vector<CreditCard>* credit_cards) {
310 MockPersonalDataManagerObserver observer; 311 MockPersonalDataManagerObserver observer;
311 EXPECT_CALL(observer, OnPersonalDataChanged()). 312 EXPECT_CALL(observer, OnPersonalDataChanged()).
312 WillOnce(QuitUIMessageLoop()); 313 WillOnce(QuitUIMessageLoop());
313 PersonalDataManager* pdm = GetPersonalDataManager(profile); 314 PersonalDataManager* pdm = GetPersonalDataManager(profile);
314 pdm->AddObserver(&observer); 315 pdm->AddObserver(&observer);
315 pdm->SetCreditCards(credit_cards); 316 pdm->SetCreditCards(credit_cards);
316 base::MessageLoop::current()->Run(); 317 base::RunLoop().Run();
317 pdm->RemoveObserver(&observer); 318 pdm->RemoveObserver(&observer);
318 } 319 }
319 320
320 void AddProfile(int profile, const AutofillProfile& autofill_profile) { 321 void AddProfile(int profile, const AutofillProfile& autofill_profile) {
321 const std::vector<AutofillProfile*>& all_profiles = 322 const std::vector<AutofillProfile*>& all_profiles =
322 GetAllAutoFillProfiles(profile); 323 GetAllAutoFillProfiles(profile);
323 std::vector<AutofillProfile> autofill_profiles; 324 std::vector<AutofillProfile> autofill_profiles;
324 for (size_t i = 0; i < all_profiles.size(); ++i) 325 for (size_t i = 0; i < all_profiles.size(); ++i)
325 autofill_profiles.push_back(*all_profiles[i]); 326 autofill_profiles.push_back(*all_profiles[i]);
326 autofill_profiles.push_back(autofill_profile); 327 autofill_profiles.push_back(autofill_profile);
(...skipping 27 matching lines...) Expand all
354 } 355 }
355 356
356 const std::vector<AutofillProfile*>& GetAllAutoFillProfiles( 357 const std::vector<AutofillProfile*>& GetAllAutoFillProfiles(
357 int profile) { 358 int profile) {
358 MockPersonalDataManagerObserver observer; 359 MockPersonalDataManagerObserver observer;
359 EXPECT_CALL(observer, OnPersonalDataChanged()). 360 EXPECT_CALL(observer, OnPersonalDataChanged()).
360 WillOnce(QuitUIMessageLoop()); 361 WillOnce(QuitUIMessageLoop());
361 PersonalDataManager* pdm = GetPersonalDataManager(profile); 362 PersonalDataManager* pdm = GetPersonalDataManager(profile);
362 pdm->AddObserver(&observer); 363 pdm->AddObserver(&observer);
363 pdm->Refresh(); 364 pdm->Refresh();
364 base::MessageLoop::current()->Run(); 365 base::RunLoop().Run();
365 pdm->RemoveObserver(&observer); 366 pdm->RemoveObserver(&observer);
366 return pdm->web_profiles(); 367 return pdm->web_profiles();
367 } 368 }
368 369
369 int GetProfileCount(int profile) { 370 int GetProfileCount(int profile) {
370 return GetAllAutoFillProfiles(profile).size(); 371 return GetAllAutoFillProfiles(profile).size();
371 } 372 }
372 373
373 int GetKeyCount(int profile) { 374 int GetKeyCount(int profile) {
374 return GetAllKeys(profile).size(); 375 return GetAllKeys(profile).size();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 510
510 } // namespace 511 } // namespace
511 512
512 bool AwaitProfilesMatch(int a, int b) { 513 bool AwaitProfilesMatch(int a, int b) {
513 ProfilesMatchStatusChecker checker(a, b); 514 ProfilesMatchStatusChecker checker(a, b);
514 checker.Wait(); 515 checker.Wait();
515 return !checker.TimedOut(); 516 return !checker.TimedOut();
516 } 517 }
517 518
518 } // namespace autofill_helper 519 } // namespace autofill_helper
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698