| 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 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_ | 5 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_ |
| 6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_ | 6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 const std::string& supervised_user_id, | 171 const std::string& supervised_user_id, |
| 172 std::unique_ptr<policy::PolicyService> policy_service, | 172 std::unique_ptr<policy::PolicyService> policy_service, |
| 173 const TestingFactories& factories, | 173 const TestingFactories& factories, |
| 174 const std::string& profile_name); | 174 const std::string& profile_name); |
| 175 | 175 |
| 176 ~TestingProfile() override; | 176 ~TestingProfile() override; |
| 177 | 177 |
| 178 // Creates the favicon service. Consequent calls would recreate the service. | 178 // Creates the favicon service. Consequent calls would recreate the service. |
| 179 void CreateFaviconService(); | 179 void CreateFaviconService(); |
| 180 | 180 |
| 181 // !!!!!!!! WARNING: THIS IS GENERALLY NOT SAFE TO CALL! !!!!!!!! |
| 182 // This bypasses the BrowserContextDependencyManager, and in particular, it |
| 183 // destroys any previously-created HistoryService. That means any other |
| 184 // KeyedServices that depend on HistoryService may be left with dangling |
| 185 // pointers. |
| 186 // Instead, use Builder::AddTestingFactory to inject your own factories. |
| 187 // !!!!!!!! WARNING: THIS IS GENERALLY NOT SAFE TO CALL! !!!!!!!! |
| 181 // Creates the history service. If |delete_file| is true, the history file is | 188 // Creates the history service. If |delete_file| is true, the history file is |
| 182 // deleted first, then the HistoryService is created. As TestingProfile | 189 // deleted first, then the HistoryService is created. As TestingProfile |
| 183 // deletes the directory containing the files used by HistoryService, this | 190 // deletes the directory containing the files used by HistoryService, this |
| 184 // only matters if you're recreating the HistoryService. If |no_db| is true, | 191 // only matters if you're recreating the HistoryService. If |no_db| is true, |
| 185 // the history backend will fail to initialize its database; this is useful | 192 // the history backend will fail to initialize its database; this is useful |
| 186 // for testing error conditions. Returns true on success. | 193 // for testing error conditions. Returns true on success. |
| 187 bool CreateHistoryService(bool delete_file, bool no_db) WARN_UNUSED_RESULT; | 194 bool CreateHistoryService(bool delete_file, bool no_db) WARN_UNUSED_RESULT; |
| 188 | 195 |
| 196 // !!!!!!!! WARNING: THIS IS GENERALLY NOT SAFE TO CALL! !!!!!!!! |
| 197 // This bypasses the BrowserContextDependencyManager and thus may leave other |
| 198 // KeyedServices with dangling pointers; see above. It's also usually not |
| 199 // necessary to explicitly destroy the HistoryService; it'll be destroyed |
| 200 // along with the TestingProfile anyway. |
| 201 // !!!!!!!! WARNING: THIS IS GENERALLY NOT SAFE TO CALL! !!!!!!!! |
| 189 // Shuts down and nulls out the reference to HistoryService. | 202 // Shuts down and nulls out the reference to HistoryService. |
| 190 void DestroyHistoryService(); | 203 void DestroyHistoryService(); |
| 191 | 204 |
| 192 // Creates the BookmarkBarModel. If not invoked the bookmark bar model is | 205 // Creates the BookmarkBarModel. If not invoked the bookmark bar model is |
| 193 // NULL. If |delete_file| is true, the bookmarks file is deleted first, then | 206 // NULL. If |delete_file| is true, the bookmarks file is deleted first, then |
| 194 // the model is created. As TestingProfile deletes the directory containing | 207 // the model is created. As TestingProfile deletes the directory containing |
| 195 // the files used by HistoryService, the boolean only matters if you're | 208 // the files used by HistoryService, the boolean only matters if you're |
| 196 // recreating the BookmarkModel. | 209 // recreating the BookmarkModel. |
| 197 // | 210 // |
| 198 // NOTE: this does not block until the bookmarks are loaded. For that use | 211 // NOTE: this does not block until the bookmarks are loaded. For that use |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 427 |
| 415 // Weak pointer to a delegate for indicating that a profile was created. | 428 // Weak pointer to a delegate for indicating that a profile was created. |
| 416 Delegate* delegate_; | 429 Delegate* delegate_; |
| 417 | 430 |
| 418 std::string profile_name_; | 431 std::string profile_name_; |
| 419 | 432 |
| 420 std::unique_ptr<policy::PolicyService> policy_service_; | 433 std::unique_ptr<policy::PolicyService> policy_service_; |
| 421 }; | 434 }; |
| 422 | 435 |
| 423 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 436 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
| OLD | NEW |