renamed to match new interfaces
authorDominique Hazael-Massieux <dom@w3.org>
Thu, 30 May 2013 18:55:49 +0200
changeset 50 0566e74f19f9
parent 49 9091b1e5d47e
child 51 cab80ff2fa3b
renamed to match new interfaces
submitted/W3C/mediastream-finished-add.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/submitted/W3C/mediastream-finished-add.html	Thu May 30 18:55:49 2013 +0200
@@ -0,0 +1,47 @@
+<!doctype html>
+<html>
+<head>
+<title>Adding a track to a finished MediaStream</title>
+<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
+<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrackList-add-void-MediaStreamTrack-track">
+<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
+</head>
+<body>
+<p>When prompted, accept to share your audio stream, then your video stream.</p>
+<h1>Description</h1>
+<p>This test checks that adding a track to a finished MediaStream raises an INVALID_STATE_ERR exception.</p>
+
+<div id='log'></div>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=featuredetection.js></script>
+<script src=prefix.js></script>
+<script>
+var t = async_test("Tests that an addition to a finished MediaStream raises an exception", {timeout:20000});
+t.step(function () {
+  var audio, video;
+
+  navigator.getUserMedia({audio:true}, gotAudio, function() {});
+  function gotAudio(stream) {
+    audio = stream;
+    navigator.getUserMedia({video:true}, gotVideo, function() {});
+  }
+
+  function gotVideo(stream) {
+    video = stream;
+    t.step(function () {
+       audio.getAudioTracks()[0].stop();
+       assert_true(audio.ended, "Audio stream is ended after stopping its only audio track");
+       assert_throws("INVALID_STATE_ERR", function () {
+          video.addTrack(audio.getAudioTracks()[0]);
+          }, "Adding a track from a finished stream raises an INVALID_STATE_ERR exception");
+       assert_throws("INVALID_STATE_ERR", function () {
+          audio.removeTrack(audio.getAudioTracks()[0]);
+          }, "Removing a track from a finished stream raises an INVALID_STATE_ERR exception");
+     });
+    t.done();
+  }
+});
+</script>
+</body>
+</html>