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"); |
199 int expectedState = [self popFirstElementAsInt:_expectedICEGatheringChanges]; | 201 int expectedState = [self popFirstElementAsInt:_expectedICEGatheringChanges]; |
200 NSAssert(expectedState == (int)newState, @"Empty expectation array"); | 202 NSAssert(expectedState == (int)newState, |
| 203 @"ICE gathering state should match expectation"); |
201 } | 204 } |
202 | 205 |
203 - (void)peerConnection:(RTCPeerConnection*)peerConnection | 206 - (void)peerConnection:(RTCPeerConnection*)peerConnection |
204 iceConnectionChanged:(RTCICEConnectionState)newState { | 207 iceConnectionChanged:(RTCICEConnectionState)newState { |
205 // See TODO(fischman) in RTCPeerConnectionTest.mm about Completed. | 208 // See TODO(fischman) in RTCPeerConnectionTest.mm about Completed. |
206 if (newState == RTCICEConnectionCompleted) | 209 if (newState == RTCICEConnectionCompleted) |
207 return; | 210 return; |
| 211 NSAssert([_expectedICEConnectionChanges count] > 0, |
| 212 @"Unexpected ICE connection state change"); |
208 int expectedState = [self popFirstElementAsInt:_expectedICEConnectionChanges]; | 213 int expectedState = [self popFirstElementAsInt:_expectedICEConnectionChanges]; |
209 NSAssert(expectedState == (int)newState, @"Empty expectation array"); | 214 NSAssert(expectedState == (int)newState, |
| 215 @"ICE connection state should match expectation"); |
210 } | 216 } |
211 | 217 |
212 - (void)peerConnection:(RTCPeerConnection*)peerConnection | 218 - (void)peerConnection:(RTCPeerConnection*)peerConnection |
213 didOpenDataChannel:(RTCDataChannel*)dataChannel { | 219 didOpenDataChannel:(RTCDataChannel*)dataChannel { |
214 NSString* expectedLabel = | 220 NSString* expectedLabel = |
215 [self popFirstElementAsNSString:_expectedDataChannels]; | 221 [self popFirstElementAsNSString:_expectedDataChannels]; |
216 NSAssert([expectedLabel isEqual:dataChannel.label], | 222 NSAssert([expectedLabel isEqual:dataChannel.label], |
217 @"Data channel not expected"); | 223 @"Data channel not expected"); |
218 self.dataChannel = dataChannel; | 224 self.dataChannel = dataChannel; |
219 dataChannel.delegate = self; | 225 dataChannel.delegate = self; |
(...skipping 22 matching lines...) Expand all Loading... |
242 @"Unexpected message received"); | 248 @"Unexpected message received"); |
243 RTCDataBuffer* expectedBuffer = [_expectedMessages objectAtIndex:0]; | 249 RTCDataBuffer* expectedBuffer = [_expectedMessages objectAtIndex:0]; |
244 NSAssert(expectedBuffer.isBinary == buffer.isBinary, | 250 NSAssert(expectedBuffer.isBinary == buffer.isBinary, |
245 @"Buffer isBinary should match"); | 251 @"Buffer isBinary should match"); |
246 NSAssert([expectedBuffer.data isEqual:buffer.data], | 252 NSAssert([expectedBuffer.data isEqual:buffer.data], |
247 @"Buffer data should match"); | 253 @"Buffer data should match"); |
248 [_expectedMessages removeObjectAtIndex:0]; | 254 [_expectedMessages removeObjectAtIndex:0]; |
249 } | 255 } |
250 | 256 |
251 @end | 257 @end |
OLD | NEW |