Index: chrome/browser/profiles/profile_browsertest.cc |
diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc |
index 0836d8323d5a70cea15b3c1fb6eb1d6d22e5ded4..2c689385873559b17e91004f91defeaf79c0f905 100644 |
--- a/chrome/browser/profiles/profile_browsertest.cc |
+++ b/chrome/browser/profiles/profile_browsertest.cc |
@@ -18,6 +18,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/sequenced_task_runner.h" |
#include "base/synchronization/waitable_event.h" |
+#include "base/task_scheduler/task_scheduler.h" |
#include "base/values.h" |
#include "base/version.h" |
#include "build/build_config.h" |
@@ -152,6 +153,10 @@ void SpinThreads() { |
content::RunAllPendingInMessageLoop(); |
content::RunAllPendingInMessageLoop(content::BrowserThread::DB); |
content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); |
+ |
+ // This prevents HistoryBackend from accessing its databases after the |
+ // directory that contains them has been deleted. |
+ base::TaskScheduler::GetInstance()->FlushForTesting(); |
} |
// Sends an HttpResponse for requests for "/" that result in sending an HPKP |