| 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 * The one and only peer connection in this page. | 8 * The one and only peer connection in this page. |
| 9 * @private | 9 * @private |
| 10 */ | 10 */ |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 * video codec, e.g. the first one in the list on the 'm=video' SDP offer | 93 * video codec, e.g. the first one in the list on the 'm=video' SDP offer |
| 94 * line. |videoCodec| is the case-sensitive codec name, e.g. 'VP8' or | 94 * line. |videoCodec| is the case-sensitive codec name, e.g. 'VP8' or |
| 95 * 'H264'. | 95 * 'H264'. |
| 96 */ | 96 */ |
| 97 function forceVideoCodec(videoCodec) { | 97 function forceVideoCodec(videoCodec) { |
| 98 gDefaultVideoCodec = videoCodec; | 98 gDefaultVideoCodec = videoCodec; |
| 99 returnToTest('ok-forced'); | 99 returnToTest('ok-forced'); |
| 100 } | 100 } |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * Creates a data channel with the specified label. | |
| 104 * Returns 'ok-created' to test. | |
| 105 */ | |
| 106 function createDataChannel(label) { | |
| 107 peerConnection_().createDataChannel(label); | |
| 108 returnToTest('ok-created'); | |
| 109 } | |
| 110 | |
| 111 /** | |
| 112 * Asks this page to create a local offer. | 103 * Asks this page to create a local offer. |
| 113 * | 104 * |
| 114 * Returns a string on the format ok-(JSON encoded session description). | 105 * Returns a string on the format ok-(JSON encoded session description). |
| 115 * | 106 * |
| 116 * @param {!Object} constraints Any createOffer constraints. | 107 * @param {!Object} constraints Any createOffer constraints. |
| 117 */ | 108 */ |
| 118 function createLocalOffer(constraints) { | 109 function createLocalOffer(constraints) { |
| 119 peerConnection_().createOffer( | 110 peerConnection_().createOffer( |
| 120 function(localOffer) { | 111 function(localOffer) { |
| 121 success('createOffer'); | 112 success('createOffer'); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 function parseJson_(json) { | 413 function parseJson_(json) { |
| 423 // Escape since the \r\n in the SDP tend to get unescaped. | 414 // Escape since the \r\n in the SDP tend to get unescaped. |
| 424 jsonWithEscapedLineBreaks = json.replace(/\r\n/g, '\\r\\n'); | 415 jsonWithEscapedLineBreaks = json.replace(/\r\n/g, '\\r\\n'); |
| 425 try { | 416 try { |
| 426 return JSON.parse(jsonWithEscapedLineBreaks); | 417 return JSON.parse(jsonWithEscapedLineBreaks); |
| 427 } catch (exception) { | 418 } catch (exception) { |
| 428 failTest('Failed to parse JSON: ' + jsonWithEscapedLineBreaks + ', got ' + | 419 failTest('Failed to parse JSON: ' + jsonWithEscapedLineBreaks + ', got ' + |
| 429 exception); | 420 exception); |
| 430 } | 421 } |
| 431 } | 422 } |
| OLD | NEW |