1 // Copyright (c) 2013 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.
5 #include "components/syncable_prefs/testing_pref_service_syncable.h"
8 #include "base/prefs/pref_notifier_impl.h"
9 #include "base/prefs/pref_value_store.h"
10 #include "components/pref_registry/pref_registry_syncable.h"
11 #include "testing/gtest/include/gtest/gtest.h"
14 TestingPrefServiceBase
<syncable_prefs::PrefServiceSyncable
,
15 user_prefs::PrefRegistrySyncable
>::
16 TestingPrefServiceBase(TestingPrefStore
* managed_prefs
,
17 TestingPrefStore
* user_prefs
,
18 TestingPrefStore
* recommended_prefs
,
19 user_prefs::PrefRegistrySyncable
* pref_registry
,
20 PrefNotifierImpl
* pref_notifier
)
21 : syncable_prefs::PrefServiceSyncable(
23 new PrefValueStore(managed_prefs
,
24 nullptr, // supervised_user_prefs
25 nullptr, // extension_prefs
26 nullptr, // command_line_prefs
29 pref_registry
->defaults().get(),
33 nullptr, // pref_model_associator_client
34 base::Bind(&TestingPrefServiceBase
<
36 user_prefs::PrefRegistrySyncable
>::HandleReadError
),
38 managed_prefs_(managed_prefs
),
39 user_prefs_(user_prefs
),
40 recommended_prefs_(recommended_prefs
) {}
42 namespace syncable_prefs
{
44 TestingPrefServiceSyncable::TestingPrefServiceSyncable()
45 : TestingPrefServiceBase
<PrefServiceSyncable
,
46 user_prefs::PrefRegistrySyncable
>(
47 new TestingPrefStore(),
48 new TestingPrefStore(),
49 new TestingPrefStore(),
50 new user_prefs::PrefRegistrySyncable(),
51 new PrefNotifierImpl()) {
54 TestingPrefServiceSyncable::TestingPrefServiceSyncable(
55 TestingPrefStore
* managed_prefs
,
56 TestingPrefStore
* user_prefs
,
57 TestingPrefStore
* recommended_prefs
,
58 user_prefs::PrefRegistrySyncable
* pref_registry
,
59 PrefNotifierImpl
* pref_notifier
)
60 : TestingPrefServiceBase
<PrefServiceSyncable
,
61 user_prefs::PrefRegistrySyncable
>(
69 TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
72 user_prefs::PrefRegistrySyncable
* TestingPrefServiceSyncable::registry() {
73 return static_cast<user_prefs::PrefRegistrySyncable
*>(
74 DeprecatedGetPrefRegistry());
77 } // namespace syncable_prefs