OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 #include "chrome/browser/profiles/profile_dependency_manager.h" | 37 #include "chrome/browser/profiles/profile_dependency_manager.h" |
38 #include "chrome/browser/search_engines/template_url_fetcher.h" | 38 #include "chrome/browser/search_engines/template_url_fetcher.h" |
39 #include "chrome/browser/search_engines/template_url_service.h" | 39 #include "chrome/browser/search_engines/template_url_service.h" |
40 #include "chrome/browser/search_engines/template_url_service_factory.h" | 40 #include "chrome/browser/search_engines/template_url_service_factory.h" |
41 #include "chrome/browser/sessions/session_service_factory.h" | 41 #include "chrome/browser/sessions/session_service_factory.h" |
42 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 42 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
43 #include "chrome/browser/sync/profile_sync_service_mock.h" | 43 #include "chrome/browser/sync/profile_sync_service_mock.h" |
44 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 44 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
45 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 45 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
46 #include "chrome/common/chrome_constants.h" | 46 #include "chrome/common/chrome_constants.h" |
| 47 #include "chrome/common/chrome_notification_types.h" |
47 #include "chrome/common/url_constants.h" | 48 #include "chrome/common/url_constants.h" |
48 #include "chrome/test/bookmark_load_observer.h" | 49 #include "chrome/test/bookmark_load_observer.h" |
49 #include "chrome/test/test_url_request_context_getter.h" | 50 #include "chrome/test/test_url_request_context_getter.h" |
50 #include "chrome/test/testing_pref_service.h" | 51 #include "chrome/test/testing_pref_service.h" |
51 #include "chrome/test/ui_test_utils.h" | 52 #include "chrome/test/ui_test_utils.h" |
52 #include "content/browser/browser_thread.h" | 53 #include "content/browser/browser_thread.h" |
53 #include "content/browser/in_process_webkit/webkit_context.h" | 54 #include "content/browser/in_process_webkit/webkit_context.h" |
54 #include "content/browser/mock_resource_context.h" | 55 #include "content/browser/mock_resource_context.h" |
55 #include "content/common/notification_service.h" | 56 #include "content/common/notification_service.h" |
56 #include "net/base/cookie_monster.h" | 57 #include "net/base/cookie_monster.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 this, NULL); | 162 this, NULL); |
162 DesktopNotificationServiceFactory::GetInstance()->SetTestingFactory( | 163 DesktopNotificationServiceFactory::GetInstance()->SetTestingFactory( |
163 this, CreateTestDesktopNotificationService); | 164 this, CreateTestDesktopNotificationService); |
164 SessionServiceFactory::GetInstance()->SetTestingFactory(this, NULL); | 165 SessionServiceFactory::GetInstance()->SetTestingFactory(this, NULL); |
165 TabRestoreServiceFactory::GetInstance()->SetTestingFactory(this, NULL); | 166 TabRestoreServiceFactory::GetInstance()->SetTestingFactory(this, NULL); |
166 TemplateURLServiceFactory::GetInstance()->SetTestingFactory(this, NULL); | 167 TemplateURLServiceFactory::GetInstance()->SetTestingFactory(this, NULL); |
167 } | 168 } |
168 | 169 |
169 TestingProfile::~TestingProfile() { | 170 TestingProfile::~TestingProfile() { |
170 NotificationService::current()->Notify( | 171 NotificationService::current()->Notify( |
171 NotificationType::PROFILE_DESTROYED, | 172 chrome::NOTIFICATION_PROFILE_DESTROYED, |
172 Source<Profile>(static_cast<Profile*>(this)), | 173 Source<Profile>(static_cast<Profile*>(this)), |
173 NotificationService::NoDetails()); | 174 NotificationService::NoDetails()); |
174 | 175 |
175 profile_dependency_manager_->DestroyProfileServices(this); | 176 profile_dependency_manager_->DestroyProfileServices(this); |
176 | 177 |
177 DestroyTopSites(); | 178 DestroyTopSites(); |
178 DestroyHistoryService(); | 179 DestroyHistoryService(); |
179 // FaviconService depends on HistoryServce so destroying it later. | 180 // FaviconService depends on HistoryServce so destroying it later. |
180 DestroyFaviconService(); | 181 DestroyFaviconService(); |
181 DestroyWebDataService(); | 182 DestroyWebDataService(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 BookmarkLoadObserver observer; | 300 BookmarkLoadObserver observer; |
300 bookmark_bar_model_->AddObserver(&observer); | 301 bookmark_bar_model_->AddObserver(&observer); |
301 MessageLoop::current()->Run(); | 302 MessageLoop::current()->Run(); |
302 bookmark_bar_model_->RemoveObserver(&observer); | 303 bookmark_bar_model_->RemoveObserver(&observer); |
303 DCHECK(bookmark_bar_model_->IsLoaded()); | 304 DCHECK(bookmark_bar_model_->IsLoaded()); |
304 } | 305 } |
305 | 306 |
306 void TestingProfile::BlockUntilTopSitesLoaded() { | 307 void TestingProfile::BlockUntilTopSitesLoaded() { |
307 if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) | 308 if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) |
308 GetTopSites()->HistoryLoaded(); | 309 GetTopSites()->HistoryLoaded(); |
309 ui_test_utils::WaitForNotification(NotificationType::TOP_SITES_LOADED); | 310 ui_test_utils::WaitForNotification(chrome::NOTIFICATION_TOP_SITES_LOADED); |
310 } | 311 } |
311 | 312 |
312 void TestingProfile::CreateTemplateURLFetcher() { | 313 void TestingProfile::CreateTemplateURLFetcher() { |
313 template_url_fetcher_.reset(new TemplateURLFetcher(this)); | 314 template_url_fetcher_.reset(new TemplateURLFetcher(this)); |
314 } | 315 } |
315 | 316 |
316 static ProfileKeyedService* BuildTemplateURLService(Profile* profile) { | 317 static ProfileKeyedService* BuildTemplateURLService(Profile* profile) { |
317 return new TemplateURLService(profile); | 318 return new TemplateURLService(profile); |
318 } | 319 } |
319 | 320 |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 } | 787 } |
787 | 788 |
788 DerivedTestingProfile::DerivedTestingProfile(Profile* profile) | 789 DerivedTestingProfile::DerivedTestingProfile(Profile* profile) |
789 : original_profile_(profile) {} | 790 : original_profile_(profile) {} |
790 | 791 |
791 DerivedTestingProfile::~DerivedTestingProfile() {} | 792 DerivedTestingProfile::~DerivedTestingProfile() {} |
792 | 793 |
793 ProfileId DerivedTestingProfile::GetRuntimeId() { | 794 ProfileId DerivedTestingProfile::GetRuntimeId() { |
794 return original_profile_->GetRuntimeId(); | 795 return original_profile_->GetRuntimeId(); |
795 } | 796 } |
OLD | NEW |