OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/prefs/persistent_pref_store.h" | 10 #include "base/prefs/persistent_pref_store.h" |
11 #include "base/prefs/pref_store.h" | 11 #include "base/prefs/pref_store.h" |
12 #include "chrome/browser/prefs/pref_service_builder.h" | 12 #include "chrome/browser/prefs/pref_service_builder.h" |
13 | 13 |
14 class CommandLine; | 14 class CommandLine; |
15 class FilePath; | 15 class FilePath; |
16 class PrefService; | 16 class PrefServiceSimple; |
| 17 class PrefServiceSyncable; |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
20 } | 21 } |
21 | 22 |
22 namespace policy { | 23 namespace policy { |
23 class PolicyService; | 24 class PolicyService; |
24 } | 25 } |
25 | 26 |
26 // A helper that allows convenient building of custom PrefServices in tests. | 27 // A helper that allows convenient building of custom PrefServices in tests. |
27 class PrefServiceMockBuilder : public PrefServiceBuilder { | 28 class PrefServiceMockBuilder : public PrefServiceBuilder { |
28 public: | 29 public: |
29 PrefServiceMockBuilder(); | 30 PrefServiceMockBuilder(); |
30 ~PrefServiceMockBuilder(); | 31 virtual ~PrefServiceMockBuilder(); |
31 | 32 |
32 #if defined(ENABLE_CONFIGURATION_POLICY) | 33 #if defined(ENABLE_CONFIGURATION_POLICY) |
33 // Set up policy pref stores using the given policy service. | 34 // Set up policy pref stores using the given policy service. |
34 PrefServiceMockBuilder& WithManagedPolicies( | 35 PrefServiceMockBuilder& WithManagedPolicies( |
35 policy::PolicyService* service); | 36 policy::PolicyService* service); |
36 PrefServiceMockBuilder& WithRecommendedPolicies( | 37 PrefServiceMockBuilder& WithRecommendedPolicies( |
37 policy::PolicyService* service); | 38 policy::PolicyService* service); |
38 #endif | 39 #endif |
39 | 40 |
40 // Specifies to use an actual command-line backed command-line pref store. | 41 // Specifies to use an actual command-line backed command-line pref store. |
41 PrefServiceMockBuilder& WithCommandLine(CommandLine* command_line); | 42 PrefServiceMockBuilder& WithCommandLine(CommandLine* command_line); |
42 | 43 |
43 // Creates a PrefService for testing, invalidating the entire | 44 // Creates a PrefService for testing, invalidating the entire |
44 // builder configuration. | 45 // builder configuration. |
45 virtual PrefService* Create() OVERRIDE; | 46 PrefServiceSimple* CreateSimple(); |
| 47 PrefServiceSyncable* CreateSyncable(); |
46 | 48 |
47 private: | 49 private: |
48 void ResetTestingState(); | 50 void ResetTestingState(); |
49 | 51 |
50 DISALLOW_COPY_AND_ASSIGN(PrefServiceMockBuilder); | 52 DISALLOW_COPY_AND_ASSIGN(PrefServiceMockBuilder); |
51 }; | 53 }; |
52 | 54 |
53 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ | 55 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ |
OLD | NEW |