Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / syncable_prefs / testing_pref_service_syncable.cc
blob7c61f510a31fe5426c04ccf4effd602e0beb322e
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"
7 #include "base/bind.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"
13 template <>
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(
22 pref_notifier,
23 new PrefValueStore(managed_prefs,
24 nullptr, // supervised_user_prefs
25 nullptr, // extension_prefs
26 nullptr, // command_line_prefs
27 user_prefs,
28 recommended_prefs,
29 pref_registry->defaults().get(),
30 pref_notifier),
31 user_prefs,
32 pref_registry,
33 nullptr, // pref_model_associator_client
34 base::Bind(&TestingPrefServiceBase<
35 PrefServiceSyncable,
36 user_prefs::PrefRegistrySyncable>::HandleReadError),
37 false),
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>(
62 managed_prefs,
63 user_prefs,
64 recommended_prefs,
65 pref_registry,
66 pref_notifier) {
69 TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
72 user_prefs::PrefRegistrySyncable* TestingPrefServiceSyncable::registry() {
73 return static_cast<user_prefs::PrefRegistrySyncable*>(
74 DeprecatedGetPrefRegistry());
77 } // namespace syncable_prefs