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

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

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments 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 #include "chrome/test/testing_profile.h" 5 #include "chrome/test/testing_profile.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 23 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
24 #include "chrome/browser/geolocation/geolocation_permission_context.h" 24 #include "chrome/browser/geolocation/geolocation_permission_context.h"
25 #include "chrome/browser/history/history.h" 25 #include "chrome/browser/history/history.h"
26 #include "chrome/browser/history/history_backend.h" 26 #include "chrome/browser/history/history_backend.h"
27 #include "chrome/browser/history/top_sites.h" 27 #include "chrome/browser/history/top_sites.h"
28 #include "chrome/browser/in_process_webkit/webkit_context.h" 28 #include "chrome/browser/in_process_webkit/webkit_context.h"
29 #include "chrome/browser/net/gaia/token_service.h" 29 #include "chrome/browser/net/gaia/token_service.h"
30 #include "chrome/browser/net/pref_proxy_config_service.h" 30 #include "chrome/browser/net/pref_proxy_config_service.h"
31 #include "chrome/browser/notifications/desktop_notification_service.h" 31 #include "chrome/browser/notifications/desktop_notification_service.h"
32 #include "chrome/browser/prefs/browser_prefs.h" 32 #include "chrome/browser/prefs/browser_prefs.h"
33 #include "chrome/browser/prefs/testing_pref_store.h"
33 #include "chrome/browser/search_engines/template_url_fetcher.h" 34 #include "chrome/browser/search_engines/template_url_fetcher.h"
34 #include "chrome/browser/search_engines/template_url_model.h" 35 #include "chrome/browser/search_engines/template_url_model.h"
35 #include "chrome/browser/sessions/session_service.h" 36 #include "chrome/browser/sessions/session_service.h"
36 #include "chrome/browser/sync/profile_sync_service_mock.h" 37 #include "chrome/browser/sync/profile_sync_service_mock.h"
37 #include "chrome/browser/themes/browser_theme_provider.h" 38 #include "chrome/browser/themes/browser_theme_provider.h"
38 #include "chrome/browser/ui/find_bar/find_bar_state.h" 39 #include "chrome/browser/ui/find_bar/find_bar_state.h"
39 #include "chrome/common/chrome_constants.h" 40 #include "chrome/common/chrome_constants.h"
40 #include "chrome/common/net/url_request_context_getter.h" 41 #include "chrome/common/net/url_request_context_getter.h"
41 #include "chrome/common/notification_service.h" 42 #include "chrome/common/notification_service.h"
42 #include "chrome/common/url_constants.h" 43 #include "chrome/common/url_constants.h"
43 #include "chrome/test/testing_pref_service.h" 44 #include "chrome/test/testing_pref_service.h"
44 #include "chrome/test/test_url_request_context_getter.h" 45 #include "chrome/test/test_url_request_context_getter.h"
45 #include "chrome/test/ui_test_utils.h" 46 #include "chrome/test/ui_test_utils.h"
46 #include "net/base/cookie_monster.h" 47 #include "net/base/cookie_monster.h"
47 #include "net/url_request/url_request_context.h" 48 #include "net/url_request/url_request_context.h"
48 #include "net/url_request/url_request_unittest.h" 49 #include "net/url_request/url_request_unittest.h"
49 #include "testing/gmock/include/gmock/gmock.h" 50 #include "testing/gmock/include/gmock/gmock.h"
50 #include "webkit/database/database_tracker.h" 51 #include "webkit/database/database_tracker.h"
51
52 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) 52 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
53 #include "chrome/browser/gtk/gtk_theme_provider.h" 53 #include "chrome/browser/gtk/gtk_theme_provider.h"
54 #endif 54 #endif
55 55
56 using base::Time; 56 using base::Time;
57 using testing::NiceMock; 57 using testing::NiceMock;
58 using testing::Return; 58 using testing::Return;
59 59
60 namespace { 60 namespace {
61 61
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) { 323 void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) {
324 theme_provider->Init(this); 324 theme_provider->Init(this);
325 created_theme_provider_ = true; 325 created_theme_provider_ = true;
326 theme_provider_.reset(theme_provider); 326 theme_provider_.reset(theme_provider);
327 } 327 }
328 328
329 scoped_refptr<ExtensionService> TestingProfile::CreateExtensionService( 329 scoped_refptr<ExtensionService> TestingProfile::CreateExtensionService(
330 const CommandLine* command_line, 330 const CommandLine* command_line,
331 const FilePath& install_directory) { 331 const FilePath& install_directory) {
332 extension_pref_store_.reset(new ExtensionPrefStore); 332 // Extension pref store, created for use by |extension_prefs_|.
333 extension_prefs_.reset(new ExtensionPrefs(GetPrefs(), 333 ExtensionPrefStore* extension_pref_store = NULL;
334 install_directory, 334 ExtensionPrefStore* incognito_extension_pref_store = NULL;
335 extension_pref_store_.get())); 335 PrefService* incognito_prefs = NULL;
336
337 if (testing_prefs_) {
Mattias Nissler (ping if slow) 2010/12/22 12:09:03 GetPrefs() should be fine, no need for the conditi
battre 2010/12/22 18:34:53 There are classes derived from TestingProfile that
338 extension_pref_store = testing_prefs_->GetExtensionPrefs();
339 incognito_extension_pref_store = new ExtensionPrefStore;
340 incognito_prefs =
341 GetPrefs()->CreateIncognitoPrefService(incognito_extension_pref_store);
342 }
343 extension_prefs_.reset(
344 new ExtensionPrefs(GetPrefs(),
345 incognito_prefs,
346 install_directory,
347 extension_pref_store,
348 incognito_extension_pref_store));
336 extensions_service_ = new ExtensionService(this, 349 extensions_service_ = new ExtensionService(this,
337 command_line, 350 command_line,
338 install_directory, 351 install_directory,
339 extension_prefs_.get(), 352 extension_prefs_.get(),
340 false); 353 false);
341 return extensions_service_; 354 return extensions_service_;
342 } 355 }
343 356
344 FilePath TestingProfile::GetPath() { 357 FilePath TestingProfile::GetPath() {
345 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. 358 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better.
346 return temp_dir_.path(); 359 return temp_dir_.path();
347 } 360 }
348 361
349 TestingPrefService* TestingProfile::GetTestingPrefService() { 362 TestingPrefService* TestingProfile::GetTestingPrefService() {
350 if (!prefs_.get()) 363 if (!prefs_.get())
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 530 }
518 return profile_sync_service_.get(); 531 return profile_sync_service_.get();
519 } 532 }
520 533
521 void TestingProfile::DestroyWebDataService() { 534 void TestingProfile::DestroyWebDataService() {
522 if (!web_data_service_.get()) 535 if (!web_data_service_.get())
523 return; 536 return;
524 537
525 web_data_service_->Shutdown(); 538 web_data_service_->Shutdown();
526 } 539 }
OLDNEW
« chrome/test/testing_pref_service.h ('K') | « chrome/test/testing_profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698