• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "chrome/test/base/testing_pref_service_syncable.h"
6 
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"
12 
13 template <>
14 TestingPrefServiceBase<PrefServiceSyncable, user_prefs::PrefRegistrySyncable>::
TestingPrefServiceBase(TestingPrefStore * managed_prefs,TestingPrefStore * user_prefs,TestingPrefStore * recommended_prefs,user_prefs::PrefRegistrySyncable * pref_registry,PrefNotifierImpl * pref_notifier)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(
21           pref_notifier,
22           new PrefValueStore(managed_prefs,
23                              NULL,  // supervised_user_prefs
24                              NULL,  // extension_prefs
25                              NULL,  // command_line_prefs
26                              user_prefs,
27                              recommended_prefs,
28                              pref_registry->defaults().get(),
29                              pref_notifier),
30           user_prefs,
31           pref_registry,
32           base::Bind(&TestingPrefServiceBase<
33               PrefServiceSyncable,
34               user_prefs::PrefRegistrySyncable>::HandleReadError),
35           false),
36       managed_prefs_(managed_prefs),
37       user_prefs_(user_prefs),
38       recommended_prefs_(recommended_prefs) {}
39 
TestingPrefServiceSyncable()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()) {
48 }
49 
TestingPrefServiceSyncable(TestingPrefStore * managed_prefs,TestingPrefStore * user_prefs,TestingPrefStore * recommended_prefs,user_prefs::PrefRegistrySyncable * pref_registry,PrefNotifierImpl * pref_notifier)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>(
58         managed_prefs,
59         user_prefs,
60         recommended_prefs,
61         pref_registry,
62         pref_notifier) {
63 }
64 
~TestingPrefServiceSyncable()65 TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
66 }
67 
registry()68 user_prefs::PrefRegistrySyncable* TestingPrefServiceSyncable::registry() {
69   return static_cast<user_prefs::PrefRegistrySyncable*>(
70       DeprecatedGetPrefRegistry());
71 }
72