Chromium Code Reviews (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/mediacapture-streams/MediaStream-idl.html

Issue 2086283003: Update web-platform-tests (Closed) Base URL:
Patch Set: Merge branch 'master' into wpt_import Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
1 <!doctype html>
2 <html>
3 <head>
4 <title>MediaStream constructor algorithm</title>
5 <link rel="author" title="Dominique Hazael-Massieux" href=""/>
6 <link rel="help" href=" idl-def-MediaStream">
7 <link rel="help" href=" widl-MediaStream-id">
8 <link rel="help" href=" mediastream">
9 <link rel="help" href=" event-mediastreamtrack-ended">
10 <link rel="help" href=" widl-MediaStreamTrack-stop-void">
11 <link rel="help" href=" widl-MediaStreamTrack-clone-MediaStreamTrack">
12 </head>
13 <body>
14 <p class="instructions">When prompted, accept to share your video and audio stre am.</p>
15 <h1 class="instructions">Description</h1>
16 <p class="instructions">This test checks that the MediaStream constructor
17 follows the algorithm set in the spec.</p>
19 <div id='log'></div>
20 <script src=/resources/testharness.js></script>
21 <script src=/resources/testharnessreport.js></script>
22 <script src="/common/vendor-prefix.js" data-prefixed-objects='[{"ancestors":["na vigator"], "name":"getUserMedia"},{"ancestors":["window"], "name":"MediaStream"} ]'></script>
23 <script>
24 var t = async_test("Tests that a MediaStream constructor follows the algorithm s et in the spec", {timeout: 10000});
25 t.step(function() {
26 navigator.getUserMedia({video: true, audio:true}, t.step_func(function (stream ) {
27 var stream1 = new MediaStream();
28 assert_not_equals(,, "Two different MediaStreams have di fferent ids");
29 var stream2 = new MediaStream(stream);
30 assert_not_equals(,, "A MediaStream constructed from ano ther have different ids");
31 var audioTrack1 = stream.getAudioTracks()[0];
32 var videoTrack = stream.getVideoTracks()[0];
33 assert_equals(audioTrack1, stream2.getAudioTracks()[0], "A MediaStream const ructed from another share the same audio track");
34 assert_equals(videoTrack, stream2.getVideoTracks()[0], "A MediaStream constr ucted from another share the same video track");
35 var stream4 = new MediaStream([audioTrack1]);
36 assert_equals(stream4.getTrackById(, audioTrack1, "a non-ende d track gets added via the MediaStream constructor");
38 var audioTrack2 = audioTrack1.clone();
39 audioTrack2.addEventListener("ended", t.step_func(function () {
40 var stream3 = new MediaStream([audioTrack2, videoTrack]);
41 assert_equals(stream3.getTrackById(, null, "an ended track doesn't get added via the MediaStream constructor");
42 assert_equals(stream3.getTrackById(, videoTrack, "a non-ende d track gets added via the MediaStream constructor even if the previous track wa s ended");
43 var stream5 = new MediaStream([audioTrack2]);
44 assert_false(, "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 f alse");
45 t.done();
46 }), false);
47 audioTrack2.stop();
48 }), function(error) {});
49 });
50 </script>
51 </body>
52 </html>

Powered by Google App Engine
This is Rietveld 408576698