blob: ee59cc1dfad843e641fc3df7bed3dda0aa7e6a3e [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#ifndef COMPONENTS_SYNC_PREFERENCES_TESTING_PREF_SERVICE_SYNCABLE_H_
6#define COMPONENTS_SYNC_PREFERENCES_TESTING_PREF_SERVICE_SYNCABLE_H_
[email protected]7688968a2013-02-12 21:45:137
avi5dd91f82015-12-25 22:30:468#include "base/macros.h"
brettwf00b9b42016-02-01 22:11:389#include "components/prefs/testing_pref_service.h"
maxbogueea16ff412016-10-28 16:35:2910#include "components/sync_preferences/pref_service_syncable.h"
[email protected]7688968a2013-02-12 21:45:1311
[email protected]443e9312013-05-06 06:17:3412namespace user_prefs {
[email protected]7688968a2013-02-12 21:45:1313class PrefRegistrySyncable;
[email protected]443e9312013-05-06 06:17:3414}
[email protected]7688968a2013-02-12 21:45:1315
maxbogueea16ff412016-10-28 16:35:2916namespace sync_preferences {
sdefresne50c1e522015-09-18 09:47:5117
[email protected]7688968a2013-02-12 21:45:1318// Test version of PrefServiceSyncable.
Tim Schumann978e7502018-05-07 13:46:5219// This class hierarchy has a flaw: TestingPrefServiceBase is inheriting from
20// the first template parameter (PrefServiceSyncable in this case). This means,
21// all of the supported parameter types must support the same constructor
22// signatures -- which they don't. Hence, it's not possible to properly inject
23// a PrefModelAssociatorClient.
24// TODO(tschumann) The whole purpose of TestingPrefServiceBase is questionable
25// and I'd be in favor of removing it completely:
26// -- it hides the dependency injetion of the different stores
27// -- just to later offer ways to manipulate speficic stores.
28// -- if tests just dependency injects the individual stores directly, they
29// already have full control and won't need that indirection at all.
30// See PrefServiceSyncableMergeTest as an example of a cleaner way.
[email protected]7688968a2013-02-12 21:45:1331class TestingPrefServiceSyncable
[email protected]443e9312013-05-06 06:17:3432 : public TestingPrefServiceBase<PrefServiceSyncable,
33 user_prefs::PrefRegistrySyncable> {
[email protected]7688968a2013-02-12 21:45:1334 public:
35 TestingPrefServiceSyncable();
[email protected]443e9312013-05-06 06:17:3436 TestingPrefServiceSyncable(TestingPrefStore* managed_prefs,
a-v-y658f626b2017-01-09 09:18:4637 TestingPrefStore* extension_prefs,
[email protected]443e9312013-05-06 06:17:3438 TestingPrefStore* user_prefs,
39 TestingPrefStore* recommended_prefs,
40 user_prefs::PrefRegistrySyncable* pref_registry,
41 PrefNotifierImpl* pref_notifier);
dchenge59c1bb92014-10-21 11:55:4942 ~TestingPrefServiceSyncable() override;
[email protected]7688968a2013-02-12 21:45:1343
44 // This is provided as a convenience; on a production PrefService
45 // you would do all registrations before constructing it, passing it
[email protected]e90a01f2013-11-19 04:22:1246 // a PrefRegistry via its constructor (or via e.g. PrefServiceFactory).
[email protected]443e9312013-05-06 06:17:3447 user_prefs::PrefRegistrySyncable* registry();
[email protected]7688968a2013-02-12 21:45:1348
49 private:
50 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceSyncable);
51};
52
maxbogueea16ff412016-10-28 16:35:2953} // namespace sync_preferences
sdefresne50c1e522015-09-18 09:47:5154
[email protected]443e9312013-05-06 06:17:3455template <>
maxbogueea16ff412016-10-28 16:35:2956TestingPrefServiceBase<sync_preferences::PrefServiceSyncable,
sdefresne50c1e522015-09-18 09:47:5157 user_prefs::PrefRegistrySyncable>::
[email protected]443e9312013-05-06 06:17:3458 TestingPrefServiceBase(TestingPrefStore* managed_prefs,
a-v-y658f626b2017-01-09 09:18:4659 TestingPrefStore* extension_prefs,
[email protected]443e9312013-05-06 06:17:3460 TestingPrefStore* user_prefs,
61 TestingPrefStore* recommended_prefs,
62 user_prefs::PrefRegistrySyncable* pref_registry,
63 PrefNotifierImpl* pref_notifier);
[email protected]7688968a2013-02-12 21:45:1364
maxbogueea16ff412016-10-28 16:35:2965#endif // COMPONENTS_SYNC_PREFERENCES_TESTING_PREF_SERVICE_SYNCABLE_H_