--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/submitted/W3C/mediastreamtracklist-finished.html Thu May 31 19:41:20 2012 +0200
@@ -0,0 +1,43 @@
+<!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");
+if (window.navigator.getUserMedia) {
+ var audio, video;
+
+ navigator.getUserMedia({audio:true}, gotAudio);
+ function gotAudio(stream) {
+ audio = stream;
+ navigator.getUserMedia({video:true}, gotVideo);
+ }
+
+ function gotVideo(stream) {
+ video = stream;
+ t.step(function () {
+ audio.stop();
+ assert_throws("INVALID_STATE_ERR", function () {
+ video.audioTracks.add(audio.audioTracks[0]);
+ }, "Adding a track from a finished stream raises an INVALID_STATE_ERR exception");
+ });
+ t.done();
+ }
+}
+</script>
+</body>
+</html>