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

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: Use NSTimeInterval instead of int, and constant instead of define. 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..2f9f35fa60bc3ecfb9de36723bc2b191adc0d16f 100644
--- a/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m
+++ b/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m
@@ -139,14 +139,19 @@
[_expectedMessages addObject:buffer];
}
-- (void)waitForAllExpectationsToBeSatisfied {
+- (BOOL)waitForAllExpectationsToBeSatisfiedWithTimeout:(NSTimeInterval)timeout {
tkchin_webrtc 2015/09/25 19:51:04 might want to NSParameterAssert(timeout >= 0); or
// 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 *endTime = [NSDate dateWithTimeIntervalSinceNow:timeout];
tkchin_webrtc 2015/09/25 19:51:04 nit: dot syntax for properties. Also, consider usi
while (![self areAllExpectationsSatisfied]) {
+ if ([endTime timeIntervalSinceNow] < 0) {
+ return NO;
+ }
[[NSRunLoop currentRunLoop]
runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
}
+ return YES;
}
#pragma mark - RTCPeerConnectionDelegate methods

Powered by Google App Engine
This is Rietveld 408576698