diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/mediacapture-streams/MediaStream-idl.https.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/mediacapture-streams/MediaStream-idl.https.html')
-rw-r--r-- | testing/web-platform/tests/mediacapture-streams/MediaStream-idl.https.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/testing/web-platform/tests/mediacapture-streams/MediaStream-idl.https.html b/testing/web-platform/tests/mediacapture-streams/MediaStream-idl.https.html new file mode 100644 index 000000000..81cce51c1 --- /dev/null +++ b/testing/web-platform/tests/mediacapture-streams/MediaStream-idl.https.html @@ -0,0 +1,52 @@ +<!doctype html> +<html> +<head> +<title>MediaStream constructor algorithm</title> +<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/> +<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-MediaStream"> +<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStream-id"> +<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#mediastream"> +<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#event-mediastreamtrack-ended"> +<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStreamTrack-stop-void"> +<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStreamTrack-clone-MediaStreamTrack"> +</head> +<body> +<p class="instructions">When prompted, accept to share your video and audio stream.</p> +<h1 class="instructions">Description</h1> +<p class="instructions">This test checks that the MediaStream constructor +follows the algorithm set in the spec.</p> + +<div id='log'></div> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src="/common/vendor-prefix.js" data-prefixed-objects='[{"ancestors":["navigator"], "name":"getUserMedia"},{"ancestors":["window"], "name":"MediaStream"}]'></script> +<script> +var t = async_test("Tests that a MediaStream constructor follows the algorithm set in the spec", {timeout: 10000}); +t.step(function() { + navigator.getUserMedia({video: true, audio:true}, t.step_func(function (stream) { + var stream1 = new MediaStream(); + assert_not_equals(stream.id, stream1.id, "Two different MediaStreams have different ids"); + var stream2 = new MediaStream(stream); + assert_not_equals(stream.id, stream2.id, "A MediaStream constructed from another have different ids"); + var audioTrack1 = stream.getAudioTracks()[0]; + var videoTrack = stream.getVideoTracks()[0]; + assert_equals(audioTrack1, stream2.getAudioTracks()[0], "A MediaStream constructed from another share the same audio track"); + assert_equals(videoTrack, stream2.getVideoTracks()[0], "A MediaStream constructed from another share the same video track"); + var stream4 = new MediaStream([audioTrack1]); + assert_equals(stream4.getTrackById(audioTrack1.id), audioTrack1, "a non-ended track gets added via the MediaStream constructor"); + + var audioTrack2 = audioTrack1.clone(); + audioTrack2.addEventListener("ended", t.step_func(function () { + var stream3 = new MediaStream([audioTrack2, videoTrack]); + assert_equals(stream3.getTrackById(audioTrack2.id), null, "an ended track doesn't get added via the MediaStream constructor"); + assert_equals(stream3.getTrackById(videoTrack.id), videoTrack, "a non-ended track gets added via the MediaStream constructor even if the previous track was ended"); + var stream5 = new MediaStream([audioTrack2]); + assert_false(stream5.active, "a MediaStream created using the MediaStream() constructor whose arguments are lists of MediaStreamTrack objects that are all ended, the MediaStream object MUST be created with its active attribute set to false"); + t.done(); + }), false); + audioTrack2.stop(); + }), function(error) {}); +}); +</script> +</body> +</html> |