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

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: Fixed whitespaces in mac files Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
16 #include "chrome/browser/bookmarks/bookmark_model.h" 16 #include "chrome/browser/bookmarks/bookmark_model.h"
17 #include "chrome/browser/browser_thread.h" 17 #include "chrome/browser/browser_thread.h"
18 #include "chrome/browser/content_settings/host_content_settings_map.h" 18 #include "chrome/browser/content_settings/host_content_settings_map.h"
19 #include "chrome/browser/dom_ui/ntp_resource_cache.h" 19 #include "chrome/browser/dom_ui/ntp_resource_cache.h"
20 #include "chrome/browser/extensions/extension_pref_store.h"
21 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/extension_pref_value_map.h"
22 #include "chrome/browser/favicon_service.h" 22 #include "chrome/browser/favicon_service.h"
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/test_url_request_context_getter.h" 44 #include "chrome/test/test_url_request_context_getter.h"
44 #include "chrome/test/testing_pref_service.h" 45 #include "chrome/test/testing_pref_service.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/ui/gtk/gtk_theme_provider.h" 53 #include "chrome/browser/ui/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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 void TestingProfile::SetTemplateURLModel(TemplateURLModel* model) { 319 void TestingProfile::SetTemplateURLModel(TemplateURLModel* model) {
320 template_url_model_.reset(model); 320 template_url_model_.reset(model);
321 } 321 }
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 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
334 install_directory, 334 extension_pref_value_map_.reset(new ExtensionPrefValueMap);
335 extension_pref_store_.get())); 335 // Note that the GetPrefs() creates a TestingPrefService, therefore
336 // the extension controlled pref values set in extension_prefs_
337 // are not reflected in the pref service. One would need to
338 // inject a new ExtensionPrefStore(extension_pref_value_map_.get(), false).
339 extension_prefs_.reset(
340 new ExtensionPrefs(GetPrefs(),
341 install_directory,
342 extension_pref_value_map_.get()));
336 extensions_service_ = new ExtensionService(this, 343 extensions_service_ = new ExtensionService(this,
337 command_line, 344 command_line,
338 install_directory, 345 install_directory,
339 extension_prefs_.get(), 346 extension_prefs_.get(),
340 false); 347 false);
341 return extensions_service_; 348 return extensions_service_;
342 } 349 }
343 350
344 FilePath TestingProfile::GetPath() { 351 FilePath TestingProfile::GetPath() {
345 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. 352 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better.
346 return temp_dir_.path(); 353 return temp_dir_.path();
347 } 354 }
348 355
349 TestingPrefService* TestingProfile::GetTestingPrefService() { 356 TestingPrefService* TestingProfile::GetTestingPrefService() {
350 if (!prefs_.get()) 357 if (!prefs_.get())
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 524 }
518 return profile_sync_service_.get(); 525 return profile_sync_service_.get();
519 } 526 }
520 527
521 void TestingProfile::DestroyWebDataService() { 528 void TestingProfile::DestroyWebDataService() {
522 if (!web_data_service_.get()) 529 if (!web_data_service_.get())
523 return; 530 return;
524 531
525 web_data_service_->Shutdown(); 532 web_data_service_->Shutdown();
526 } 533 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698