| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ios/chrome/browser/ui/settings/personal_data_manager_data_changed_obse
rver.h" |
| 6 |
| 7 #include "components/autofill/core/browser/personal_data_manager.h" |
| 8 |
| 9 PersonalDataManagerDataChangedObserver::PersonalDataManagerDataChangedObserver( |
| 10 autofill::PersonalDataManager* personal_data_manager) |
| 11 : personal_data_manager_(personal_data_manager) { |
| 12 personal_data_manager_->AddObserver(this); |
| 13 } |
| 14 |
| 15 PersonalDataManagerDataChangedObserver:: |
| 16 ~PersonalDataManagerDataChangedObserver() { |
| 17 personal_data_manager_->RemoveObserver(this); |
| 18 } |
| 19 |
| 20 void PersonalDataManagerDataChangedObserver::Wait() { |
| 21 // If a test is blocked in that method, it means that OnPersonalDataChanged() |
| 22 // was never called which indicates a bug in either the expectation of the |
| 23 // test (no asynchronous operation is executed on the PersonalDataManager |
| 24 // passed in the constructor) or in the utilisation of the |
| 25 // PersonalDataManagerDataChangedObserver (there is a race-condition between |
| 26 // sending the asynchronous operation and the creation of the observer, it can |
| 27 // be fixed by creating the observer before sending the operation). |
| 28 run_loop_.Run(); |
| 29 } |
| 30 |
| 31 void PersonalDataManagerDataChangedObserver::OnPersonalDataChanged() { |
| 32 run_loop_.QuitWhenIdle(); |
| 33 } |
| OLD | NEW |