| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // Failing a post == leaks == heapcheck failure. Make that an immediate test | 559 // Failing a post == leaks == heapcheck failure. Make that an immediate test |
| 560 // failure. | 560 // failure. |
| 561 if (resource_context_) { | 561 if (resource_context_) { |
| 562 CHECK(BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, | 562 CHECK(BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, |
| 563 resource_context_)); | 563 resource_context_)); |
| 564 resource_context_ = NULL; | 564 resource_context_ = NULL; |
| 565 content::RunAllPendingInMessageLoop(BrowserThread::IO); | 565 content::RunAllPendingInMessageLoop(BrowserThread::IO); |
| 566 } | 566 } |
| 567 | 567 |
| 568 base::ThreadRestrictions::ScopedAllowIO allow_io; | 568 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 569 ignore_result(temp_dir_.Delete()); | 569 if (!temp_dir_.Delete()) { |
| 570 LOG(WARNING) << "Failed to delete temporary directory."; |
| 571 // Make sure |temp_dir_| no longer owns the directory (so it does not try to |
| 572 // delete it in a context where IO is not allowed). |
| 573 ignore_result(temp_dir_.Take()); |
| 574 } |
| 570 } | 575 } |
| 571 | 576 |
| 572 void TestingProfile::CreateFaviconService() { | 577 void TestingProfile::CreateFaviconService() { |
| 573 // It is up to the caller to create the history service if one is needed. | 578 // It is up to the caller to create the history service if one is needed. |
| 574 FaviconServiceFactory::GetInstance()->SetTestingFactory( | 579 FaviconServiceFactory::GetInstance()->SetTestingFactory( |
| 575 this, FaviconServiceFactory::GetDefaultFactory()); | 580 this, FaviconServiceFactory::GetDefaultFactory()); |
| 576 } | 581 } |
| 577 | 582 |
| 578 bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { | 583 bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { |
| 579 DestroyHistoryService(); | 584 DestroyHistoryService(); |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 // Note: Owned by |original_profile|. | 1104 // Note: Owned by |original_profile|. |
| 1100 return new TestingProfile(path_, delegate_, | 1105 return new TestingProfile(path_, delegate_, |
| 1101 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1106 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1102 extension_policy_, | 1107 extension_policy_, |
| 1103 #endif | 1108 #endif |
| 1104 std::move(pref_service_), original_profile, | 1109 std::move(pref_service_), original_profile, |
| 1105 guest_session_, supervised_user_id_, | 1110 guest_session_, supervised_user_id_, |
| 1106 std::move(policy_service_), testing_factories_, | 1111 std::move(policy_service_), testing_factories_, |
| 1107 profile_name_); | 1112 profile_name_); |
| 1108 } | 1113 } |
| OLD | NEW |