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

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

Issue 2628773003: Add REAL_TASK_SCHEDULER option in TestBrowserThreadBundle. (Closed)
Patch Set: fix build error Created 3 years, 11 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
Index: content/public/test/test_browser_thread_bundle.h
diff --git a/content/public/test/test_browser_thread_bundle.h b/content/public/test/test_browser_thread_bundle.h
index dbb65f95e00ac6c4439f8ae5ab62b6640eea44e6..859c4798f7803c973492875886c83e7e56074fd3 100644
--- a/content/public/test/test_browser_thread_bundle.h
+++ b/content/public/test/test_browser_thread_bundle.h
@@ -25,6 +25,10 @@
// FileDescriptorWatcher. Most of the time, IO_MAINLOOP avoids needing to use a
// REAL_IO_THREAD.
//
+// If a test needs a TaskScheduler that doesn't run its tasks on the main
robliao 2017/01/12 20:15:02 Nit: s/that doesn't run its tasks on the main thre
fdoray 2017/01/12 21:25:56 Done. (dedicated thread instead of threadpool beca
+// thread, it should use REAL_TASK_SCHEDULER. Usage of this option should be
+// justified as it is easier to understand and debug a single-threaded test.
gab 2017/01/12 19:50:27 s/test/unit test/
fdoray 2017/01/12 21:25:56 Done.
+//
// For some tests it is important to emulate real browser startup. During real
// browser startup, the main MessageLoop is created before other threads.
// Passing DONT_START_THREADS to constructor will delay creating other threads
@@ -43,6 +47,7 @@
namespace base {
class MessageLoop;
namespace test {
+class ScopedAsyncTaskScheduler;
class ScopedTaskScheduler;
} // namespace test
} // namespace base
@@ -60,8 +65,9 @@ class TestBrowserThreadBundle {
DEFAULT = 0x00,
IO_MAINLOOP = 0x01,
REAL_DB_THREAD = 0x02,
- REAL_FILE_THREAD = 0x08,
- REAL_IO_THREAD = 0x10,
+ REAL_FILE_THREAD = 0x04,
+ REAL_IO_THREAD = 0x08,
+ REAL_TASK_SCHEDULER = 0x10,
DONT_CREATE_THREADS = 0x20,
gab 2017/01/12 19:50:27 Change 0xFF syntax to 1 << 0 1 << 1 1 << 2 1 <<
robliao 2017/01/12 20:15:02 +1
fdoray 2017/01/12 21:25:56 Done.
};
@@ -78,7 +84,9 @@ class TestBrowserThreadBundle {
void Init();
std::unique_ptr<base::MessageLoop> message_loop_;
- std::unique_ptr<base::test::ScopedTaskScheduler> task_scheduler_;
+ std::unique_ptr<base::test::ScopedAsyncTaskScheduler>
+ scoped_async_task_scheduler_;
+ std::unique_ptr<base::test::ScopedTaskScheduler> scoped_task_scheduler_;
std::unique_ptr<TestBrowserThread> ui_thread_;
std::unique_ptr<TestBrowserThread> db_thread_;
std::unique_ptr<TestBrowserThread> file_thread_;
« no previous file with comments | « no previous file | content/public/test/test_browser_thread_bundle.cc » ('j') | content/public/test/test_browser_thread_bundle.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698