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 /** |
103 * Asks this page to create a local offer. | 112 * Asks this page to create a local offer. |
104 * | 113 * |
105 * Returns a string on the format ok-(JSON encoded session description). | 114 * Returns a string on the format ok-(JSON encoded session description). |
106 * | 115 * |
107 * @param {!Object} constraints Any createOffer constraints. | 116 * @param {!Object} constraints Any createOffer constraints. |
108 */ | 117 */ |
109 function createLocalOffer(constraints) { | 118 function createLocalOffer(constraints) { |
110 peerConnection_().createOffer( | 119 peerConnection_().createOffer( |
111 function(localOffer) { | 120 function(localOffer) { |
112 success('createOffer'); | 121 success('createOffer'); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 function parseJson_(json) { | 422 function parseJson_(json) { |
414 // Escape since the \r\n in the SDP tend to get unescaped. | 423 // Escape since the \r\n in the SDP tend to get unescaped. |
415 jsonWithEscapedLineBreaks = json.replace(/\r\n/g, '\\r\\n'); | 424 jsonWithEscapedLineBreaks = json.replace(/\r\n/g, '\\r\\n'); |
416 try { | 425 try { |
417 return JSON.parse(jsonWithEscapedLineBreaks); | 426 return JSON.parse(jsonWithEscapedLineBreaks); |
418 } catch (exception) { | 427 } catch (exception) { |
419 failTest('Failed to parse JSON: ' + jsonWithEscapedLineBreaks + ', got ' + | 428 failTest('Failed to parse JSON: ' + jsonWithEscapedLineBreaks + ', got ' + |
420 exception); | 429 exception); |
421 } | 430 } |
422 } | 431 } |
OLD | NEW |