| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 base::DeleteFile(fallback_dir, true); | 105 base::DeleteFile(fallback_dir, true); |
| 106 base::CreateDirectory(fallback_dir); | 106 base::CreateDirectory(fallback_dir); |
| 107 if (!temp_dir->Set(fallback_dir)) { | 107 if (!temp_dir->Set(fallback_dir)) { |
| 108 // That shouldn't happen, but if it does, try to recover. | 108 // That shouldn't happen, but if it does, try to recover. |
| 109 LOG(ERROR) << "Failed to use a fallback temporary directory."; | 109 LOG(ERROR) << "Failed to use a fallback temporary directory."; |
| 110 | 110 |
| 111 // We're screwed if this fails, see CHECK above. | 111 // We're screwed if this fails, see CHECK above. |
| 112 CHECK(temp_dir->Set(system_tmp_dir)); | 112 CHECK(temp_dir->Set(system_tmp_dir)); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 return temp_dir->path(); | 115 return temp_dir->GetPath(); |
| 116 } | 116 } |
| 117 } // namespace | 117 } // namespace |
| 118 | 118 |
| 119 TestChromeBrowserState::TestChromeBrowserState( | 119 TestChromeBrowserState::TestChromeBrowserState( |
| 120 TestChromeBrowserState* original_browser_state) | 120 TestChromeBrowserState* original_browser_state) |
| 121 : testing_prefs_(nullptr), | 121 : testing_prefs_(nullptr), |
| 122 otr_browser_state_(nullptr), | 122 otr_browser_state_(nullptr), |
| 123 original_browser_state_(original_browser_state) { | 123 original_browser_state_(original_browser_state) { |
| 124 // Not calling Init() here as the bi-directional link between original and | 124 // Not calling Init() here as the bi-directional link between original and |
| 125 // off-the-record TestChromeBrowserState must be established before this | 125 // off-the-record TestChromeBrowserState must be established before this |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 pref_service_ = std::move(prefs); | 414 pref_service_ = std::move(prefs); |
| 415 } | 415 } |
| 416 | 416 |
| 417 std::unique_ptr<TestChromeBrowserState> | 417 std::unique_ptr<TestChromeBrowserState> |
| 418 TestChromeBrowserState::Builder::Build() { | 418 TestChromeBrowserState::Builder::Build() { |
| 419 DCHECK(!build_called_); | 419 DCHECK(!build_called_); |
| 420 return base::WrapUnique(new TestChromeBrowserState( | 420 return base::WrapUnique(new TestChromeBrowserState( |
| 421 state_path_, std::move(pref_service_), testing_factories_, | 421 state_path_, std::move(pref_service_), testing_factories_, |
| 422 refcounted_testing_factories_)); | 422 refcounted_testing_factories_)); |
| 423 } | 423 } |
| OLD | NEW |