Extension syncing: Introduce a NeedsSync pref
[chromium-blink-merge.git] / base / test / ios / wait_util.h
blob01c6fe72bb733c927e06e256986119ab3592e90f
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_TEST_IOS_WAIT_UTIL_H_
6 #define BASE_TEST_IOS_WAIT_UTIL_H_
8 #include "base/ios/block_types.h"
9 #include "base/time/time.h"
11 namespace base {
13 class MessageLoop;
15 namespace test {
16 namespace ios {
18 // Returns the time spent in running |action| plus waiting until |condition| is
19 // met.
20 // Performs |action| and then spins run loop and runs the |message_loop| until
21 // |condition| block returns true.
22 // |action| may be nil if no action needs to be performed before the wait loop.
23 // |message_loop| can be null if there is no need to spin the message loop.
24 // |condition| may be nil if there is no condition to wait for: the run loop
25 // will spin until timeout is reached.
26 // |timeout| parameter sets the maximum wait time. If |timeout| is zero,
27 // a reasonable default will be used.
28 TimeDelta TimeUntilCondition(ProceduralBlock action,
29 ConditionBlock condition,
30 MessageLoop* message_loop,
31 TimeDelta timeout);
33 // Waits until |condition| is met. A |message_loop| to spin and a |timeout| can
34 // be optionally passed; if |timeout| is zero, a reasonable default will be
35 // used.
36 void WaitUntilCondition(ConditionBlock condition,
37 MessageLoop* message_loop,
38 TimeDelta timeout);
39 void WaitUntilCondition(ConditionBlock condition);
41 // Lets the run loop of the current thread process other messages
42 // within the given maximum delay.
43 void SpinRunLoopWithMaxDelay(TimeDelta max_delay);
45 } // namespace ios
46 } // namespace test
47 } // namespace base
49 #endif // BASE_TEST_IOS_WAIT_UTIL_H_