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

Side by Side Diff: content/public/test/test_browser_thread_bundle.h

Issue 2860533002: Support base::test::ScopedTaskEnvironment and content::TestBrowserThreadBundle in the same scope. (Closed)
Patch Set: remove check failed 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/public/test/test_browser_thread_bundle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TestBrowserThreadBundle is a convenience class for creating a set of 5 // TestBrowserThreadBundle is a convenience class for creating a set of
6 // TestBrowserThreads, a blocking pool, and a task scheduler in unit tests. For 6 // TestBrowserThreads, a blocking pool, and a task scheduler in unit tests. For
7 // most tests, it is sufficient to just instantiate the TestBrowserThreadBundle 7 // most tests, it is sufficient to just instantiate the TestBrowserThreadBundle
8 // as a member variable. It is a good idea to put the TestBrowserThreadBundle as 8 // as a member variable. It is a good idea to put the TestBrowserThreadBundle as
9 // the first member variable in test classes, so it is destroyed last, and the 9 // the first member variable in test classes, so it is destroyed last, and the
10 // test threads always exist from the perspective of other classes. 10 // test threads always exist from the perspective of other classes.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // REAL_IO_THREAD. 47 // REAL_IO_THREAD.
48 // 48 //
49 // For some tests it is important to emulate real browser startup. During real 49 // For some tests it is important to emulate real browser startup. During real
50 // browser startup, the main MessageLoop is created before other threads. 50 // browser startup, the main MessageLoop is created before other threads.
51 // Passing DONT_CREATE_THREADS to constructor will delay creating other threads 51 // Passing DONT_CREATE_THREADS to constructor will delay creating other threads
52 // until the test explicitly calls CreateThreads(). 52 // until the test explicitly calls CreateThreads().
53 // 53 //
54 // DONT_CREATE_THREADS should only be used when the options specify at least 54 // DONT_CREATE_THREADS should only be used when the options specify at least
55 // one real thread other than the main thread. 55 // one real thread other than the main thread.
56 // 56 //
57 // TestBrowserThreadBundle may be instantiated in a scope where there is already
58 // a base::test::ScopedTaskEnvironment. In that case, it will use the
59 // MessageLoop and the TaskScheduler provided by this
60 // base::test::ScopedTaskEnvironment instead of creating its own. The ability to
61 // have a base::test::ScopedTaskEnvironment and a TestBrowserThreadBundle in the
62 // same scope is useful when a fixture that inherits from a fixture that
63 // provides a base::test::ScopedTaskEnvironment needs to add support for browser
64 // threads.
65 //
57 // Basic usage: 66 // Basic usage:
58 // 67 //
59 // class MyTestFixture : public testing::Test { 68 // class MyTestFixture : public testing::Test {
60 // public: 69 // public:
61 // (...) 70 // (...)
62 // 71 //
63 // protected: 72 // protected:
64 // // Must be the first member (or at least before any member that cares 73 // // Must be the first member (or at least before any member that cares
65 // // about tasks) to be initialized first and destroyed last. protected 74 // // about tasks) to be initialized first and destroyed last. protected
66 // // instead of private visibility will allow controlling the task 75 // // instead of private visibility will allow controlling the task
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 138
130 int options_; 139 int options_;
131 bool threads_created_; 140 bool threads_created_;
132 141
133 DISALLOW_COPY_AND_ASSIGN(TestBrowserThreadBundle); 142 DISALLOW_COPY_AND_ASSIGN(TestBrowserThreadBundle);
134 }; 143 };
135 144
136 } // namespace content 145 } // namespace content
137 146
138 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_BUNDLE_H_ 147 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_BUNDLE_H_
OLDNEW
« no previous file with comments | « no previous file | content/public/test/test_browser_thread_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698