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

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

Issue 6831016: Profile shouldn't own background page stuff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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
« no previous file with comments | « chrome/test/testing_profile.h ('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) 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/background_contents_service_factory.h"
16 #include "chrome/browser/bookmarks/bookmark_model.h" 17 #include "chrome/browser/bookmarks/bookmark_model.h"
17 #include "chrome/browser/content_settings/host_content_settings_map.h" 18 #include "chrome/browser/content_settings/host_content_settings_map.h"
18 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
19 #include "chrome/browser/extensions/extension_pref_value_map.h" 20 #include "chrome/browser/extensions/extension_pref_value_map.h"
20 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/extension_special_storage_policy.h" 22 #include "chrome/browser/extensions/extension_special_storage_policy.h"
22 #include "chrome/browser/favicon_service.h" 23 #include "chrome/browser/favicon_service.h"
23 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 24 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
24 #include "chrome/browser/history/history.h" 25 #include "chrome/browser/history/history.h"
25 #include "chrome/browser/history/history_backend.h" 26 #include "chrome/browser/history/history_backend.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (!temp_dir_.Set(fallback_dir)) { 173 if (!temp_dir_.Set(fallback_dir)) {
173 // That shouldn't happen, but if it does, try to recover. 174 // That shouldn't happen, but if it does, try to recover.
174 LOG(ERROR) << "Failed to use a fallback temporary directory."; 175 LOG(ERROR) << "Failed to use a fallback temporary directory.";
175 176
176 // We're screwed if this fails, see CHECK above. 177 // We're screwed if this fails, see CHECK above.
177 CHECK(temp_dir_.Set(system_tmp_dir)); 178 CHECK(temp_dir_.Set(system_tmp_dir));
178 } 179 }
179 } 180 }
180 181
181 // Install profile keyed service factory hooks for dummy/test services 182 // Install profile keyed service factory hooks for dummy/test services
183 BackgroundContentsServiceFactory::GetInstance()->ForceAssociationBetween(
184 this, NULL);
182 DesktopNotificationServiceFactory::GetInstance()->set_test_factory( 185 DesktopNotificationServiceFactory::GetInstance()->set_test_factory(
183 &CreateTestDesktopNotificationService); 186 &CreateTestDesktopNotificationService);
184 DesktopNotificationServiceFactory::GetInstance()->ForceAssociationBetween( 187 DesktopNotificationServiceFactory::GetInstance()->ForceAssociationBetween(
185 this, NULL); 188 this, NULL);
186 } 189 }
187 190
188 TestingProfile::~TestingProfile() { 191 TestingProfile::~TestingProfile() {
189 NotificationService::current()->Notify( 192 NotificationService::current()->Notify(
190 NotificationType::PROFILE_DESTROYED, 193 NotificationType::PROFILE_DESTROYED,
191 Source<Profile>(static_cast<Profile*>(this)), 194 Source<Profile>(static_cast<Profile*>(this)),
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 WebKitContext* TestingProfile::GetOffTheRecordWebKitContext() { 695 WebKitContext* TestingProfile::GetOffTheRecordWebKitContext() {
693 return NULL; 696 return NULL;
694 } 697 }
695 698
696 NTPResourceCache* TestingProfile::GetNTPResourceCache() { 699 NTPResourceCache* TestingProfile::GetNTPResourceCache() {
697 if (!ntp_resource_cache_.get()) 700 if (!ntp_resource_cache_.get())
698 ntp_resource_cache_.reset(new NTPResourceCache(this)); 701 ntp_resource_cache_.reset(new NTPResourceCache(this));
699 return ntp_resource_cache_.get(); 702 return ntp_resource_cache_.get();
700 } 703 }
701 704
702 BackgroundContentsService*
703 TestingProfile::GetBackgroundContentsService() const {
704 return NULL;
705 }
706
707 StatusTray* TestingProfile::GetStatusTray() { 705 StatusTray* TestingProfile::GetStatusTray() {
708 return NULL; 706 return NULL;
709 } 707 }
710 708
711 FilePath TestingProfile::last_selected_directory() { 709 FilePath TestingProfile::last_selected_directory() {
712 return last_selected_directory_; 710 return last_selected_directory_;
713 } 711 }
714 712
715 void TestingProfile::set_last_selected_directory(const FilePath& path) { 713 void TestingProfile::set_last_selected_directory(const FilePath& path) {
716 last_selected_directory_ = path; 714 last_selected_directory_ = path;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 } 803 }
806 804
807 DerivedTestingProfile::DerivedTestingProfile(Profile* profile) 805 DerivedTestingProfile::DerivedTestingProfile(Profile* profile)
808 : original_profile_(profile) {} 806 : original_profile_(profile) {}
809 807
810 DerivedTestingProfile::~DerivedTestingProfile() {} 808 DerivedTestingProfile::~DerivedTestingProfile() {}
811 809
812 ProfileId DerivedTestingProfile::GetRuntimeId() { 810 ProfileId DerivedTestingProfile::GetRuntimeId() {
813 return original_profile_->GetRuntimeId(); 811 return original_profile_->GetRuntimeId();
814 } 812 }
OLDNEW
« no previous file with comments | « chrome/test/testing_profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698