OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 - (void)peerConnection:(RTCPeerConnection*)peerConnection | 191 - (void)peerConnection:(RTCPeerConnection*)peerConnection |
192 iceGatheringChanged:(RTCICEGatheringState)newState { | 192 iceGatheringChanged:(RTCICEGatheringState)newState { |
193 // It's fine to get a variable number of GATHERING messages before | 193 // It's fine to get a variable number of GATHERING messages before |
194 // COMPLETE fires (depending on how long the test runs) so we don't assert | 194 // COMPLETE fires (depending on how long the test runs) so we don't assert |
195 // any particular count. | 195 // any particular count. |
196 if (newState == RTCICEGatheringGathering) { | 196 if (newState == RTCICEGatheringGathering) { |
197 return; | 197 return; |
198 } | 198 } |
199 NSAssert([_expectedICEGatheringChanges count] > 0, | |
200 @"Unexpected ICE gathering state change"); | |
201 int expectedState = [self popFirstElementAsInt:_expectedICEGatheringChanges]; | 199 int expectedState = [self popFirstElementAsInt:_expectedICEGatheringChanges]; |
202 NSAssert(expectedState == (int)newState, | 200 NSAssert(expectedState == (int)newState, @"Empty expectation array"); |
203 @"ICE gathering state should match expectation"); | |
204 } | 201 } |
205 | 202 |
206 - (void)peerConnection:(RTCPeerConnection*)peerConnection | 203 - (void)peerConnection:(RTCPeerConnection*)peerConnection |
207 iceConnectionChanged:(RTCICEConnectionState)newState { | 204 iceConnectionChanged:(RTCICEConnectionState)newState { |
208 // See TODO(fischman) in RTCPeerConnectionTest.mm about Completed. | 205 // See TODO(fischman) in RTCPeerConnectionTest.mm about Completed. |
209 if (newState == RTCICEConnectionCompleted) | 206 if (newState == RTCICEConnectionCompleted) |
210 return; | 207 return; |
211 NSAssert([_expectedICEConnectionChanges count] > 0, | |
212 @"Unexpected ICE connection state change"); | |
213 int expectedState = [self popFirstElementAsInt:_expectedICEConnectionChanges]; | 208 int expectedState = [self popFirstElementAsInt:_expectedICEConnectionChanges]; |
214 NSAssert(expectedState == (int)newState, | 209 NSAssert(expectedState == (int)newState, @"Empty expectation array"); |
215 @"ICE connection state should match expectation"); | |
216 } | 210 } |
217 | 211 |
218 - (void)peerConnection:(RTCPeerConnection*)peerConnection | 212 - (void)peerConnection:(RTCPeerConnection*)peerConnection |
219 didOpenDataChannel:(RTCDataChannel*)dataChannel { | 213 didOpenDataChannel:(RTCDataChannel*)dataChannel { |
220 NSString* expectedLabel = | 214 NSString* expectedLabel = |
221 [self popFirstElementAsNSString:_expectedDataChannels]; | 215 [self popFirstElementAsNSString:_expectedDataChannels]; |
222 NSAssert([expectedLabel isEqual:dataChannel.label], | 216 NSAssert([expectedLabel isEqual:dataChannel.label], |
223 @"Data channel not expected"); | 217 @"Data channel not expected"); |
224 self.dataChannel = dataChannel; | 218 self.dataChannel = dataChannel; |
225 dataChannel.delegate = self; | 219 dataChannel.delegate = self; |
(...skipping 22 matching lines...) Expand all Loading... |
248 @"Unexpected message received"); | 242 @"Unexpected message received"); |
249 RTCDataBuffer* expectedBuffer = [_expectedMessages objectAtIndex:0]; | 243 RTCDataBuffer* expectedBuffer = [_expectedMessages objectAtIndex:0]; |
250 NSAssert(expectedBuffer.isBinary == buffer.isBinary, | 244 NSAssert(expectedBuffer.isBinary == buffer.isBinary, |
251 @"Buffer isBinary should match"); | 245 @"Buffer isBinary should match"); |
252 NSAssert([expectedBuffer.data isEqual:buffer.data], | 246 NSAssert([expectedBuffer.data isEqual:buffer.data], |
253 @"Buffer data should match"); | 247 @"Buffer data should match"); |
254 [_expectedMessages removeObjectAtIndex:0]; | 248 [_expectedMessages removeObjectAtIndex:0]; |
255 } | 249 } |
256 | 250 |
257 @end | 251 @end |
OLD | NEW |