blob: fc7edf99edd04f64666b5a6fece878445c42d50f [file] [log] [blame]
[email protected]7688968a2013-02-12 21:45:131// 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
maxbogueea16ff412016-10-28 16:35:295#include "components/sync_preferences/testing_pref_service_syncable.h"
[email protected]7688968a2013-02-12 21:45:136
Tim Schumann978e7502018-05-07 13:46:527#include <memory>
8
[email protected]7688968a2013-02-12 21:45:139#include "base/bind.h"
[email protected]f0c8c4992014-05-15 17:37:2610#include "components/pref_registry/pref_registry_syncable.h"
brettwf00b9b42016-02-01 22:11:3811#include "components/prefs/pref_notifier_impl.h"
12#include "components/prefs/pref_value_store.h"
[email protected]7688968a2013-02-12 21:45:1313#include "testing/gtest/include/gtest/gtest.h"
14
[email protected]443e9312013-05-06 06:17:3415template <>
maxbogueea16ff412016-10-28 16:35:2916TestingPrefServiceBase<sync_preferences::PrefServiceSyncable,
sdefresne50c1e522015-09-18 09:47:5117 user_prefs::PrefRegistrySyncable>::
[email protected]443e9312013-05-06 06:17:3418 TestingPrefServiceBase(TestingPrefStore* managed_prefs,
Toby Huang41b07ab2020-03-27 21:40:3019 TestingPrefStore* supervised_user_prefs,
a-v-y658f626b2017-01-09 09:18:4620 TestingPrefStore* extension_prefs,
[email protected]443e9312013-05-06 06:17:3421 TestingPrefStore* user_prefs,
22 TestingPrefStore* recommended_prefs,
23 user_prefs::PrefRegistrySyncable* pref_registry,
24 PrefNotifierImpl* pref_notifier)
maxbogueea16ff412016-10-28 16:35:2925 : sync_preferences::PrefServiceSyncable(
François Degrosee2f030d2017-12-04 00:29:0126 std::unique_ptr<PrefNotifierImpl>(pref_notifier),
27 std::make_unique<PrefValueStore>(managed_prefs,
Toby Huang41b07ab2020-03-27 21:40:3028 supervised_user_prefs,
29 extension_prefs,
30 /*command_line_prefs=*/nullptr,
François Degrosee2f030d2017-12-04 00:29:0131 user_prefs,
32 recommended_prefs,
33 pref_registry->defaults().get(),
34 pref_notifier),
[email protected]443e9312013-05-06 06:17:3435 user_prefs,
36 pref_registry,
Tim Schumann978e7502018-05-07 13:46:5237 /*pref_model_associator_client=*/nullptr,
Ken Rockot36778cfc2019-12-18 16:57:0538 base::BindRepeating(
39 &TestingPrefServiceBase<
40 PrefServiceSyncable,
41 user_prefs::PrefRegistrySyncable>::HandleReadError),
[email protected]443e9312013-05-06 06:17:3442 false),
[email protected]7688968a2013-02-12 21:45:1343 managed_prefs_(managed_prefs),
a-v-y658f626b2017-01-09 09:18:4644 extension_prefs_(extension_prefs),
[email protected]7688968a2013-02-12 21:45:1345 user_prefs_(user_prefs),
[email protected]443e9312013-05-06 06:17:3446 recommended_prefs_(recommended_prefs) {}
[email protected]7688968a2013-02-12 21:45:1347
maxbogueea16ff412016-10-28 16:35:2948namespace sync_preferences {
sdefresne50c1e522015-09-18 09:47:5149
[email protected]7688968a2013-02-12 21:45:1350TestingPrefServiceSyncable::TestingPrefServiceSyncable()
[email protected]443e9312013-05-06 06:17:3451 : TestingPrefServiceBase<PrefServiceSyncable,
52 user_prefs::PrefRegistrySyncable>(
Toby Huang41b07ab2020-03-27 21:40:3053 /*managed_prefs=*/new TestingPrefStore(),
54 /*supervised_user_prefs=*/new TestingPrefStore(),
55 /*extension_prefs=*/new TestingPrefStore(),
56 /*user_prefs=*/new TestingPrefStore(),
57 /*recommended_prefs=*/new TestingPrefStore(),
maxbogueea16ff412016-10-28 16:35:2958 new user_prefs::PrefRegistrySyncable(),
59 new PrefNotifierImpl()) {}
[email protected]7688968a2013-02-12 21:45:1360
[email protected]f830f3d2013-03-12 22:23:4861TestingPrefServiceSyncable::TestingPrefServiceSyncable(
62 TestingPrefStore* managed_prefs,
Toby Huang41b07ab2020-03-27 21:40:3063 TestingPrefStore* supervised_user_prefs,
a-v-y658f626b2017-01-09 09:18:4664 TestingPrefStore* extension_prefs,
[email protected]f830f3d2013-03-12 22:23:4865 TestingPrefStore* user_prefs,
66 TestingPrefStore* recommended_prefs,
[email protected]443e9312013-05-06 06:17:3467 user_prefs::PrefRegistrySyncable* pref_registry,
[email protected]f830f3d2013-03-12 22:23:4868 PrefNotifierImpl* pref_notifier)
[email protected]443e9312013-05-06 06:17:3469 : TestingPrefServiceBase<PrefServiceSyncable,
70 user_prefs::PrefRegistrySyncable>(
maxbogueea16ff412016-10-28 16:35:2971 managed_prefs,
Toby Huang41b07ab2020-03-27 21:40:3072 supervised_user_prefs,
a-v-y658f626b2017-01-09 09:18:4673 extension_prefs,
maxbogueea16ff412016-10-28 16:35:2974 user_prefs,
75 recommended_prefs,
76 pref_registry,
77 pref_notifier) {}
[email protected]f830f3d2013-03-12 22:23:4878
maxbogueea16ff412016-10-28 16:35:2979TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {}
[email protected]7688968a2013-02-12 21:45:1380
[email protected]443e9312013-05-06 06:17:3481user_prefs::PrefRegistrySyncable* TestingPrefServiceSyncable::registry() {
82 return static_cast<user_prefs::PrefRegistrySyncable*>(
83 DeprecatedGetPrefRegistry());
[email protected]7688968a2013-02-12 21:45:1384}
sdefresne50c1e522015-09-18 09:47:5185
maxbogueea16ff412016-10-28 16:35:2986} // namespace sync_preferences