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

Side by Side Diff: chrome/test/testing_profile.h

Issue 3051001: Adjust preference sync code to only sync user modifiable preferences. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: separate out the download_manager_unittest.cc fixes Created 10 years, 5 months 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
« no previous file with comments | « chrome/test/testing_pref_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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_TEST_TESTING_PROFILE_H_ 5 #ifndef CHROME_TEST_TESTING_PROFILE_H_
6 #define CHROME_TEST_TESTING_PROFILE_H_ 6 #define CHROME_TEST_TESTING_PROFILE_H_
7 7
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 11 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
12 #include "chrome/browser/bookmarks/bookmark_model.h" 12 #include "chrome/browser/bookmarks/bookmark_model.h"
13 #include "chrome/browser/browser_prefs.h" 13 #include "chrome/browser/browser_prefs.h"
14 #include "chrome/browser/browser_theme_provider.h" 14 #include "chrome/browser/browser_theme_provider.h"
15 #include "chrome/browser/chrome_thread.h" 15 #include "chrome/browser/chrome_thread.h"
16 #include "chrome/browser/favicon_service.h" 16 #include "chrome/browser/favicon_service.h"
17 #include "chrome/browser/find_bar_state.h" 17 #include "chrome/browser/find_bar_state.h"
18 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 18 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
19 #include "chrome/browser/geolocation/geolocation_permission_context.h" 19 #include "chrome/browser/geolocation/geolocation_permission_context.h"
20 #include "chrome/browser/host_content_settings_map.h" 20 #include "chrome/browser/host_content_settings_map.h"
21 #include "chrome/browser/history/history.h" 21 #include "chrome/browser/history/history.h"
22 #include "chrome/browser/in_process_webkit/webkit_context.h" 22 #include "chrome/browser/in_process_webkit/webkit_context.h"
23 #include "chrome/browser/notifications/desktop_notification_service.h" 23 #include "chrome/browser/notifications/desktop_notification_service.h"
24 #include "chrome/browser/pref_service.h" 24 #include "chrome/browser/pref_service.h"
25 #include "chrome/browser/pref_value_store.h" 25 #include "chrome/browser/pref_value_store.h"
26 #include "chrome/browser/profile.h" 26 #include "chrome/browser/profile.h"
27 #include "chrome/browser/search_engines/template_url_model.h" 27 #include "chrome/browser/search_engines/template_url_model.h"
28 #include "chrome/common/json_pref_store.h" 28 #include "chrome/common/json_pref_store.h"
29 #include "chrome/common/net/url_request_context_getter.h" 29 #include "chrome/common/net/url_request_context_getter.h"
30 #include "chrome/test/testing_pref_service.h"
30 #include "net/base/cookie_monster.h" 31 #include "net/base/cookie_monster.h"
31 32
32 class ProfileSyncService; 33 class ProfileSyncService;
33 class SessionService; 34 class SessionService;
34 35
35 class TestingProfile : public Profile { 36 class TestingProfile : public Profile {
36 public: 37 public:
37 TestingProfile(); 38 TestingProfile();
38 39
39 // Creates a new profile by adding |count| to the end of the path. Use this 40 // Creates a new profile by adding |count| to the end of the path. Use this
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 143 }
143 virtual WebDataService* GetWebDataService(ServiceAccessType access) { 144 virtual WebDataService* GetWebDataService(ServiceAccessType access) {
144 return web_data_service_.get(); 145 return web_data_service_.get();
145 } 146 }
146 virtual WebDataService* GetWebDataServiceWithoutCreating() { 147 virtual WebDataService* GetWebDataServiceWithoutCreating() {
147 return web_data_service_.get(); 148 return web_data_service_.get();
148 } 149 }
149 virtual PasswordStore* GetPasswordStore(ServiceAccessType access) { 150 virtual PasswordStore* GetPasswordStore(ServiceAccessType access) {
150 return NULL; 151 return NULL;
151 } 152 }
152 virtual PrefService* GetPrefs() { 153 virtual TestingPrefService* GetPrefs() {
153 if (!prefs_.get()) { 154 if (!prefs_.get()) {
154 FilePath prefs_filename = 155 prefs_.reset(new TestingPrefService());
155 path_.Append(FILE_PATH_LITERAL("TestPreferences"));
156
157 prefs_.reset(PrefService::CreateUserPrefService(prefs_filename));
158 Profile::RegisterUserPrefs(prefs_.get()); 156 Profile::RegisterUserPrefs(prefs_.get());
159 browser::RegisterAllPrefs(prefs_.get(), prefs_.get()); 157 browser::RegisterAllPrefs(prefs_.get(), prefs_.get());
160 } 158 }
161 return prefs_.get(); 159 return prefs_.get();
162 } 160 }
163 virtual TemplateURLModel* GetTemplateURLModel() { 161 virtual TemplateURLModel* GetTemplateURLModel() {
164 return template_url_model_.get(); 162 return template_url_model_.get();
165 } 163 }
166 virtual TemplateURLFetcher* GetTemplateURLFetcher() { return NULL; } 164 virtual TemplateURLFetcher* GetTemplateURLFetcher() { return NULL; }
167 virtual history::TopSites* GetTopSites() { return NULL; } 165 virtual history::TopSites* GetTopSites() { return NULL; }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // Creates and initializes a profile sync service if the tests require one. 283 // Creates and initializes a profile sync service if the tests require one.
286 virtual TokenService* GetTokenService(); 284 virtual TokenService* GetTokenService();
287 virtual ProfileSyncService* GetProfileSyncService(); 285 virtual ProfileSyncService* GetProfileSyncService();
288 virtual CloudPrintProxyService* GetCloudPrintProxyService() { return NULL; } 286 virtual CloudPrintProxyService* GetCloudPrintProxyService() { return NULL; }
289 287
290 protected: 288 protected:
291 // The path of the profile; the various database and other files are relative 289 // The path of the profile; the various database and other files are relative
292 // to this. 290 // to this.
293 FilePath path_; 291 FilePath path_;
294 base::Time start_time_; 292 base::Time start_time_;
295 scoped_ptr<PrefService> prefs_; 293 scoped_ptr<TestingPrefService> prefs_;
296 294
297 private: 295 private:
298 // Destroys favicon service if it has been created. 296 // Destroys favicon service if it has been created.
299 void DestroyFaviconService(); 297 void DestroyFaviconService();
300 298
301 // If the history service has been created, it is destroyed. This is invoked 299 // If the history service has been created, it is destroyed. This is invoked
302 // from the destructor. 300 // from the destructor.
303 void DestroyHistoryService(); 301 void DestroyHistoryService();
304 302
305 // If the webdata service has been created, it is destroyed. This is invoked 303 // If the webdata service has been created, it is destroyed. This is invoked
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 383
386 virtual ProfileId GetRuntimeId() { 384 virtual ProfileId GetRuntimeId() {
387 return original_profile_->GetRuntimeId(); 385 return original_profile_->GetRuntimeId();
388 } 386 }
389 387
390 protected: 388 protected:
391 Profile* original_profile_; 389 Profile* original_profile_;
392 }; 390 };
393 391
394 #endif // CHROME_TEST_TESTING_PROFILE_H_ 392 #endif // CHROME_TEST_TESTING_PROFILE_H_
OLDNEW
« no previous file with comments | « chrome/test/testing_pref_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698