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

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

Issue 5213002: Fix for Bug 50726 "Save extension list and "winning" prefs from extensions" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressed comments, moved ExtensionPrefStore reference to Profile 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
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 #pragma once 7 #pragma once
8 8
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "base/scoped_temp_dir.h" 11 #include "base/scoped_temp_dir.h"
12 #include "base/timer.h" 12 #include "base/timer.h"
13 #include "chrome/browser/profile.h" 13 #include "chrome/browser/profile.h"
14 14
15 namespace history { 15 namespace history {
16 class TopSites; 16 class TopSites;
17 } 17 }
18 18
19 namespace net { 19 namespace net {
20 class CookieMonster; 20 class CookieMonster;
21 } 21 }
22 22
23 class AutocompleteClassifier; 23 class AutocompleteClassifier;
24 class BookmarkModel; 24 class BookmarkModel;
25 class BrowserThemeProvider; 25 class BrowserThemeProvider;
26 class CommandLine; 26 class CommandLine;
27 class ExtensionPrefs;
27 class DesktopNotificationService; 28 class DesktopNotificationService;
28 class FaviconService; 29 class FaviconService;
29 class FindBarState; 30 class FindBarState;
30 class GeolocationContentSettingsMap; 31 class GeolocationContentSettingsMap;
31 class GeolocationPermissionContext; 32 class GeolocationPermissionContext;
32 class HistoryService; 33 class HistoryService;
33 class HostContentSettingsMap; 34 class HostContentSettingsMap;
34 class PrefService; 35 class PrefService;
36 class PrefStore;
35 class ProfileSyncService; 37 class ProfileSyncService;
36 class SessionService; 38 class SessionService;
37 class TemplateURLModel; 39 class TemplateURLModel;
38 class TestingPrefService; 40 class TestingPrefService;
39 class URLRequestContextGetter; 41 class URLRequestContextGetter;
40 class WebKitContext; 42 class WebKitContext;
41 43
42 class TestingProfile : public Profile { 44 class TestingProfile : public Profile {
43 public: 45 public:
44 TestingProfile(); 46 TestingProfile();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 181 }
180 virtual PasswordStore* GetPasswordStore(ServiceAccessType access) { 182 virtual PasswordStore* GetPasswordStore(ServiceAccessType access) {
181 return NULL; 183 return NULL;
182 } 184 }
183 // Sets the profile's PrefService. If a pref service hasn't been explicitly 185 // Sets the profile's PrefService. If a pref service hasn't been explicitly
184 // set GetPrefs creates one, so normally you need not invoke this. If you need 186 // set GetPrefs creates one, so normally you need not invoke this. If you need
185 // to set a pref service you must invoke this before GetPrefs. 187 // to set a pref service you must invoke this before GetPrefs.
186 // TestingPrefService takes ownership of |prefs|. 188 // TestingPrefService takes ownership of |prefs|.
187 void SetPrefService(PrefService* prefs); 189 void SetPrefService(PrefService* prefs);
188 virtual PrefService* GetPrefs(); 190 virtual PrefService* GetPrefs();
191 virtual PrefStore* GetExtensionPrefStore();
192 virtual void SetExtensionPrefStore(PrefStore* ext_pref_store);
189 virtual TemplateURLModel* GetTemplateURLModel() { 193 virtual TemplateURLModel* GetTemplateURLModel() {
190 return template_url_model_.get(); 194 return template_url_model_.get();
191 } 195 }
192 virtual TemplateURLFetcher* GetTemplateURLFetcher() { 196 virtual TemplateURLFetcher* GetTemplateURLFetcher() {
193 return template_url_fetcher_.get(); 197 return template_url_fetcher_.get();
194 } 198 }
195 virtual history::TopSites* GetTopSites(); 199 virtual history::TopSites* GetTopSites();
196 virtual history::TopSites* GetTopSitesWithoutCreating() { 200 virtual history::TopSites* GetTopSitesWithoutCreating() {
197 return top_sites_.get(); 201 return top_sites_.get();
198 } 202 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 virtual ExtensionInfoMap* GetExtensionInfoMap() { return NULL; } 315 virtual ExtensionInfoMap* GetExtensionInfoMap() { return NULL; }
312 virtual PromoCounter* GetInstantPromoCounter() { return NULL; } 316 virtual PromoCounter* GetInstantPromoCounter() { return NULL; }
313 virtual policy::ProfilePolicyContext* GetPolicyContext() { return NULL; } 317 virtual policy::ProfilePolicyContext* GetPolicyContext() { return NULL; }
314 318
315 protected: 319 protected:
316 base::Time start_time_; 320 base::Time start_time_;
317 scoped_ptr<PrefService> prefs_; 321 scoped_ptr<PrefService> prefs_;
318 // ref only for right type, lifecycle is managed by prefs_ 322 // ref only for right type, lifecycle is managed by prefs_
319 TestingPrefService* testing_prefs_; 323 TestingPrefService* testing_prefs_;
320 324
325 // Creates a TestingPrefService and associates it with the TestingProfile
326 virtual void CreateTestingPrefService();
327
321 private: 328 private:
322 // Destroys favicon service if it has been created. 329 // Destroys favicon service if it has been created.
323 void DestroyFaviconService(); 330 void DestroyFaviconService();
324 331
325 // If the webdata service has been created, it is destroyed. This is invoked 332 // If the webdata service has been created, it is destroyed. This is invoked
326 // from the destructor. 333 // from the destructor.
327 void DestroyWebDataService(); 334 void DestroyWebDataService();
328 335
329 // Creates a TestingPrefService and associates it with the TestingProfile
330 void CreateTestingPrefService();
331
332 // The favicon service. Only created if CreateFaviconService is invoked. 336 // The favicon service. Only created if CreateFaviconService is invoked.
333 scoped_refptr<FaviconService> favicon_service_; 337 scoped_refptr<FaviconService> favicon_service_;
334 338
335 // The history service. Only created if CreateHistoryService is invoked. 339 // The history service. Only created if CreateHistoryService is invoked.
336 scoped_refptr<HistoryService> history_service_; 340 scoped_refptr<HistoryService> history_service_;
337 341
338 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. 342 // The BookmarkModel. Only created if CreateBookmarkModel is invoked.
339 scoped_ptr<BookmarkModel> bookmark_bar_model_; 343 scoped_ptr<BookmarkModel> bookmark_bar_model_;
340 344
341 // The TokenService. Created by CreateTokenService. Filled with dummy data. 345 // The TokenService. Created by CreateTokenService. Filled with dummy data.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 // Find bar state. Created lazily by GetFindBarState(). 403 // Find bar state. Created lazily by GetFindBarState().
400 scoped_ptr<FindBarState> find_bar_state_; 404 scoped_ptr<FindBarState> find_bar_state_;
401 405
402 FilePath last_selected_directory_; 406 FilePath last_selected_directory_;
403 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. 407 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails.
404 408
405 // For properly notifying the ExtensionsService when the profile 409 // For properly notifying the ExtensionsService when the profile
406 // is disposed. 410 // is disposed.
407 scoped_refptr<ExtensionsService> extensions_service_; 411 scoped_refptr<ExtensionsService> extensions_service_;
408 412
413 scoped_ptr<ExtensionPrefs> extension_prefs_;
414
415 PrefStore* ext_pref_store_;
Mattias Nissler (ping if slow) 2010/12/01 10:36:36 Can we name this extension_pref_store? The profile
battre (please use the other) 2010/12/01 17:44:38 Done.
416
409 // The proxy prefs tracker. 417 // The proxy prefs tracker.
410 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; 418 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
411 419
412 // We use a temporary directory to store testing profile data. 420 // We use a temporary directory to store testing profile data.
413 ScopedTempDir temp_dir_; 421 ScopedTempDir temp_dir_;
414 }; 422 };
415 423
416 // A profile that derives from another profile. This does not actually 424 // A profile that derives from another profile. This does not actually
417 // override anything except the GetRuntimeId() in order to test sharing of 425 // override anything except the GetRuntimeId() in order to test sharing of
418 // site information. 426 // site information.
419 class DerivedTestingProfile : public TestingProfile { 427 class DerivedTestingProfile : public TestingProfile {
420 public: 428 public:
421 explicit DerivedTestingProfile(Profile* profile) 429 explicit DerivedTestingProfile(Profile* profile)
422 : original_profile_(profile) {} 430 : original_profile_(profile) {}
423 431
424 virtual ProfileId GetRuntimeId() { 432 virtual ProfileId GetRuntimeId() {
425 return original_profile_->GetRuntimeId(); 433 return original_profile_->GetRuntimeId();
426 } 434 }
427 435
428 protected: 436 protected:
429 Profile* original_profile_; 437 Profile* original_profile_;
430 }; 438 };
431 439
432 #endif // CHROME_TEST_TESTING_PROFILE_H_ 440 #endif // CHROME_TEST_TESTING_PROFILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698