| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/history/core/test/history_service_test_util.h" | 5 #include "components/history/core/test/history_service_test_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "components/history/core/browser/history_backend.h" | 10 #include "components/history/core/browser/history_backend.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 if (create_db) | 52 if (create_db) |
| 53 BlockUntilHistoryProcessesPendingRequests(history_service.get()); | 53 BlockUntilHistoryProcessesPendingRequests(history_service.get()); |
| 54 return history_service; | 54 return history_service; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void BlockUntilHistoryProcessesPendingRequests( | 57 void BlockUntilHistoryProcessesPendingRequests( |
| 58 HistoryService* history_service) { | 58 HistoryService* history_service) { |
| 59 base::RunLoop run_loop; | 59 base::RunLoop run_loop; |
| 60 base::CancelableTaskTracker tracker; | 60 base::CancelableTaskTracker tracker; |
| 61 history_service->ScheduleDBTask( | 61 history_service->ScheduleDBTask( |
| 62 base::WrapUnique(new QuitTask(run_loop.QuitClosure())), &tracker); | 62 base::MakeUnique<QuitTask>(run_loop.QuitClosure()), &tracker); |
| 63 run_loop.Run(); | 63 run_loop.Run(); |
| 64 | 64 |
| 65 // Spin the runloop again until idle. The QuitTask above is destroyed via a | 65 // Spin the runloop again until idle. The QuitTask above is destroyed via a |
| 66 // task posted to the current message loop, so spinning allows the task to be | 66 // task posted to the current message loop, so spinning allows the task to be |
| 67 // properly destroyed. | 67 // properly destroyed. |
| 68 base::RunLoop().RunUntilIdle(); | 68 base::RunLoop().RunUntilIdle(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace history | 71 } // namespace history |
| OLD | NEW |