summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-init.https.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-init.https.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-init.https.html')
-rw-r--r--testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-init.https.html73
1 files changed, 73 insertions, 0 deletions
diff --git a/testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-init.https.html b/testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-init.https.html
new file mode 100644
index 000000000..3aa12052d
--- /dev/null
+++ b/testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-init.https.html
@@ -0,0 +1,73 @@
+<!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">
+</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/WebIDLParser.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("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 onended;\
+ attribute EventHandler onoverconstrained;\
+ MediaStreamTrack clone ();\
+ void stop ();\
+ MediaTrackCapabilities getCapabilities ();\
+ MediaTrackConstraints getConstraints ();\
+ MediaTrackSettings getSettings ();\
+ Promise<void> applyConstraints (optional MediaTrackConstraints constraints);\
+};");
+
+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];
+ idl_array.add_objects({MediaStreamTrack: ["track"]});
+ idl_array.test();
+ assert_equals(track.readyState, "live", "The track object is in live state");
+ assert_equals(track.kind, "video", "The track object is of video kind");
+ // Not clear that this is required by the spec,
+ // see https://www.w3.org/Bugs/Public/show_bug.cgi?id=22212
+ assert_true(track.enabled, "The track object is enabed");
+ t.done();
+ }), function (error) {});
+});
+</script>
+</body>
+</html>