| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/common/persistent_pref_store.h" | 11 #include "chrome/common/persistent_pref_store.h" |
| 12 #include "chrome/common/pref_store.h" | 12 #include "chrome/common/pref_store.h" |
| 13 | 13 |
| 14 class CommandLine; | 14 class CommandLine; |
| 15 class FilePath; | 15 class FilePath; |
| 16 class PrefService; | 16 class PrefService; |
| 17 | 17 |
| 18 namespace base { |
| 19 class MessageLoopProxy; |
| 20 } |
| 21 |
| 18 namespace policy { | 22 namespace policy { |
| 19 class PolicyService; | 23 class PolicyService; |
| 20 } | 24 } |
| 21 | 25 |
| 22 // A helper that allows convenient building of custom PrefServices in tests. | 26 // A helper that allows convenient building of custom PrefServices in tests. |
| 23 class PrefServiceMockBuilder { | 27 class PrefServiceMockBuilder { |
| 24 public: | 28 public: |
| 25 PrefServiceMockBuilder(); | 29 PrefServiceMockBuilder(); |
| 26 ~PrefServiceMockBuilder(); | 30 ~PrefServiceMockBuilder(); |
| 27 | 31 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 policy::PolicyService* service); | 43 policy::PolicyService* service); |
| 40 PrefServiceMockBuilder& WithRecommendedPolicies( | 44 PrefServiceMockBuilder& WithRecommendedPolicies( |
| 41 policy::PolicyService* service); | 45 policy::PolicyService* service); |
| 42 #endif | 46 #endif |
| 43 | 47 |
| 44 // Specifies to use an actual command-line backed command-line pref store. | 48 // Specifies to use an actual command-line backed command-line pref store. |
| 45 PrefServiceMockBuilder& WithCommandLine(CommandLine* command_line); | 49 PrefServiceMockBuilder& WithCommandLine(CommandLine* command_line); |
| 46 | 50 |
| 47 // Specifies to use an actual file-backed user pref store. | 51 // Specifies to use an actual file-backed user pref store. |
| 48 PrefServiceMockBuilder& WithUserFilePrefs(const FilePath& prefs_file); | 52 PrefServiceMockBuilder& WithUserFilePrefs(const FilePath& prefs_file); |
| 53 PrefServiceMockBuilder& WithUserFilePrefs( |
| 54 const FilePath& prefs_file, |
| 55 base::MessageLoopProxy* message_loop_proxy); |
| 49 | 56 |
| 50 // Creates the PrefService, invalidating the entire builder configuration. | 57 // Creates the PrefService, invalidating the entire builder configuration. |
| 51 PrefService* Create(); | 58 PrefService* Create(); |
| 52 | 59 |
| 53 private: | 60 private: |
| 54 scoped_refptr<PrefStore> managed_prefs_; | 61 scoped_refptr<PrefStore> managed_prefs_; |
| 55 scoped_refptr<PrefStore> extension_prefs_; | 62 scoped_refptr<PrefStore> extension_prefs_; |
| 56 scoped_refptr<PrefStore> command_line_prefs_; | 63 scoped_refptr<PrefStore> command_line_prefs_; |
| 57 scoped_refptr<PersistentPrefStore> user_prefs_; | 64 scoped_refptr<PersistentPrefStore> user_prefs_; |
| 58 scoped_refptr<PrefStore> recommended_prefs_; | 65 scoped_refptr<PrefStore> recommended_prefs_; |
| 59 | 66 |
| 60 DISALLOW_COPY_AND_ASSIGN(PrefServiceMockBuilder); | 67 DISALLOW_COPY_AND_ASSIGN(PrefServiceMockBuilder); |
| 61 }; | 68 }; |
| 62 | 69 |
| 63 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ | 70 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ |
| OLD | NEW |