OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/testing_profile.h" | 5 #include "chrome/test/base/testing_profile.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" | 119 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" |
120 #endif | 120 #endif |
121 | 121 |
122 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 122 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
123 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 123 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
124 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" | 124 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" |
125 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 125 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
126 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 126 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
127 #endif | 127 #endif |
128 | 128 |
129 #if BUILDFLAG(ANDROID_JAVA_UI) | 129 #if defined(OS_ANDROID) |
130 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 130 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
131 #include "components/offline_pages/core/stub_offline_page_model.h" | 131 #include "components/offline_pages/core/stub_offline_page_model.h" |
132 #endif | 132 #endif |
133 | 133 |
134 using base::Time; | 134 using base::Time; |
135 using bookmarks::BookmarkModel; | 135 using bookmarks::BookmarkModel; |
136 using content::BrowserThread; | 136 using content::BrowserThread; |
137 using content::DownloadManagerDelegate; | 137 using content::DownloadManagerDelegate; |
138 using testing::NiceMock; | 138 using testing::NiceMock; |
139 using testing::Return; | 139 using testing::Return; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 content::BrowserContext* context) { | 244 content::BrowserContext* context) { |
245 const base::FilePath& context_path = context->GetPath(); | 245 const base::FilePath& context_path = context->GetPath(); |
246 return base::MakeUnique<WebDataServiceWrapper>( | 246 return base::MakeUnique<WebDataServiceWrapper>( |
247 context_path, g_browser_process->GetApplicationLocale(), | 247 context_path, g_browser_process->GetApplicationLocale(), |
248 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | 248 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
249 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), | 249 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), |
250 sync_start_util::GetFlareForSyncableService(context_path), | 250 sync_start_util::GetFlareForSyncableService(context_path), |
251 &TestProfileErrorCallback); | 251 &TestProfileErrorCallback); |
252 } | 252 } |
253 | 253 |
254 #if BUILDFLAG(ANDROID_JAVA_UI) | 254 #if defined(OS_ANDROID) |
255 std::unique_ptr<KeyedService> BuildOfflinePageModel( | 255 std::unique_ptr<KeyedService> BuildOfflinePageModel( |
256 content::BrowserContext* context) { | 256 content::BrowserContext* context) { |
257 return base::MakeUnique<offline_pages::StubOfflinePageModel>(); | 257 return base::MakeUnique<offline_pages::StubOfflinePageModel>(); |
258 } | 258 } |
259 #endif | 259 #endif |
260 | 260 |
261 } // namespace | 261 } // namespace |
262 | 262 |
263 // static | 263 // static |
264 #if defined(OS_CHROMEOS) | 264 #if defined(OS_CHROMEOS) |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 base::ThreadTaskRunnerHandle::Get()->PostTask( | 617 base::ThreadTaskRunnerHandle::Get()->PostTask( |
618 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 618 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
619 base::RunLoop().Run(); | 619 base::RunLoop().Run(); |
620 } | 620 } |
621 | 621 |
622 void TestingProfile::CreateBookmarkModel(bool delete_file) { | 622 void TestingProfile::CreateBookmarkModel(bool delete_file) { |
623 if (delete_file) { | 623 if (delete_file) { |
624 base::FilePath path = GetPath().Append(bookmarks::kBookmarksFileName); | 624 base::FilePath path = GetPath().Append(bookmarks::kBookmarksFileName); |
625 base::DeleteFile(path, false); | 625 base::DeleteFile(path, false); |
626 } | 626 } |
627 #if BUILDFLAG(ANDROID_JAVA_UI) | 627 #if defined(OS_ANDROID) |
628 offline_pages::OfflinePageModelFactory::GetInstance()->SetTestingFactory( | 628 offline_pages::OfflinePageModelFactory::GetInstance()->SetTestingFactory( |
629 this, BuildOfflinePageModel); | 629 this, BuildOfflinePageModel); |
630 #endif | 630 #endif |
631 ManagedBookmarkServiceFactory::GetInstance()->SetTestingFactory( | 631 ManagedBookmarkServiceFactory::GetInstance()->SetTestingFactory( |
632 this, ManagedBookmarkServiceFactory::GetDefaultFactory()); | 632 this, ManagedBookmarkServiceFactory::GetDefaultFactory()); |
633 // This creates the BookmarkModel. | 633 // This creates the BookmarkModel. |
634 ignore_result(BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse( | 634 ignore_result(BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse( |
635 this, BuildBookmarkModel)); | 635 this, BuildBookmarkModel)); |
636 } | 636 } |
637 | 637 |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 // Note: Owned by |original_profile|. | 1091 // Note: Owned by |original_profile|. |
1092 return new TestingProfile(path_, delegate_, | 1092 return new TestingProfile(path_, delegate_, |
1093 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1093 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1094 extension_policy_, | 1094 extension_policy_, |
1095 #endif | 1095 #endif |
1096 std::move(pref_service_), original_profile, | 1096 std::move(pref_service_), original_profile, |
1097 guest_session_, supervised_user_id_, | 1097 guest_session_, supervised_user_id_, |
1098 std::move(policy_service_), testing_factories_, | 1098 std::move(policy_service_), testing_factories_, |
1099 profile_name_); | 1099 profile_name_); |
1100 } | 1100 } |
OLD | NEW |