Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(676)

Side by Side Diff: chrome/browser/prefs/pref_service_mock_builder.h

Issue 5646003: Sanitize PrefStore interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PrefService mock construction in PrefServiceTest to include command line store. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/prefs/pref_service.cc ('k') | chrome/browser/prefs/pref_service_mock_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_
6 #define CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/scoped_ptr.h"
11 #include "chrome/common/persistent_pref_store.h"
12 #include "chrome/common/pref_store.h"
13
14 class CommandLine;
15 class FilePath;
16 class PrefService;
17 class Profile;
18
19 namespace policy {
20 class ConfigurationPolicyProvider;
21 }
22
23 // A helper that allows convenient building of custom PrefServices in tests.
24 class PrefServiceMockBuilder {
25 public:
26 PrefServiceMockBuilder();
27
28 // Functions for setting the various parameters of the PrefService to build.
29 // These take ownership of the |store| parameter.
30 PrefServiceMockBuilder& WithManagedPlatformPrefs(PrefStore* store);
31 PrefServiceMockBuilder& WithDeviceManagementPrefs(PrefStore* store);
32 PrefServiceMockBuilder& WithExtensionPrefs(PrefStore* store);
33 PrefServiceMockBuilder& WithCommandLinePrefs(PrefStore* store);
34 PrefServiceMockBuilder& WithUserPrefs(PersistentPrefStore* store);
35 PrefServiceMockBuilder& WithRecommendedPrefs(PrefStore* store);
36
37 // Set up policy pref stores using the given policy provider.
38 PrefServiceMockBuilder& WithManagedPlatformProvider(
39 policy::ConfigurationPolicyProvider* provider);
40 PrefServiceMockBuilder& WithDeviceManagementProvider(
41 policy::ConfigurationPolicyProvider* provider);
42 PrefServiceMockBuilder& WithRecommendedProvider(
43 policy::ConfigurationPolicyProvider* provider);
44
45 // Specifies to use an actual command-line backed command-line pref store.
46 PrefServiceMockBuilder& WithCommandLine(CommandLine* command_line);
47
48 // Specifies to use an actual file-backed user pref store.
49 PrefServiceMockBuilder& WithUserFilePrefs(const FilePath& prefs_file);
50
51 // Sets the profile to pass to the PrefService.
52 PrefServiceMockBuilder& WithRecommendedPrefs(Profile* profile);
53
54 // Creates the PrefService, invalidating the entire builder configuration.
55 PrefService* Create();
56
57 private:
58 scoped_ptr<PrefStore> managed_platform_prefs_;
59 scoped_ptr<PrefStore> device_management_prefs_;
60 scoped_ptr<PrefStore> extension_prefs_;
61 scoped_ptr<PrefStore> command_line_prefs_;
62 scoped_ptr<PersistentPrefStore> user_prefs_;
63 scoped_ptr<PrefStore> recommended_prefs_;
64 Profile* profile_;
65
66 DISALLOW_COPY_AND_ASSIGN(PrefServiceMockBuilder);
67 };
68
69 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service.cc ('k') | chrome/browser/prefs/pref_service_mock_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698