1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/prefs/pref_test_utils.h"
7 #include "base/run_loop.h"
8 #include "base/test/bind.h"
9 #include "base/values.h"
10 #include "components/prefs/pref_change_registrar.h"
11 #include "components/prefs/pref_service.h"
13 void WaitForPrefValue(PrefService* pref_service,
14 const std::string& path,
15 const base::Value& value) {
16 if (value == pref_service->GetValue(path))
19 base::RunLoop run_loop;
20 PrefChangeRegistrar pref_changes;
21 pref_changes.Init(pref_service);
22 pref_changes.Add(path, base::BindLambdaForTesting([&]() {
23 if (value == pref_service->GetValue(path))