Index: ios/chrome/browser/browser_state/test_chrome_browser_state.mm |
diff --git a/ios/chrome/browser/browser_state/test_chrome_browser_state.mm b/ios/chrome/browser/browser_state/test_chrome_browser_state.mm |
index 1e5dd33a4fce4a0221580300ac34128f77e84d71..37ecd8e95c61617840fd1e3394385da3bc8d6acb 100644 |
--- a/ios/chrome/browser/browser_state/test_chrome_browser_state.mm |
+++ b/ios/chrome/browser/browser_state/test_chrome_browser_state.mm |
@@ -360,9 +360,10 @@ void TestChromeBrowserState::DestroyHistoryService() { |
if (!history_service) |
return; |
+ base::RunLoop run_loop; |
+ |
history_service->ClearCachedDataForContextID(0); |
- history_service->SetOnBackendDestroyTask( |
- base::MessageLoop::QuitWhenIdleClosure()); |
+ history_service->SetOnBackendDestroyTask(run_loop.QuitWhenIdleClosure()); |
history_service->Shutdown(); |
history_service = nullptr; |
@@ -374,13 +375,7 @@ void TestChromeBrowserState::DestroyHistoryService() { |
// moving to the next test. Note: if this never terminates, somebody is |
// probably leaking a reference to the history backend, so it never calls |
// our destroy task. |
- base::MessageLoop::current()->Run(); |
- |
- // Make sure we don't have any event pending that could disrupt the next |
- // test. |
- base::ThreadTaskRunnerHandle::Get()->PostTask( |
- FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
- base::MessageLoop::current()->Run(); |
+ run_loop.Run(); |
} |
syncable_prefs::TestingPrefServiceSyncable* |