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

Unified Diff: talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m

Issue 1361213002: Adding 20-second timeout to Java and Objective-C tests. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removing redundant stack trace for timeout. Created 5 years, 3 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: talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m
diff --git a/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m b/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m
index 5070b789b899bcec92fa0e9a1854824eabd26367..79014f15ddffed269462d9886c2f4f1bcbaf24cc 100644
--- a/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m
+++ b/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m
@@ -139,14 +139,20 @@
[_expectedMessages addObject:buffer];
}
-- (void)waitForAllExpectationsToBeSatisfied {
+- (BOOL)waitForAllExpectationsToBeSatisfiedWithTimeout:(NSTimeInterval)timeout {
+ NSParameterAssert(timeout >= 0);
// TODO (fischman): Revisit. Keeping in sync with the Java version, but
// polling is not optimal.
// https://code.google.com/p/libjingle/source/browse/trunk/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java?line=212#212
+ NSDate *startTime = [NSDate date];
while (![self areAllExpectationsSatisfied]) {
+ if (startTime.timeIntervalSinceNow < -timeout) {
+ return NO;
+ }
[[NSRunLoop currentRunLoop]
runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
}
+ return YES;
}
#pragma mark - RTCPeerConnectionDelegate methods
« no previous file with comments | « talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.h ('k') | talk/app/webrtc/objctests/RTCPeerConnectionTest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698