Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Unified Diff: content/public/test/test_browser_thread_bundle.cc

Issue 2769693002: Enable redirection of SequencedWorkerPool to TaskScheduler in TestBrowserThreadBundle. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698