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

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

Issue 2523583003: Fix some flaky tests. (Closed)
Patch Set: Undo change in DOMMessageQueue. Created 4 years, 1 month 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 | « content/public/test/test_frame_navigation_observer.cc ('k') | content/public/test/test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_utils.h
diff --git a/content/public/test/test_utils.h b/content/public/test/test_utils.h
index d479eb5afe1a0636b1a8be1db6e412c6c37989e7..e6bbc56298be5394090bb8fe8d50b2780b29b9e4 100644
--- a/content/public/test/test_utils.h
+++ b/content/public/test/test_utils.h
@@ -89,9 +89,19 @@ bool RegisterJniForTesting(JNIEnv* env);
// Helper class to Run and Quit the message loop. Run and Quit can only happen
// once per instance. Make a new instance for each use. Calling Quit after Run
// has returned is safe and has no effect.
+// Note that by default Quit does not quit immediately. If that is not what you
+// really need, pass QuitMode::IMMEDIATE in the constructor.
class MessageLoopRunner : public base::RefCounted<MessageLoopRunner> {
public:
- MessageLoopRunner();
+ enum class QuitMode {
+ // Message loop stops after finishing the current task.
+ IMMEDIATE,
+
+ // Several generations of posted tasks are executed before stopping.
+ DEFERRED,
+ };
+
+ MessageLoopRunner(QuitMode mode = QuitMode::DEFERRED);
// Run the current MessageLoop unless the quit closure
// has already been called.
@@ -113,6 +123,8 @@ class MessageLoopRunner : public base::RefCounted<MessageLoopRunner> {
friend class base::RefCounted<MessageLoopRunner>;
~MessageLoopRunner();
+ QuitMode quit_mode_;
+
// True when the message loop is running.
bool loop_running_;
« no previous file with comments | « content/public/test/test_frame_navigation_observer.cc ('k') | content/public/test/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698