summaryrefslogtreecommitdiffstats
path: root/chrome/test/base/testing_pref_service_syncable.cc
blob: e52ae84b569ea26db99d21140c056f443f8fad90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/test/base/testing_pref_service_syncable.h"

#include "base/bind.h"
#include "base/prefs/pref_notifier_impl.h"
#include "base/prefs/pref_value_store.h"
#include "components/user_prefs/pref_registry_syncable.h"
#include "testing/gtest/include/gtest/gtest.h"

template<>
TestingPrefServiceBase<PrefServiceSyncable, PrefRegistrySyncable>::
TestingPrefServiceBase(TestingPrefStore* managed_prefs,
                       TestingPrefStore* user_prefs,
                       TestingPrefStore* recommended_prefs,
                       PrefRegistrySyncable* pref_registry,
                       PrefNotifierImpl* pref_notifier)
    : PrefServiceSyncable(
        pref_notifier,
        new PrefValueStore(
            managed_prefs,
            NULL,
            NULL,
            user_prefs,
            recommended_prefs,
            pref_registry->defaults(),
            pref_notifier),
        user_prefs,
        pref_registry,
        base::Bind(
            &TestingPrefServiceBase<PrefServiceSyncable,
                                    PrefRegistrySyncable>::HandleReadError),
        false),
      managed_prefs_(managed_prefs),
      user_prefs_(user_prefs),
      recommended_prefs_(recommended_prefs) {
}

TestingPrefServiceSyncable::TestingPrefServiceSyncable()
    : TestingPrefServiceBase<PrefServiceSyncable, PrefRegistrySyncable>(
        new TestingPrefStore(),
        new TestingPrefStore(),
        new TestingPrefStore(),
        new PrefRegistrySyncable(),
        new PrefNotifierImpl()) {
}

TestingPrefServiceSyncable::TestingPrefServiceSyncable(
    TestingPrefStore* managed_prefs,
    TestingPrefStore* user_prefs,
    TestingPrefStore* recommended_prefs,
    PrefRegistrySyncable* pref_registry,
    PrefNotifierImpl* pref_notifier)
    : TestingPrefServiceBase<PrefServiceSyncable, PrefRegistrySyncable>(
        managed_prefs,
        user_prefs,
        recommended_prefs,
        pref_registry,
        pref_notifier) {
}

TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
}

PrefRegistrySyncable* TestingPrefServiceSyncable::registry() {
  return static_cast<PrefRegistrySyncable*>(DeprecatedGetPrefRegistry());
}