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

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

Issue 6901031: Profile shouldn't own Session/TabRestore services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again and hope upload works this time 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
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"
(...skipping 17 matching lines...) Expand all
28 #include "chrome/browser/net/gaia/token_service.h" 28 #include "chrome/browser/net/gaia/token_service.h"
29 #include "chrome/browser/net/pref_proxy_config_service.h" 29 #include "chrome/browser/net/pref_proxy_config_service.h"
30 #include "chrome/browser/notifications/desktop_notification_service.h" 30 #include "chrome/browser/notifications/desktop_notification_service.h"
31 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 31 #include "chrome/browser/notifications/desktop_notification_service_factory.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/prefs/testing_pref_store.h"
34 #include "chrome/browser/prerender/prerender_manager.h" 34 #include "chrome/browser/prerender/prerender_manager.h"
35 #include "chrome/browser/profiles/profile_dependency_manager.h" 35 #include "chrome/browser/profiles/profile_dependency_manager.h"
36 #include "chrome/browser/search_engines/template_url_fetcher.h" 36 #include "chrome/browser/search_engines/template_url_fetcher.h"
37 #include "chrome/browser/search_engines/template_url_model.h" 37 #include "chrome/browser/search_engines/template_url_model.h"
38 #include "chrome/browser/sessions/session_service.h" 38 #include "chrome/browser/sessions/session_service_factory.h"
39 #include "chrome/browser/sessions/tab_restore_service_factory.h"
39 #include "chrome/browser/sync/profile_sync_service_mock.h" 40 #include "chrome/browser/sync/profile_sync_service_mock.h"
40 #include "chrome/browser/ui/find_bar/find_bar_state.h" 41 #include "chrome/browser/ui/find_bar/find_bar_state.h"
41 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 42 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
42 #include "chrome/browser/ui/webui/ntp_resource_cache.h" 43 #include "chrome/browser/ui/webui/ntp_resource_cache.h"
43 #include "chrome/common/chrome_constants.h" 44 #include "chrome/common/chrome_constants.h"
44 #include "chrome/common/url_constants.h" 45 #include "chrome/common/url_constants.h"
45 #include "chrome/test/test_url_request_context_getter.h" 46 #include "chrome/test/test_url_request_context_getter.h"
46 #include "chrome/test/testing_pref_service.h" 47 #include "chrome/test/testing_pref_service.h"
47 #include "chrome/test/ui_test_utils.h" 48 #include "chrome/test/ui_test_utils.h"
48 #include "content/browser/browser_thread.h" 49 #include "content/browser/browser_thread.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 181 }
181 } 182 }
182 183
183 // Install profile keyed service factory hooks for dummy/test services 184 // Install profile keyed service factory hooks for dummy/test services
184 BackgroundContentsServiceFactory::GetInstance()->ForceAssociationBetween( 185 BackgroundContentsServiceFactory::GetInstance()->ForceAssociationBetween(
185 this, NULL); 186 this, NULL);
186 DesktopNotificationServiceFactory::GetInstance()->set_test_factory( 187 DesktopNotificationServiceFactory::GetInstance()->set_test_factory(
187 &CreateTestDesktopNotificationService); 188 &CreateTestDesktopNotificationService);
188 DesktopNotificationServiceFactory::GetInstance()->ForceAssociationBetween( 189 DesktopNotificationServiceFactory::GetInstance()->ForceAssociationBetween(
189 this, NULL); 190 this, NULL);
191 SessionServiceFactory::GetInstance()->ForceAssociationBetween(this, NULL);
192 TabRestoreServiceFactory::GetInstance()->ForceAssociationBetween(this, NULL);
190 } 193 }
191 194
192 TestingProfile::~TestingProfile() { 195 TestingProfile::~TestingProfile() {
193 NotificationService::current()->Notify( 196 NotificationService::current()->Notify(
194 NotificationType::PROFILE_DESTROYED, 197 NotificationType::PROFILE_DESTROYED,
195 Source<Profile>(static_cast<Profile*>(this)), 198 Source<Profile>(static_cast<Profile*>(this)),
196 NotificationService::NoDetails()); 199 NotificationService::NoDetails());
197 200
198 profile_dependency_manager_->DestroyProfileServices(this); 201 profile_dependency_manager_->DestroyProfileServices(this);
199 202
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 geolocation_permission_context_ = 641 geolocation_permission_context_ =
639 new GeolocationPermissionContext(this); 642 new GeolocationPermissionContext(this);
640 } 643 }
641 return geolocation_permission_context_.get(); 644 return geolocation_permission_context_.get();
642 } 645 }
643 646
644 HostZoomMap* TestingProfile::GetHostZoomMap() { 647 HostZoomMap* TestingProfile::GetHostZoomMap() {
645 return NULL; 648 return NULL;
646 } 649 }
647 650
648 SessionService* TestingProfile::GetSessionService() {
649 return session_service_.get();
650 }
651
652 bool TestingProfile::HasSessionService() const {
653 return (session_service_.get() != NULL);
654 }
655
656 bool TestingProfile::HasProfileSyncService() const { 651 bool TestingProfile::HasProfileSyncService() const {
657 return (profile_sync_service_.get() != NULL); 652 return (profile_sync_service_.get() != NULL);
658 } 653 }
659 654
660 std::wstring TestingProfile::GetName() { 655 std::wstring TestingProfile::GetName() {
661 return std::wstring(); 656 return std::wstring();
662 } 657 }
663 658
664 std::wstring TestingProfile::GetID() { 659 std::wstring TestingProfile::GetID() {
665 return id_; 660 return id_;
(...skipping 12 matching lines...) Expand all
678 } 673 }
679 674
680 bool TestingProfile::IsSameProfile(Profile *p) { 675 bool TestingProfile::IsSameProfile(Profile *p) {
681 return this == p; 676 return this == p;
682 } 677 }
683 678
684 base::Time TestingProfile::GetStartTime() const { 679 base::Time TestingProfile::GetStartTime() const {
685 return start_time_; 680 return start_time_;
686 } 681 }
687 682
688 TabRestoreService* TestingProfile::GetTabRestoreService() {
689 return NULL;
690 }
691
692 ProtocolHandlerRegistry* TestingProfile::GetProtocolHandlerRegistry() { 683 ProtocolHandlerRegistry* TestingProfile::GetProtocolHandlerRegistry() {
693 return protocol_handler_registry_.get(); 684 return protocol_handler_registry_.get();
694 } 685 }
695 686
696 SpellCheckHost* TestingProfile::GetSpellCheckHost() { 687 SpellCheckHost* TestingProfile::GetSpellCheckHost() {
697 return NULL; 688 return NULL;
698 } 689 }
699 690
700 void TestingProfile::set_session_service(SessionService* session_service) {
701 session_service_.reset(session_service);
702 }
703
704 WebKitContext* TestingProfile::GetWebKitContext() { 691 WebKitContext* TestingProfile::GetWebKitContext() {
705 if (webkit_context_ == NULL) { 692 if (webkit_context_ == NULL) {
706 webkit_context_ = new WebKitContext( 693 webkit_context_ = new WebKitContext(
707 IsOffTheRecord(), GetPath(), 694 IsOffTheRecord(), GetPath(),
708 GetExtensionSpecialStoragePolicy(), 695 GetExtensionSpecialStoragePolicy(),
709 false); 696 false);
710 } 697 }
711 return webkit_context_; 698 return webkit_context_;
712 } 699 }
713 700
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 } 805 }
819 806
820 DerivedTestingProfile::DerivedTestingProfile(Profile* profile) 807 DerivedTestingProfile::DerivedTestingProfile(Profile* profile)
821 : original_profile_(profile) {} 808 : original_profile_(profile) {}
822 809
823 DerivedTestingProfile::~DerivedTestingProfile() {} 810 DerivedTestingProfile::~DerivedTestingProfile() {}
824 811
825 ProfileId DerivedTestingProfile::GetRuntimeId() { 812 ProfileId DerivedTestingProfile::GetRuntimeId() {
826 return original_profile_->GetRuntimeId(); 813 return original_profile_->GetRuntimeId();
827 } 814 }
OLDNEW
« no previous file with comments | « chrome/test/testing_profile.h ('k') | content/browser/tab_contents/navigation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698