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

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

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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
« no previous file with comments | « base/test/ios/wait_util.h ('k') | base/test/launcher/test_launcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/ios/wait_util.mm
diff --git a/base/test/ios/wait_util.mm b/base/test/ios/wait_util.mm
deleted file mode 100644
index e8b3a0f220cfbe16846e651dacfc56b719a1c213..0000000000000000000000000000000000000000
--- a/base/test/ios/wait_util.mm
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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.
-
-#import "base/test/ios/wait_util.h"
-
-#import <Foundation/Foundation.h>
-
-#include "base/logging.h"
-#include "base/mac/scoped_nsobject.h"
-#include "base/message_loop/message_loop.h"
-#include "base/test/test_timeouts.h"
-#include "base/timer/elapsed_timer.h"
-
-namespace base {
-namespace test {
-namespace ios {
-
-TimeDelta TimeUntilCondition(ProceduralBlock action,
- ConditionBlock condition,
- MessageLoop* message_loop,
- TimeDelta timeout) {
- ElapsedTimer timer;
- if (action)
- action();
- if (timeout == TimeDelta())
- timeout = TestTimeouts::action_timeout();
- const TimeDelta spin_delay(TimeDelta::FromMilliseconds(10));
- while (timer.Elapsed() < timeout && (!condition || !condition())) {
- SpinRunLoopWithMaxDelay(spin_delay);
- if (message_loop) {
- message_loop->RunUntilIdle();
- }
- }
- TimeDelta elapsed = timer.Elapsed();
- // If DCHECK is ever hit, check if |action| is doing something that is
- // taking an unreasonably long time, or if |condition| does not come
- // true quickly enough. Increase |timeout| only if necessary.
- DCHECK(!condition || condition());
- return elapsed;
-}
-
-void WaitUntilCondition(ConditionBlock condition,
- MessageLoop* message_loop,
- TimeDelta timeout) {
- TimeUntilCondition(nil, condition, message_loop, timeout);
-}
-
-void WaitUntilCondition(ConditionBlock condition) {
- WaitUntilCondition(condition, nullptr, TimeDelta());
-}
-
-void SpinRunLoopWithMaxDelay(TimeDelta max_delay) {
- scoped_nsobject<NSDate> beforeDate(
- [[NSDate alloc] initWithTimeIntervalSinceNow:max_delay.InSecondsF()]);
- [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
- beforeDate:beforeDate];
-}
-
-} // namespace ios
-} // namespace test
-} // namespace base
« no previous file with comments | « base/test/ios/wait_util.h ('k') | base/test/launcher/test_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698