Chromium Code Reviews| Index: LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams.html |
| diff --git a/LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams.html b/LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dcebd1bdacef52b69097562b3a7d846aaefcdab2 |
| --- /dev/null |
| +++ b/LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams.html |
| @@ -0,0 +1,80 @@ |
| +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| +<html> |
| +<head> |
| +<script src="../../resources/js-test.js"></script> |
| +</head> |
| +<body> |
| +<script> |
| +description("Tests RTCPeerConnection remote MediaStreams."); |
|
hta - Chromium
2014/10/09 08:07:33
How long should these descriptions be?
I would pr
perkj_chrome
2014/10/21 09:19:57
Done.
|
| + |
| +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 requestSucceeded2() |
| +{ |
| + testPassed('requestSucceeded was called.'); |
| + shouldBeEqualToNumber('pc.getRemoteStreams().length', 0); |
| + finishJSTest(); |
| +} |
| + |
| +function requestSucceeded1() |
| +{ |
| + testPassed('requestSucceeded was called.'); |
| + shouldBeEqualToNumber('pc.getRemoteStreams().length', 1); |
| + |
| + sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"}); |
| + shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailedUnexpected);'); |
| +} |
| + |
| +function requestFailedUnexpected() |
|
hta - Chromium
2014/10/09 08:07:33
English grammar: Unexpectedly
perkj_chrome
2014/10/21 09:19:57
Done.
|
| +{ |
| + testFailed('requestFailed was called.'); |
| + finishJSTest(); |
| +} |
| + |
| +function gotStream(stream) { |
| + local_stream = stream; |
| + pc.addStream(local_stream); |
| + |
| + sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"}); |
| + shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, requestFailedUnexpected);'); |
| +} |
| + |
| +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); |
| +pc.onaddstream = onAddStream; |
| +pc.onremovestream = onRemoveStream; |
| +getUserMedia({audio:true, video:true}, gotStream); |
| + |
| + |
| +window.jsTestIsAsync = true; |
| +window.successfullyParsed = true; |
| +</script> |
| +</body> |
| +</html> |