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

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

Issue 862693003: Upstream //ios/chrome/browser/snapshots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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..c96e50d55e1e297acd1154c4ec89e0ff283302b4
--- /dev/null
+++ b/base/test/ios/wait_util.h
@@ -0,0 +1,50 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
Paweł Hajdan Jr. 2015/01/30 12:24:29 nit: 2015
+// 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_
+
+#import <Foundation/Foundation.h>
+
+#include "base/ios/block_types.h"
+#include "base/time/time.h"
+
+namespace base {
+
+class MessageLoop;
+
+// 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 not provided,
+// a reasonable default will be used.
+TimeDelta TimeUntilCondition(ProceduralBlock action,
+ ConditionBlock condition,
+ MessageLoop* message_loop,
+ TimeDelta timeout);
+TimeDelta TimeUntilCondition(ProceduralBlock action, ConditionBlock condition);
+
+// Waits until |condition| is met. A |message_loop| to spin and a |timeout| can
+// be optionnally passed.
+void WaitUntilCondition(ConditionBlock condition,
+ MessageLoop* message_loop,
+ TimeDelta timeout);
+void WaitUntilCondition(ConditionBlock condition, MessageLoop* message_loop);
+void WaitUntilCondition(ConditionBlock condition);
+
+// Spins the run loop for |timeout|.
+void Wait(TimeDelta timeout);
+
+// Lets the run loop of the current thread process other messages
+// within the given maximum delay.
+void SpinRunLoopWithMaxDelay(TimeDelta max_delay);
+
+} // namespace base
+
+#endif // BASE_TEST_IOS_WAIT_UTIL_H_
« no previous file with comments | « base/base.gyp ('k') | base/test/ios/wait_util.mm » ('j') | base/test/ios/wait_util.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698