mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,56 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Assigning mediastream to a video element</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#navigatorusermedia">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that the MediaStream object returned by
|
||||
the success callback in getUserMedia can be properly assigned to a video element
|
||||
via the <code>srcObject</code> attribute.</p>
|
||||
|
||||
<video id="vid"></video>
|
||||
|
||||
<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"}]' data-prefixed-prototypes='[{"ancestors":["HTMLMediaElement"],"name":"srcObject"}]'></script>
|
||||
<script>
|
||||
var vid = document.getElementById("vid");
|
||||
var t = async_test("Tests that a MediaStream can be assigned to a video element with srcObject", {timeout: 10000});
|
||||
t.step(function() {
|
||||
navigator.getUserMedia({video: true}, t.step_func(function (stream) {
|
||||
var testOncePlaying = function() {
|
||||
assert_equals(vid.played.length, 1, "A MediaStream's timeline always consists of a single range");
|
||||
assert_equals(vid.played.start(0), 0, "A MediaStream's timeline always consists of a single range");
|
||||
assert_equals(vid.played.end(0), vid.currentTime, "A MediaStream's timeline always consists of a single range");
|
||||
assert_equals(vid.readyState, vid.HAVE_ENOUGH_DATA, "Upon selecting a media stream, the UA sets readyState to HAVE_ENOUGH_DATA");
|
||||
var time = vid.currentTime;
|
||||
assert_throws("INVALID_STATE_ERR", function() {
|
||||
vid.currentTime = 0;
|
||||
});
|
||||
assert_equals(vid.currentTime, time, "The UA MUST ignore attempts to set the currentTime attribute");
|
||||
// TODO add test that duration must be set to currentTime
|
||||
// when mediastream is destroyed
|
||||
vid.removeEventListener("timeupdate", testOncePlaying, false);
|
||||
t.done();
|
||||
}
|
||||
vid.addEventListener("timeupdate", t.step_func(testOncePlaying), false);
|
||||
vid.srcObject = stream;
|
||||
vid.play();
|
||||
assert_true(!vid.seeking, "A MediaStream is not seekable");
|
||||
assert_equals(vid.seekable.length, 0, "A MediaStream is not seekable");
|
||||
assert_equals(vid.defaultPlaybackRate, 1, "playback rate is always 1");
|
||||
assert_equals(vid.playbackRate, 1, "playback rate is always 1");
|
||||
assert_equals(vid.buffered.length, 0, "A MediaStream cannot be preloaded. Therefore, there is no buffered timeranges");
|
||||
assert_equals(vid.duration, Infinity, " A MediaStream does not have a pre-defined duration. ");
|
||||
assert_equals(vid.startDate, NaN, " A MediaStream does not specify a timeline offset");
|
||||
}), function(error) {});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia: test that getUserMedia is present (with or without vendor prefix)</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#navigatorusermedia">
|
||||
<meta name='assert' content='Check that the getUserMedia() method is present.'/>
|
||||
<meta name='flags' content='vendor-prefix, dom'/>
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks for the presence of the
|
||||
<code>navigator.getUserMedia</code> method, taking vendor prefixes into account.</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"}]'></script>
|
||||
<script>
|
||||
test(function () {
|
||||
assert_true(undefined !== navigator.getUserMedia, "navigator.getUserMedia exists");
|
||||
}, "getUserMedia() is present on navigator");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia() triggers error callback when auth is denied</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#error-names">
|
||||
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-MediaStreamError">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, <strong>please deny</strong> access to
|
||||
the video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that the error callback is triggered
|
||||
when user denies access to the video stream.</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that the error callback is triggered when permission is denied", {timeout:10000});
|
||||
t.step(function() {
|
||||
navigator.getUserMedia({video: true}, t.step_func(function (stream) {
|
||||
assert_unreached("The success callback should not be triggered since access is to be denied");
|
||||
t.done();
|
||||
}),
|
||||
t.step_func(function (error) {
|
||||
assert_equals(error.name, "PermissionDeniedError", "Permission denied error returned");
|
||||
assert_equals(error.constraintName, null, "constraintName attribute not set for permission denied");
|
||||
t.done();
|
||||
}));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia({}) aborts with NOT_SUPPORTED_ERR</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-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that getUserMedia with no value in the
|
||||
options parameter raises a NOT_SUPPORTED_ERR exception.</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that getUserMedia raises a NOT_SUPPORTED_ERR exception when used with an empty options parameter");
|
||||
t.step( function () {
|
||||
// TODO This is no longer what's in the spec, see https://www.w3.org/Bugs/Public/show_bug.cgi?id=22211
|
||||
assert_throws("NOT_SUPPORTED_ERR",
|
||||
function () {
|
||||
navigator.getUserMedia({}, t.step_func(function (stream) {
|
||||
assert_unreached("This should never be triggered since the constraints parameter is empty");
|
||||
t.done();
|
||||
}), t.step_func(function (error) {
|
||||
assert_unreached("This should never be triggered since the constraints parameter is empty");
|
||||
}));
|
||||
});
|
||||
t.done();
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Trivial mandatory constraint in getUserMedia</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-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#idl-def-NavigatorUserMediaError">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that setting a trivial mandatory
|
||||
constraint (width >=0) in getUserMedia works</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that setting an impossible constraint in getUserMedia fails", {timeout:10000});
|
||||
t.step(function() {
|
||||
navigator.getUserMedia({video: {mandatory: {width: {min:Infinity}}}}, t.step_func(function (stream) {
|
||||
assert_unreached("a Video stream of infinite width cannot be created");
|
||||
t.done();
|
||||
}), t.step_func(function(error) {
|
||||
assert_equals(error.name, "ConstraintNotSatisfiedError", "An impossible constraint triggers a ConstraintNotSatisfiedError");
|
||||
assert_equals(error.constraintName, "width", "The name of the not satisfied error is given in error.constraintName");
|
||||
t.done();
|
||||
}));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Optional constraint recognized as optional in getUserMedia</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-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that setting an optional constraint in
|
||||
getUserMedia is handled as optional</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that setting an optional constraint in getUserMedia is handled as optional", {timeout:10000});
|
||||
t.step(function() {
|
||||
navigator.getUserMedia({video: {optional: [{width: {min:1024}}, {width: {max: 800}}]}},
|
||||
t.step_func(function (stream) {
|
||||
assert_equals(stream.getVideoTracks().length, 1, "the media stream has exactly one video track");
|
||||
t.done();
|
||||
}),
|
||||
t.step_func(function(error) {
|
||||
assert_unreached("an optional constraint can't stop us from obtaining a video stream");
|
||||
}));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Trivial mandatory constraint in getUserMedia</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-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that setting a trivial mandatory
|
||||
constraint (width >=0) in getUserMedia works</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that setting a trivial mandatory constraint in getUserMedia works", {timeout:10000});
|
||||
t.step(function() {
|
||||
navigator.getUserMedia({video: {mandatory: {width: {min:0}}}}, t.step_func(function (stream) {
|
||||
assert_equals(stream.getVideoTracks().length, 1, "the media stream has exactly one video track");
|
||||
t.done();
|
||||
}), t.step_func(function(error) {
|
||||
assert_unreached("a Video stream of minimally zero width can always be created");
|
||||
t.done();
|
||||
}));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia({doesnotexist:true}) aborts with NOT_SUPPORTED_ERR</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-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that getUserMedia with an unknown value
|
||||
in the options parameter raises a NOT_SUPPORTED_ERR exception.</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"}]'></script>
|
||||
<script>
|
||||
test(function () {
|
||||
// TODO This is no longer what's in the spec, see https://www.w3.org/Bugs/Public/show_bug.cgi?id=22211
|
||||
assert_throws(
|
||||
"NOT_SUPPORTED_ERR",
|
||||
function () {
|
||||
navigator.getUserMedia(
|
||||
{doesnotexist:true},
|
||||
t.step_func(function (stream) {
|
||||
assert_unreached("This should never be triggered since the constraints parameter is unrecognized");
|
||||
}), t.step_func(function (error) {
|
||||
assert_unreached("This should never be triggered since the constraints parameter is unrecognized");
|
||||
}));
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,56 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>A disabled audio track is rendered as silence</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#introduction">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreams-as-media-elements">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your audio stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that a disabled audio track in a
|
||||
MediaStream is rendered as silence. It relies on the
|
||||
<a href="https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html">
|
||||
Web Audio API</a>.</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":"AudioContext"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that a disabled audio track in a MediaStream is rendered as silence", {timeout: 200000});
|
||||
var aud = document.getElementById("aud");
|
||||
t.step(function() {
|
||||
navigator.getUserMedia({audio: true}, t.step_func(function (stream) {
|
||||
var ctx = new AudioContext();
|
||||
var streamSource = ctx.createMediaStreamSource(stream);
|
||||
var silenceDetector = ctx.createScriptProcessor(1024);
|
||||
var count = 10;
|
||||
silenceDetector.onaudioprocess = t.step_func(function (e) {
|
||||
var buffer1 = e.inputBuffer.getChannelData(0);
|
||||
var buffer2 = e.inputBuffer.getChannelData(1);
|
||||
var out = e.outputBuffer.getChannelData(0);
|
||||
out = new Float32Array(buffer1);
|
||||
for (var i = 0; i < buffer1.length; i++) {
|
||||
assert_equals(buffer1[i], 0, "Audio buffer entry #" + i + " in channel 0 is silent");
|
||||
}
|
||||
for (var i = 0; i < buffer2.length; i++) {
|
||||
assert_equals(buffer2[i], 0, "Audio buffer entry #" + i + " in channel 1 is silent");
|
||||
}
|
||||
count--;
|
||||
if (count === 0) {
|
||||
silenceDetector.onaudioprocess = null;
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
stream.getAudioTracks()[0].enabled = false;
|
||||
|
||||
streamSource.connect(silenceDetector);
|
||||
silenceDetector.connect(ctx.destination);
|
||||
}), function(error) {});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,57 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>A disabled video track is rendered as blackness</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#introduction">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreams-as-media-elements">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that a disabled video track in a
|
||||
MediaStream is rendered as blackness.</p>
|
||||
<video id="vid"></video>
|
||||
|
||||
<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"}]' data-prefixed-prototypes='[{"ancestors":["HTMLMediaElement"],"name":"srcObject"}]'></script>
|
||||
<script>
|
||||
var vid = document.getElementById("vid");
|
||||
var cv = document.createElement("canvas");
|
||||
var t = async_test("Tests that a disabled video track in a MediaStream is rendered as blackness", {timeout: 10000});
|
||||
t.step(function() {
|
||||
navigator.getUserMedia(
|
||||
{video: true},
|
||||
t.step_func(function (stream) {
|
||||
var testOncePlaying = function() {
|
||||
if (stream.getVideoTracks()[0].enabled) {
|
||||
stream.getVideoTracks()[0].enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
vid.removeEventListener("timeupdate", testOncePlaying, false);
|
||||
cv.width = vid.offsetWidth;
|
||||
cv.height = vid.offsetHeight;
|
||||
var ctx = cv.getContext("2d");
|
||||
ctx.drawImage(vid,0,0);
|
||||
var imageData = ctx.getImageData(0, 0, cv.width, cv.height);
|
||||
for (var i = 0; i < imageData.data.length; i+=4) {
|
||||
assert_equals(imageData.data[i], 0, "No red component in pixel #" + i);
|
||||
assert_equals(imageData.data[i + 1], 0, "No green component in pixel #" + i);
|
||||
assert_equals(imageData.data[i + 2], 0, "No blue component in pixel #" + i);
|
||||
assert_equals(imageData.data[i + 3], 255, "No transparency in pixel #" + i);
|
||||
}
|
||||
t.done();
|
||||
}
|
||||
vid.srcObject = stream;
|
||||
vid.play();
|
||||
vid.addEventListener("timeupdate", t.step_func(testOncePlaying), false);
|
||||
}),
|
||||
function(error) {});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia({audio:true}) creates a stream with at least an audio track</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-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-kind">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your audio stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that the MediaStream object returned by
|
||||
the success callback in getUserMedia has exactly one audio track.</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 astream;
|
||||
var t = async_test("Tests that a MediaStream with exactly one audio track is returned", {timeout: 10000});
|
||||
t.step(function() {
|
||||
navigator.getUserMedia({audio:true}, t.step_func(function (stream) {
|
||||
astream = stream;
|
||||
assert_true(stream instanceof MediaStream, "getUserMedia success callback comes with a MediaStream object");
|
||||
assert_equals(stream.getAudioTracks().length, 1, "the media stream has exactly one audio track");
|
||||
assert_equals(stream.getAudioTracks()[0].kind, "audio", "getAudioTracks() returns a sequence of tracks whose kind is 'audio'");
|
||||
assert_equals(stream.getVideoTracks().length, 0, "the media stream has zero video track");
|
||||
t.done();
|
||||
}),
|
||||
function(error) {});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,55 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Adding a track to a 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#event-mediastream-addtrack">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your audio stream, then your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that adding a track to a MediaStream works as expected.</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that adding a track to a MediaStream works as expected", {timeout: 20000}); // longer timeout since requires double user interaction
|
||||
t.step(function () {
|
||||
var audio, video;
|
||||
|
||||
navigator.getUserMedia({audio: true}, gotAudio, function(error) {});
|
||||
function gotAudio(stream) {
|
||||
audio = stream;
|
||||
navigator.getUserMedia({video: true}, gotVideo, function(error) {});
|
||||
}
|
||||
|
||||
function gotVideo(stream) {
|
||||
video = stream;
|
||||
t.step(function () {
|
||||
assert_equals(video.getAudioTracks().length, 0, "video mediastream starts with no audio track");
|
||||
video.addTrack(audio.getAudioTracks()[0]);
|
||||
assert_equals(video.getAudioTracks().length, 1, "video mediastream has now one audio track");
|
||||
video.addTrack(audio.getAudioTracks()[0]);
|
||||
assert_equals(video.getAudioTracks().length, 1, "video mediastream still has one audio track"); // If track is already in stream's track set, then abort these steps.
|
||||
|
||||
});
|
||||
audio.onaddtrack = t.step_func(function () {
|
||||
assert_unreached("onaddtrack is not fired when the script directly modified the track of a mediastream");
|
||||
});
|
||||
t.step(function () {
|
||||
assert_equals(audio.getVideoTracks().length, 0, "audio mediastream starts with no video track");
|
||||
audio.addTrack(video.getVideoTracks()[0]);
|
||||
assert_equals(audio.getVideoTracks().length, 1, "audio mediastream now has one video track");
|
||||
});
|
||||
t.step(function () {
|
||||
t.done();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</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">When prompted, accept to share your audio stream, then
|
||||
your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">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="/common/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>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Retrieving a track from a 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-MediaStream-getTrackById-MediaStreamTrack-DOMString-trackId">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that MediaStream.getTrackById behaves as expected</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that MediaStream.getTrackById works as expected", {timeout: 10000});
|
||||
t.step(function () {
|
||||
navigator.getUserMedia(
|
||||
{video: true},
|
||||
t.step_func(gotVideo),
|
||||
t.step_func(function (error) {
|
||||
assert_unreached('Unexpected getUserMedia error: ' + error);
|
||||
}));
|
||||
function gotVideo(stream) {
|
||||
var track = stream.getVideoTracks()[0];
|
||||
assert_equals(track, stream.getTrackById(track.id), "getTrackById returns track of given id");
|
||||
assert_equals(stream.getTrackById(track.id + "foo"), null, "getTrackById of inexistant id returns null");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia() creates a stream with a proper id</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-MediaStream-id">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that the MediaStream object returned by
|
||||
the success callback in getUserMedia has a correct id.</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that a MediaStream with a correct id is returned");
|
||||
var allowedCharacters = /^[\u0021\u0023-\u0027\u002A-\u002B\u002D-\u002E\u0030-\u0039\u0041-\u005A\u005E-\u007E]*$/;
|
||||
if (window.navigator.getUserMedia) {
|
||||
navigator.getUserMedia({video:true}, function (stream) {
|
||||
t.step(function () {
|
||||
assert_true(stream.id.length === 36, "the media stream id has 36 characters");
|
||||
assert_regexp_match(stream.id, allowedCharacters, "the media stream id uses the set of allowed characters");
|
||||
});
|
||||
t.done();
|
||||
}, function(error) {});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,53 @@
|
|||
<!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://dev.w3.org/2011/webrtc/editor/getusermedia.html#idl-def-MediaStream">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStream-id">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastream">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#event-mediastream-ended">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-stop-void">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-clone-MediaStreamTrack">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</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_true(stream5.ended, "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 ended attribute set to true");
|
||||
t.done();
|
||||
}), false);
|
||||
audioTrack2.stop();
|
||||
}), function(error) {});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,49 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Removing a track from a 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-remove-void-MediaStreamTrack-track">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#event-mediastream-removetrack">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your audio stream, then your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that removinging a track from a MediaStream works as expected.</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that a removal from a MediaStream works as expected", {timeout:10000});
|
||||
t.step(function () {
|
||||
var audio;
|
||||
navigator.getUserMedia({audio:true}, gotAudio, function(error) {});
|
||||
function gotAudio(stream) {
|
||||
audio = stream;
|
||||
navigator.getUserMedia({video:true}, gotVideo, function(error) {});
|
||||
}
|
||||
|
||||
function gotVideo(stream) {
|
||||
console.log(stream);
|
||||
var video = stream;
|
||||
console.log(video);
|
||||
video.onremovetrack = function () {
|
||||
assert_unreached("onremovetrack is not triggered when removal of track is triggered by the script itself");
|
||||
};
|
||||
t.step(function () {
|
||||
assert_equals(video.getVideoTracks().length, 1, "video mediastream starts with one video track");
|
||||
video.removeTrack(video.getVideoTracks()[0]);
|
||||
assert_equals(video.getVideoTracks().length, 0, "video mediastream has no video track left");
|
||||
video.removeTrack(audio.getAudioTracks()[0]); // should not throw
|
||||
});
|
||||
t.step(function() {
|
||||
t.done();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia({video:true}) creates a stream with ended set to false</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-MediaStream-ended">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#event-mediastream-ended">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that the MediaStream object returned by
|
||||
the success callback in getUserMedia has a ended set to false at start, and
|
||||
triggers "onended" when it is set to true.</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that a MediaStream handles ended correctly", {timeout:10000});
|
||||
t.step(function () {
|
||||
navigator.getUserMedia({video:true}, t.step_func(function (stream) {
|
||||
assert_true(!stream.ended, "the media stream starts with ended set to false");
|
||||
stream.addEventListener("ended", t.step_func(function() {
|
||||
assert_true(stream.ended, "stream.ended now set to true");
|
||||
t.done();
|
||||
}), false);
|
||||
stream.ended = true;
|
||||
assert_true(!stream.ended, "stream.ended should remain false");
|
||||
stream.getVideoTracks()[0].stop();
|
||||
}), function (error) {});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia({video:true}) creates a stream with one video track</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-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-kind">
|
||||
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that the MediaStream object returned by
|
||||
the success callback in getUserMedia has exactly one video track and no audio.</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 with at least one video track is returned");
|
||||
t.step(function() {
|
||||
navigator.getUserMedia({video: true}, t.step_func(function (stream) {
|
||||
assert_true(stream instanceof MediaStream, "getUserMedia success callback comes with a MediaStream object");
|
||||
assert_equals(stream.getAudioTracks().length, 0, "the media stream has zero audio track");
|
||||
assert_equals(stream.getVideoTracks().length, 1, "the media stream has exactly one video track");
|
||||
assert_equals(stream.getVideoTracks()[0].kind, "video", "getAudioTracks() returns a sequence of tracks whose kind is 'video'");
|
||||
t.done();
|
||||
}), function(error) {});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,40 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test that mediastreamtrack are properly ended</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#mediastreamtrack">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video and audio
|
||||
stream, and then revoke that permission.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that the video and audio tracks of
|
||||
MediaStream object returned by the success callback in getUserMedia are
|
||||
correctly set into ended state when permission is revoked.</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that the video MediaStreamTrack objects are properly ended on permission revocation", {timeout: 20000}); // longer timeout since requires user interaction
|
||||
t.step(function () {
|
||||
navigator.getUserMedia({audio: true,video: true}, t.step_func(function (stream) {
|
||||
var vidTrack = stream.getVideoTracks()[0];
|
||||
assert_equals(vidTrack.readyState, "live", "The video track object is in live state");
|
||||
var audTrack = stream.getAudioTracks()[0];
|
||||
assert_equals(audTrack.readyState, "live", "The audio track object is in live state");
|
||||
vidTrack.onended = t.step_func(function () {
|
||||
assert_equals(vidTrack.readyState, "ended", "Video track has been ended as expected");
|
||||
assert_equals(audTrack.readyState, "ended", "Audio track has been ended as expected");
|
||||
assert_true(stream.ended, "MediaStream has been ended as expected");
|
||||
t.done();
|
||||
});
|
||||
}), function (error) {}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Distinct id for distinct mediastream tracks</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-MediaStreamTrack-id">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your audio and video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that distinct mediastream tracks have distinct ids.</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"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that distinct mediastream tracks have distinct ids ", {timeout: 10000});
|
||||
t.step(function () {
|
||||
navigator.getUserMedia({video: true, audio: true}, t.step_func(gotStream), t.step_func(function(error) {t.assert_unreached("Access to audio and video stream is granted");}));
|
||||
function gotStream(stream) {
|
||||
assert_not_equals(stream.getVideoTracks()[0], stream.getAudioTracks()[0].id, "audio and video tracks have distinct ids");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,77 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>getUserMedia({video:true}) creates a stream with a properly initialized video track</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#idl-def-MediaStreamTrack">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#life-cycle-and-media-flow">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-kind">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-enabled">
|
||||
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-readyState">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
<p class="instructions">When prompted, accept to share your video stream.</p>
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test checks that the video track of MediaStream
|
||||
object returned by the success callback in getUserMedia is correctly initialized.</p>
|
||||
|
||||
<div id='log'></div>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/webidl2/lib/webidl2.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
<script src="/common/vendor-prefix.js" data-prefixed-objects='[{"ancestors":["navigator"], "name":"getUserMedia"}]'></script>
|
||||
<script>
|
||||
var t = async_test("Tests that the video MediaStreamTrack objects are properly initialized", {timeout:10000});
|
||||
var track = null
|
||||
var idl_array = new IdlArray();
|
||||
idl_array.add_idls("interface EventTarget {\
|
||||
void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false);\
|
||||
void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false);\
|
||||
boolean dispatchEvent(Event event);\
|
||||
};");
|
||||
|
||||
/*idl_array.add_idls("callback interface EventListener {\
|
||||
void handleEvent(Event event);\
|
||||
};");*/
|
||||
idl_array.add_idls("interface MediaStreamTrack : EventTarget {\
|
||||
readonly attribute DOMString kind;\
|
||||
readonly attribute DOMString id;\
|
||||
readonly attribute DOMString label;\
|
||||
attribute boolean enabled;\
|
||||
readonly attribute boolean muted;\
|
||||
attribute EventHandler onmute;\
|
||||
attribute EventHandler onunmute;\
|
||||
readonly attribute boolean _readonly;\
|
||||
readonly attribute boolean remote;\
|
||||
readonly attribute MediaStreamTrackState readyState;\
|
||||
attribute EventHandler onstarted;\
|
||||
attribute EventHandler onended;\
|
||||
static sequence<SourceInfo> getSourceInfos ();\
|
||||
MediaTrackConstraints? constraints ();\
|
||||
MediaSourceStates states ();\
|
||||
(AllVideoCapabilities or AllAudioCapabilities) capabilities ();\
|
||||
void applyConstraints (MediaTrackConstraints constraints);\
|
||||
attribute EventHandler onoverconstrained;\
|
||||
MediaStreamTrack clone ();\
|
||||
void stop ();\
|
||||
};");
|
||||
|
||||
t.step(function () {
|
||||
navigator.getUserMedia({video: true}, t.step_func(function (stream) {
|
||||
var videoTracks = stream.getVideoTracks();
|
||||
assert_equals(videoTracks.length, 1, "There is exactly one video track in the media stream");
|
||||
track = videoTracks[0];
|
||||
assert_equals(track.readyState, "live", "The track object is in live state");
|
||||
assert_equals(track.kind, "video", "The track object is of video kind");
|
||||
assert_true(track.enabled, "The track object is enabed"); // Not clear that this is required by the spec, see https://www.w3.org/Bugs/Public/show_bug.cgi?id=22212
|
||||
idl_array.add_objects({MediaStreamTrack: ["track"]});
|
||||
idl_array.test();
|
||||
|
||||
t.done();
|
||||
}), function (error) {});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>AudioStreamTrack is defined</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#idl-def-AudioStreamTrack">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test verifies the availability of the AudioStreamTrack interface.</p>
|
||||
<div id='log'></div>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/webidl2/lib/webidl2.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
<script>
|
||||
var idl_array = new IdlArray();
|
||||
idl_array.add_idls("[Constructor(optional MediaTrackConstraints audioConstraints)]\
|
||||
interface AudioStreamTrack : MediaStreamTrack {\
|
||||
static sequence<DOMString> getSourceIds ();\
|
||||
};");
|
||||
idl_array.test();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>VideoStreamTrack is defined</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#idl-def-VideoStreamTrack">
|
||||
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 class="instructions">Description</h1>
|
||||
<p class="instructions">This test verifies the availability of the VideoStreamTrack interface.</p>
|
||||
<div id='log'></div>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/webidl2/lib/webidl2.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
<script>
|
||||
var idl_array = new IdlArray();
|
||||
idl_array.add_idls("[Constructor(optional MediaTrackConstraints videoConstraints)]\
|
||||
interface VideoStreamTrack : MediaStreamTrack {\
|
||||
static sequence<DOMString> getSourceIds ();\
|
||||
};");
|
||||
idl_array.test();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue