| Index: third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream.html b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream.html
|
| index 6e8564a6386d135c43a74b532c430d7641274379..9190a62c9af4110421d0bc9cd424888046ee2254 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-AddRemoveStream.html
|
| @@ -1,81 +1,46 @@
|
| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
| <html>
|
| <head>
|
| -<script src="../../resources/js-test.js"></script>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| </head>
|
| <body>
|
| <script>
|
| -description("Tests RTCPeerConnection [add|remove]Stream.");
|
| +var testRTC = async_test('Tests RTCPeerConnection [add|remove]Stream.');
|
|
|
| -var stream = null;
|
| -var stream2 = null;
|
| var pc = 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 onErroneousNegotiationNeeded() {
|
| - testFailed('onErroneousNegotiationNeeded was called.');
|
| - finishJSTest();
|
| -}
|
| -
|
| -function onRemoveStream(event) {
|
| - testPassed('onRemoveStream was called.');
|
| -
|
| - shouldBe('pc.getLocalStreams().length', '0');
|
| -
|
| - finishJSTest();
|
| -}
|
| -
|
| -function onAddStream(event) {
|
| - testPassed('onAddStream was called.');
|
| -
|
| - shouldBe('pc.getStreamById(stream.id)', 'stream');
|
| - shouldBe('pc.getStreamById(stream2.id)', 'null');
|
| -
|
| - pc.onnegotiationneeded = onErroneousNegotiationNeeded;
|
| - pc.addStream(stream);
|
| - shouldBe('pc.getLocalStreams().length', '1');
|
| - pc.removeStream(stream2);
|
| - shouldBe('pc.getLocalStreams().length', '1');
|
| -
|
| - pc.onnegotiationneeded = onRemoveStream;
|
| - pc.removeStream(stream);
|
| -}
|
| -
|
| -function gotStream2(s) {
|
| - testPassed('Got another stream.');
|
| - stream2 = s;
|
| -
|
| - shouldBeFalse("stream.id === stream2.id");
|
| -
|
| - pc = new webkitRTCPeerConnection(null, null);
|
| - pc.onnegotiationneeded = onAddStream;
|
| - pc.addStream(stream);
|
| -}
|
| -
|
| -function gotStream1(s) {
|
| - testPassed('Got a stream.');
|
| - stream = s;
|
| -
|
| - getUserMedia({audio:true, video:true}, gotStream2);
|
| -}
|
| -
|
| -getUserMedia({audio:true, video:true}, gotStream1);
|
| -
|
| -window.jsTestIsAsync = true;
|
| -window.successfullyParsed = true;
|
| +var options = {audio: true, video: true};
|
| +var errorCallback = () => assert_unreached('Stream generation failed.');
|
| +
|
| +navigator.webkitGetUserMedia(options, (stream1) => {
|
| + navigator.webkitGetUserMedia(options, (stream2) => {
|
| + assert_false(stream1.id === stream2.id);
|
| +
|
| + pc = new webkitRTCPeerConnection(null, null);
|
| +
|
| + pc.onnegotiationneeded = (event) => {
|
| + assert_equals(pc.getStreamById(stream1.id), stream1);
|
| + assert_equals(pc.getStreamById(stream2.id), null);
|
| +
|
| + pc.onnegotiationneeded = () => {
|
| + assert_unreached('onErroneousNegotiationNeeded was called.');
|
| + };
|
| +
|
| + pc.addStream(stream1);
|
| + assert_equals(pc.getLocalStreams().length, 1);
|
| + pc.removeStream(stream2);
|
| + assert_equals(pc.getLocalStreams().length, 1);
|
| +
|
| + pc.onnegotiationneeded = (event) => {
|
| + assert_equals(pc.getLocalStreams().length, 0);
|
| + testRTC.done();
|
| + };
|
| + pc.removeStream(stream1);
|
| + };
|
| +
|
| + pc.addStream(stream1);
|
| + }, errorCallback);
|
| +}, errorCallback);
|
| </script>
|
| </body>
|
| </html>
|
|
|