OLD | NEW |
---|---|
(Empty) | |
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 #ifndef CHROME_TEST_BASE_TESTING_PREF_SERVICE_SYNCABLE_H_ | |
6 #define CHROME_TEST_BASE_TESTING_PREF_SERVICE_SYNCABLE_H_ | |
7 | |
8 #include "chrome/browser/prefs/pref_service_syncable.h" | |
9 #include "chrome/test/base/testing_pref_service.h" | |
10 | |
11 class PrefRegistrySyncable; | |
12 class TestingBrowserProcess; | |
13 | |
14 // Test version of PrefServiceSyncable. | |
15 class TestingPrefServiceSyncable | |
16 : public TestingPrefServiceBase<PrefServiceSyncable> { | |
17 public: | |
18 TestingPrefServiceSyncable(); | |
19 virtual ~TestingPrefServiceSyncable(); | |
20 | |
21 // This is provided as a convenience; on a production PrefService | |
22 // you would do all registrations before constructing it, passing it | |
23 // a PrefRegistry via its constructor (or via | |
24 // e.g. PrefServiceBuilder). | |
Mattias Nissler (ping if slow)
2013/02/12 13:53:32
fits the previous line?
Jói
2013/02/12 14:35:51
Done.
| |
25 PrefRegistrySyncable* registry(); | |
26 | |
27 private: | |
28 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceSyncable); | |
Mattias Nissler (ping if slow)
2013/02/12 13:53:32
#include "base/basictypes.h"
Jói
2013/02/12 14:35:51
Done.
| |
29 }; | |
30 | |
31 // Helper class to temporarily set up a |local_state| in the global | |
32 // TestingBrowserProcess (for most unit tests it's NULL). | |
33 class ScopedTestingLocalState { | |
34 public: | |
35 explicit ScopedTestingLocalState(TestingBrowserProcess* browser_process); | |
36 ~ScopedTestingLocalState(); | |
37 | |
38 TestingPrefServiceSimple* Get() { | |
39 return &local_state_; | |
40 } | |
41 | |
42 private: | |
43 TestingBrowserProcess* browser_process_; | |
44 TestingPrefServiceSimple local_state_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(ScopedTestingLocalState); | |
47 }; | |
48 | |
49 template<> | |
50 TestingPrefServiceBase<PrefServiceSyncable>::TestingPrefServiceBase( | |
51 TestingPrefStore* managed_prefs, | |
52 TestingPrefStore* user_prefs, | |
53 TestingPrefStore* recommended_prefs, | |
54 PrefRegistry* pref_registry, | |
55 PrefNotifierImpl* pref_notifier); | |
56 | |
57 #endif // CHROME_TEST_BASE_TESTING_PREF_SERVICE_SYNCABLE_H_ | |
58 | |
OLD | NEW |