Chromium Code Reviews| Index: LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html |
| diff --git a/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html b/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html |
| index 06d84bb73efaee4c856cbde775693679717dc156..a48c329218012b55bede6e639b61d01142d7a794 100644 |
| --- a/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html |
| +++ b/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html |
| @@ -8,6 +8,33 @@ |
| description("Tests RTCPeerConnection remoteDescription."); |
| var pc = null; |
| +var local_stream = null; |
| + |
| +function error() { |
| + testFailed('Stream generation failed.'); |
| + finishJSTest(); |
| +} |
| + |
| +function getUserMedia(dictionary, callback) { |
| + try { |
| + navigator.webkitGetUserMedia(dictionary, callback, error); |
| + } catch (e) { |
| + testFailed('webkitGetUserMedia threw exception :' + e); |
| + finishJSTest(); |
| + } |
| +} |
| + |
| +function requestSucceeded3() |
| +{ |
| + testPassed('requestSucceeded was called.'); |
| + shouldBeEqualToNumber('pc.getRemoteStreams().length', 0); |
| + |
| + pc.close(); |
| + shouldBeEqualToString('pc.remoteDescription.type', "offer"); |
| + shouldBeEqualToString('pc.remoteDescription.sdp', "remote"); |
| + |
| + finishJSTest(); |
| +} |
| function requestFailed2() |
|
hta - Chromium
2014/09/29 12:59:17
Nit: Can you rename this to requestFailedAsExpecte
perkj_chrome
2014/09/30 19:15:15
Removed from test. Forked test instead.
|
| { |
| @@ -15,11 +42,9 @@ function requestFailed2() |
| shouldBeEqualToString('pc.remoteDescription.type', "answer"); |
| shouldBeEqualToString('pc.remoteDescription.sdp', "remote"); |
| - pc.close(); |
| - shouldBeEqualToString('pc.remoteDescription.type', "answer"); |
| - shouldBeEqualToString('pc.remoteDescription.sdp', "remote"); |
| - finishJSTest(); |
| + sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"}); |
| + shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded3, requestFailed1);'); |
| } |
| function requestSucceeded2() |
|
hta - Chromium
2014/09/29 12:59:17
Same naming thing here....
|
| @@ -37,14 +62,37 @@ function requestFailed1() |
| function requestSucceeded1() |
| { |
| testPassed('requestSucceeded was called.'); |
| + shouldBeEqualToNumber('pc.getRemoteStreams().length', 1); |
| sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); |
| shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailed2);'); |
| } |
| +function gotStream(stream) { |
| + local_stream = stream; |
| + pc.addStream(local_stream); |
| + |
| + sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"}); |
| + shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, requestFailed1);'); |
| +} |
| + |
| +function onAddStream(event) { |
| + testPassed('remote stream was added'); |
| + shouldBeEqualToNumber('event.stream.getVideoTracks().length', 1); |
| + shouldBeEqualToNumber('event.stream.getAudioTracks().length', 1); |
| + pc.removeStream(local_stream); |
| +} |
| + |
| +function onRemoveStream(event) { |
| + testPassed('remote stream was removed'); |
| + shouldBeEqualToNumber('event.stream.getVideoTracks().length', 0); |
| + shouldBeEqualToNumber('event.stream.getAudioTracks().length', 0); |
| +} |
| + |
| pc = new webkitRTCPeerConnection(null, null); |
| -var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"}); |
| -shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, requestFailed1);'); |
| +pc.onaddstream = onAddStream; |
| +pc.onremovestream = onRemoveStream; |
| +getUserMedia({audio:true, video:true}, gotStream); |
|
hta - Chromium
2014/09/29 12:59:17
Nit: remember the error handler.
perkj_chrome
2014/09/30 19:15:14
getUserMedia is wrapper that handle that.
|
| window.jsTestIsAsync = true; |