OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ios/chrome/browser/browser_state/test_chrome_browser_state.h" | 5 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.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/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" | 37 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" |
38 #include "ios/chrome/browser/browser_state/browser_state_keyed_service_factories
.h" | 38 #include "ios/chrome/browser/browser_state/browser_state_keyed_service_factories
.h" |
39 #include "ios/chrome/browser/history/history_client_impl.h" | 39 #include "ios/chrome/browser/history/history_client_impl.h" |
40 #include "ios/chrome/browser/history/history_service_factory.h" | 40 #include "ios/chrome/browser/history/history_service_factory.h" |
41 #include "ios/chrome/browser/history/top_sites_factory.h" | 41 #include "ios/chrome/browser/history/top_sites_factory.h" |
42 #include "ios/chrome/browser/history/web_history_service_factory.h" | 42 #include "ios/chrome/browser/history/web_history_service_factory.h" |
43 #include "ios/chrome/browser/prefs/browser_prefs.h" | 43 #include "ios/chrome/browser/prefs/browser_prefs.h" |
44 #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" | 44 #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" |
45 #include "ios/chrome/browser/sync/glue/sync_start_util.h" | 45 #include "ios/chrome/browser/sync/glue/sync_start_util.h" |
46 #include "ios/chrome/browser/web_data_service_factory.h" | 46 #include "ios/chrome/browser/web_data_service_factory.h" |
| 47 #include "ios/chrome/common/channel_info.h" |
47 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 48 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
48 #include "ios/web/public/web_thread.h" | 49 #include "ios/web/public/web_thread.h" |
49 #include "net/url_request/url_request_test_util.h" | 50 #include "net/url_request/url_request_test_util.h" |
50 | 51 |
51 #if !defined(__has_feature) || !__has_feature(objc_arc) | 52 #if !defined(__has_feature) || !__has_feature(objc_arc) |
52 #error "This file requires ARC support." | 53 #error "This file requires ARC support." |
53 #endif | 54 #endif |
54 | 55 |
55 namespace { | 56 namespace { |
56 std::unique_ptr<KeyedService> BuildHistoryService(web::BrowserState* context) { | 57 std::unique_ptr<KeyedService> BuildHistoryService(web::BrowserState* context) { |
(...skipping 24 matching lines...) Expand all Loading... |
81 NOTREACHED(); | 82 NOTREACHED(); |
82 } | 83 } |
83 | 84 |
84 std::unique_ptr<KeyedService> BuildWebDataService(web::BrowserState* context) { | 85 std::unique_ptr<KeyedService> BuildWebDataService(web::BrowserState* context) { |
85 const base::FilePath& browser_state_path = context->GetStatePath(); | 86 const base::FilePath& browser_state_path = context->GetStatePath(); |
86 return base::MakeUnique<WebDataServiceWrapper>( | 87 return base::MakeUnique<WebDataServiceWrapper>( |
87 browser_state_path, GetApplicationContext()->GetApplicationLocale(), | 88 browser_state_path, GetApplicationContext()->GetApplicationLocale(), |
88 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), | 89 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), |
89 web::WebThread::GetTaskRunnerForThread(web::WebThread::DB), | 90 web::WebThread::GetTaskRunnerForThread(web::WebThread::DB), |
90 ios::sync_start_util::GetFlareForSyncableService(browser_state_path), | 91 ios::sync_start_util::GetFlareForSyncableService(browser_state_path), |
91 &NotReachedErrorCallback); | 92 &NotReachedErrorCallback, GetChannel()); |
92 } | 93 } |
93 | 94 |
94 base::FilePath CreateTempBrowserStateDir(base::ScopedTempDir* temp_dir) { | 95 base::FilePath CreateTempBrowserStateDir(base::ScopedTempDir* temp_dir) { |
95 DCHECK(temp_dir); | 96 DCHECK(temp_dir); |
96 if (!temp_dir->CreateUniqueTempDir()) { | 97 if (!temp_dir->CreateUniqueTempDir()) { |
97 // Fallback logic in case we fail to create unique temporary directory. | 98 // Fallback logic in case we fail to create unique temporary directory. |
98 LOG(ERROR) << "Failed to create unique temporary directory."; | 99 LOG(ERROR) << "Failed to create unique temporary directory."; |
99 base::FilePath system_tmp_dir; | 100 base::FilePath system_tmp_dir; |
100 bool success = PathService::Get(base::DIR_TEMP, &system_tmp_dir); | 101 bool success = PathService::Get(base::DIR_TEMP, &system_tmp_dir); |
101 | 102 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 pref_service_ = std::move(prefs); | 417 pref_service_ = std::move(prefs); |
417 } | 418 } |
418 | 419 |
419 std::unique_ptr<TestChromeBrowserState> | 420 std::unique_ptr<TestChromeBrowserState> |
420 TestChromeBrowserState::Builder::Build() { | 421 TestChromeBrowserState::Builder::Build() { |
421 DCHECK(!build_called_); | 422 DCHECK(!build_called_); |
422 return base::WrapUnique(new TestChromeBrowserState( | 423 return base::WrapUnique(new TestChromeBrowserState( |
423 state_path_, std::move(pref_service_), testing_factories_, | 424 state_path_, std::move(pref_service_), testing_factories_, |
424 refcounted_testing_factories_)); | 425 refcounted_testing_factories_)); |
425 } | 426 } |
OLD | NEW |