test mediastream.label
authorDominique Hazael-Massieux <dom@w3.org>
Thu, 31 May 2012 11:44:58 +0200
changeset 4 f80cdb9f4b71
parent 3 a7a3bd0a1445
child 5 471308e99e8c
test mediastream.label
submitted/W3C/stream-label.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/submitted/W3C/stream-label.html	Thu May 31 11:44:58 2012 +0200
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+<head>
+<title>getUserMedia({video:true}) creates a stream with a label</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#navigatorusermedia">
+<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 LocalMediaStream object returned by the success callback in getUserMedia has a correct label.</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 a MediaStream with a correct label 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.label.length === 36, "the media stream label has 36 characters");
+     assert_regexp_match(stream.label, allowedCharacters, "the media stream label uses the set of allowed characters");
+  });
+  t.done();
+});
+}
+</script>
+</body>
+</html>