Index: content/public/test/test_browser_thread_bundle.cc |
diff --git a/content/public/test/test_browser_thread_bundle.cc b/content/public/test/test_browser_thread_bundle.cc |
index fa852124094dba6f75e1b1249fbb0ea098237107..6d0d4df247aa903f03e905790b2a0c178f7a84e3 100644 |
--- a/content/public/test/test_browser_thread_bundle.cc |
+++ b/content/public/test/test_browser_thread_bundle.cc |
@@ -10,6 +10,7 @@ |
#include "base/run_loop.h" |
#include "base/task_scheduler/task_scheduler.h" |
#include "base/test/scoped_async_task_scheduler.h" |
+#include "base/threading/sequenced_worker_pool.h" |
#include "content/browser/browser_thread_impl.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/test/test_browser_thread.h" |
@@ -78,6 +79,12 @@ TestBrowserThreadBundle::~TestBrowserThreadBundle() { |
// for DestructionObservers hooked to |message_loop_| to be able to invoke |
// BrowserThread::CurrentlyOn() -- ref. ~TestBrowserThread(). |
message_loop_.reset(); |
+ |
+ // Disable redirection of SequencedWorkerPools to TaskScheduler. This is |
+ // required in order to reset global state so that tests following this one in |
+ // this process can still manage their own SequencedWorkerPool without using |
+ // TestBrowserThreadBundle. |
+ base::SequencedWorkerPool::EnableForProcess(); |
} |
void TestBrowserThreadBundle::Init() { |
@@ -123,6 +130,9 @@ void TestBrowserThreadBundle::CreateThreads() { |
base::MakeUnique<base::test::ScopedAsyncTaskScheduler>(); |
} |
+ // Enable redirection of SequencedWorkerPools to TaskScheduler. |
+ base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess(); |
+ |
if (options_ & REAL_DB_THREAD) { |
db_thread_ = base::MakeUnique<TestBrowserThread>(BrowserThread::DB); |
db_thread_->Start(); |