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 "chrome/test/base/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
<PrefServiceSyncable
, user_prefs::PrefRegistrySyncable
>::
15 TestingPrefServiceBase(TestingPrefStore
* managed_prefs
,
16 TestingPrefStore
* user_prefs
,
17 TestingPrefStore
* recommended_prefs
,
18 user_prefs::PrefRegistrySyncable
* pref_registry
,
19 PrefNotifierImpl
* pref_notifier
)
20 : PrefServiceSyncable(
22 new PrefValueStore(managed_prefs
,
23 NULL
, // supervised_user_prefs
24 NULL
, // extension_prefs
25 NULL
, // command_line_prefs
28 pref_registry
->defaults().get(),
32 base::Bind(&TestingPrefServiceBase
<
34 user_prefs::PrefRegistrySyncable
>::HandleReadError
),
36 managed_prefs_(managed_prefs
),
37 user_prefs_(user_prefs
),
38 recommended_prefs_(recommended_prefs
) {}
40 TestingPrefServiceSyncable::TestingPrefServiceSyncable()
41 : TestingPrefServiceBase
<PrefServiceSyncable
,
42 user_prefs::PrefRegistrySyncable
>(
43 new TestingPrefStore(),
44 new TestingPrefStore(),
45 new TestingPrefStore(),
46 new user_prefs::PrefRegistrySyncable(),
47 new PrefNotifierImpl()) {
50 TestingPrefServiceSyncable::TestingPrefServiceSyncable(
51 TestingPrefStore
* managed_prefs
,
52 TestingPrefStore
* user_prefs
,
53 TestingPrefStore
* recommended_prefs
,
54 user_prefs::PrefRegistrySyncable
* pref_registry
,
55 PrefNotifierImpl
* pref_notifier
)
56 : TestingPrefServiceBase
<PrefServiceSyncable
,
57 user_prefs::PrefRegistrySyncable
>(
65 TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
68 user_prefs::PrefRegistrySyncable
* TestingPrefServiceSyncable::registry() {
69 return static_cast<user_prefs::PrefRegistrySyncable
*>(
70 DeprecatedGetPrefRegistry());