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

Unified Diff: base/test/ios/wait_util.h

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 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/ios/wait_util.h
diff --git a/base/test/ios/wait_util.h b/base/test/ios/wait_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..01c6fe72bb733c927e06e256986119ab3592e90f
--- /dev/null
+++ b/base/test/ios/wait_util.h
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_TEST_IOS_WAIT_UTIL_H_
+#define BASE_TEST_IOS_WAIT_UTIL_H_
+
+#include "base/ios/block_types.h"
+#include "base/time/time.h"
+
+namespace base {
+
+class MessageLoop;
+
+namespace test {
+namespace ios {
+
+// Returns the time spent in running |action| plus waiting until |condition| is
+// met.
+// Performs |action| and then spins run loop and runs the |message_loop| until
+// |condition| block returns true.
+// |action| may be nil if no action needs to be performed before the wait loop.
+// |message_loop| can be null if there is no need to spin the message loop.
+// |condition| may be nil if there is no condition to wait for: the run loop
+// will spin until timeout is reached.
+// |timeout| parameter sets the maximum wait time. If |timeout| is zero,
+// a reasonable default will be used.
+TimeDelta TimeUntilCondition(ProceduralBlock action,
+ ConditionBlock condition,
+ MessageLoop* message_loop,
+ TimeDelta timeout);
+
+// Waits until |condition| is met. A |message_loop| to spin and a |timeout| can
+// be optionally passed; if |timeout| is zero, a reasonable default will be
+// used.
+void WaitUntilCondition(ConditionBlock condition,
+ MessageLoop* message_loop,
+ TimeDelta timeout);
+void WaitUntilCondition(ConditionBlock condition);
+
+// Lets the run loop of the current thread process other messages
+// within the given maximum delay.
+void SpinRunLoopWithMaxDelay(TimeDelta max_delay);
+
+} // namespace ios
+} // namespace test
+} // namespace base
+
+#endif // BASE_TEST_IOS_WAIT_UTIL_H_
« no previous file with comments | « base/test/ios/OWNERS ('k') | base/test/ios/wait_util.mm » ('j') | mojo/public/tools/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698