Index: LayoutTests/imported/web-platform-tests/mediacapture-streams/stream-api/mediastream/mediastream-finished-add.html |
diff --git a/LayoutTests/imported/web-platform-tests/mediacapture-streams/stream-api/mediastream/mediastream-finished-add.html b/LayoutTests/imported/web-platform-tests/mediacapture-streams/stream-api/mediastream/mediastream-finished-add.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4621f7ecb531a2ed131ad7dd0ff86ec9906d1d5d |
--- /dev/null |
+++ b/LayoutTests/imported/web-platform-tests/mediacapture-streams/stream-api/mediastream/mediastream-finished-add.html |
@@ -0,0 +1,49 @@ |
+<!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="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-stop-void"> |
+<link rel='stylesheet' href='../../../../../resources/testharness.css' media='all'/> |
+</head> |
+<body> |
+<p class="instructions" style="display:none">When prompted, accept to share your audio stream, then |
+your video stream.</p> |
+<h1 class="instructions" style="display:none">Description</h1> |
+<p class="instructions" style="display:none">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="../../../../../resources/vendor-prefix.js" data-prefixed-objects='[{"ancestors":["navigator"], "name":"getUserMedia"}]'></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> |