| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return new net::TestURLRequestContextGetter( | 286 return new net::TestURLRequestContextGetter( |
| 287 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO)); | 287 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO)); |
| 288 } | 288 } |
| 289 | 289 |
| 290 net::URLRequestContextGetter* | 290 net::URLRequestContextGetter* |
| 291 TestChromeBrowserState::CreateIsolatedRequestContext( | 291 TestChromeBrowserState::CreateIsolatedRequestContext( |
| 292 const base::FilePath& partition_path) { | 292 const base::FilePath& partition_path) { |
| 293 return nullptr; | 293 return nullptr; |
| 294 } | 294 } |
| 295 | 295 |
| 296 TestChromeBrowserState* TestChromeBrowserState::AsTestChromeBrowserState() { | |
| 297 return this; | |
| 298 } | |
| 299 | |
| 300 void TestChromeBrowserState::CreateWebDataService() { | 296 void TestChromeBrowserState::CreateWebDataService() { |
| 301 ignore_result( | 297 ignore_result( |
| 302 ios::WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 298 ios::WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 303 this, &BuildWebDataService)); | 299 this, &BuildWebDataService)); |
| 304 | 300 |
| 305 // Wait a bit after creating the WebDataService to allow the initialisation | 301 // Wait a bit after creating the WebDataService to allow the initialisation |
| 306 // to complete (otherwise the TestChromeBrowserState may be destroyed before | 302 // to complete (otherwise the TestChromeBrowserState may be destroyed before |
| 307 // initialisation of the database is complete which leads to SQL init errors). | 303 // initialisation of the database is complete which leads to SQL init errors). |
| 308 base::RunLoop run_loop; | 304 base::RunLoop run_loop; |
| 309 run_loop.RunUntilIdle(); | 305 run_loop.RunUntilIdle(); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 pref_service_ = std::move(prefs); | 412 pref_service_ = std::move(prefs); |
| 417 } | 413 } |
| 418 | 414 |
| 419 std::unique_ptr<TestChromeBrowserState> | 415 std::unique_ptr<TestChromeBrowserState> |
| 420 TestChromeBrowserState::Builder::Build() { | 416 TestChromeBrowserState::Builder::Build() { |
| 421 DCHECK(!build_called_); | 417 DCHECK(!build_called_); |
| 422 return base::WrapUnique(new TestChromeBrowserState( | 418 return base::WrapUnique(new TestChromeBrowserState( |
| 423 state_path_, std::move(pref_service_), testing_factories_, | 419 state_path_, std::move(pref_service_), testing_factories_, |
| 424 refcounted_testing_factories_)); | 420 refcounted_testing_factories_)); |
| 425 } | 421 } |
| OLD | NEW |