Unregister from GCM when the only GCM app is removed
[chromium-blink-merge.git] / chrome / test / base / testing_pref_service_syncable.cc
blob79464026701970c9ce9387e2ff8db64337f36853
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"
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<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(
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) {}
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>(
58 managed_prefs,
59 user_prefs,
60 recommended_prefs,
61 pref_registry,
62 pref_notifier) {
65 TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
68 user_prefs::PrefRegistrySyncable* TestingPrefServiceSyncable::registry() {
69 return static_cast<user_prefs::PrefRegistrySyncable*>(
70 DeprecatedGetPrefRegistry());