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

Unified Diff: base/test/scoped_task_environment.h

Issue 2860063003: Improve usage documentation of scoped task environments. (Closed)
Patch Set: nits + fix nacl compile 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
Index: base/test/scoped_task_environment.h
diff --git a/base/test/scoped_task_environment.h b/base/test/scoped_task_environment.h
index 2887d0765bacf5753eb4037a8f79931e22e9c022..8ac27e1b1421586de5ec8fcc627ac2115e18ec45 100644
--- a/base/test/scoped_task_environment.h
+++ b/base/test/scoped_task_environment.h
@@ -28,6 +28,23 @@ namespace test {
// Tasks posted through base/task_scheduler/post_task.h run on dedicated threads
// as they are posted.
//
+// Usage:
+//
+// class MyTestFixture : public testing::Test {
+// public:
+// (...)
+//
+// protected:
+// // Must be the first member (or at least before any member that cares
+// // about tasks) to be initialized first and destroyed last. protected
+// // instead of private visibility will allow controlling the task
+// // environment (e.g. clock) once such features are added (see design doc
+// // below for details), until then it at least doesn't hurt :).
+// base::test::ScopedTaskEnvironment scoped_task_environment_;
+//
+// // Other members go here (or further below in private section.)
+// };
+//
// Design and future improvements documented in
// https://docs.google.com/document/d/1QabRo8c7D9LsYY3cEcaPQbOCLo8Tu-6VLykYXyl3Pkk/edit
class ScopedTaskEnvironment {

Powered by Google App Engine
This is Rietveld 408576698