test for initialization of video track with getusermedia
authorDominique Hazael-Massieux <dom@w3.org>
Thu, 31 May 2012 16:06:48 +0200
changeset 9 87d86cd71219
parent 8 5e5ad201ecef
child 10 8eaa635ca62c
test for initialization of video track with getusermedia
submitted/W3C/mediastreamtrack-init.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/submitted/W3C/mediastreamtrack-init.html	Thu May 31 16:06:48 2012 +0200
@@ -0,0 +1,37 @@
+<!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:[email protected]"/>
+<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>When prompted, accept to share your video stream.</p>
+<h1>Description</h1>
+<p>This test checks that the video tracks of LocalMediaStream object returned by the success callback in getUserMedia are correctly initialized.</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 the video MediaStreamTrack objects are properly initialized");
+if (window.navigator.getUserMedia) { 
+  navigator.getUserMedia({video: true}, function (stream) {
+  t.step(function () { 
+     for (var i = 0 ; i < stream.videoTracks.length ; i++) {
+        var track = stream.videoTracks[i];
+	assert_true(track instanceof MediaStreamTrack, "The track object #" + i + " is an instance of MediaStreamTrack");
+	assert_equals(track.readyState, track.LIVE, "The track object #" + i + " is in live state");
+	assert_equals(track.kind, "video", "The track object #" + i + " is of video kind");
+	assert_true(track.enabled, "The track object #" + i + " is enabed"); // Not clear that this is required by the spec
+     }
+  });
+  t.done();
+});
+}
+</script>
+</body>
+</html>