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

Side by Side Diff: ios/chrome/browser/ui/settings/personal_data_manager_data_changed_observer.cc

Issue 2592173002: Fix ios_chrome_unittests to crash on DCHECK failure. (Closed)
Patch Set: Address comments Created 4 years 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
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698