OLD | NEW |
1 /** | 1 /** |
2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * We need a STUN server for some API calls. | 8 * We need a STUN server for some API calls. |
9 * @private | 9 * @private |
10 */ | 10 */ |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 peerConnection_().addIceCandidate(new RTCIceCandidate(iceCandidate, | 202 peerConnection_().addIceCandidate(new RTCIceCandidate(iceCandidate, |
203 function() { success_('addIceCandidate'); }, | 203 function() { success_('addIceCandidate'); }, |
204 function(error) { failure_('addIceCandidate', error); } | 204 function(error) { failure_('addIceCandidate', error); } |
205 )); | 205 )); |
206 }); | 206 }); |
207 | 207 |
208 returnToTest('ok-received-candidates'); | 208 returnToTest('ok-received-candidates'); |
209 } | 209 } |
210 | 210 |
211 /** | 211 /** |
| 212 * Sets the mute state of the selected media element. |
| 213 * |
| 214 * Returns ok-muted on success. |
| 215 * |
| 216 * @param elementId The id of the element to mute. |
| 217 * @param muted The mute state to set. |
| 218 */ |
| 219 function setMediaElementMuted(elementId, muted) { |
| 220 var element = document.getElementById(elementId); |
| 221 if (!element) |
| 222 throw failTest('Cannot mute ' + elementId + '; does not exist.'); |
| 223 element.muted = muted; |
| 224 returnToTest('ok-muted'); |
| 225 } |
| 226 |
| 227 /** |
212 * Returns | 228 * Returns |
213 */ | 229 */ |
214 function hasSeenCryptoInSdp() { | 230 function hasSeenCryptoInSdp() { |
215 returnToTest(gHasSeenCryptoInSdp); | 231 returnToTest(gHasSeenCryptoInSdp); |
216 } | 232 } |
217 | 233 |
218 // Internals. | 234 // Internals. |
219 | 235 |
220 /** @private */ | 236 /** @private */ |
221 function createPeerConnection_(stun_server) { | 237 function createPeerConnection_(stun_server) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 function parseJson_(json) { | 324 function parseJson_(json) { |
309 // Escape since the \r\n in the SDP tend to get unescaped. | 325 // Escape since the \r\n in the SDP tend to get unescaped. |
310 jsonWithEscapedLineBreaks = json.replace(/\r\n/g, '\\r\\n'); | 326 jsonWithEscapedLineBreaks = json.replace(/\r\n/g, '\\r\\n'); |
311 try { | 327 try { |
312 return JSON.parse(jsonWithEscapedLineBreaks); | 328 return JSON.parse(jsonWithEscapedLineBreaks); |
313 } catch (exception) { | 329 } catch (exception) { |
314 failTest('Failed to parse JSON: ' + jsonWithEscapedLineBreaks + ', got ' + | 330 failTest('Failed to parse JSON: ' + jsonWithEscapedLineBreaks + ', got ' + |
315 exception); | 331 exception); |
316 } | 332 } |
317 } | 333 } |
OLD | NEW |