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

Unified Diff: base/test/scoped_task_environment.h

Issue 2860063003: Improve usage documentation of scoped task environments. (Closed)
Patch Set: 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..697a1eddde8e69a1576295617fa9040cfe1430b0 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 first member (or at least before any member that cares about
robliao 2017/05/04 21:54:28 Nit: s/be first/be the first/ Here and in TestBrow
gab 2017/05/04 22:27:41 Done.
+// // 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