test that impossible constraint trigger constraint not satisfied
authorDominique Hazael-Massieux <dom@w3.org>
Mon, 03 Jun 2013 18:13:23 +0200
changeset 59 0fbe5befb18a
parent 58 51bcea17cfc2
child 60 9d9159f89306
test that impossible constraint trigger constraint not satisfied
submitted/W3C/getusermedia-impossible-constraint.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/submitted/W3C/getusermedia-impossible-constraint.html	Mon Jun 03 18:13:23 2013 +0200
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+<head>
+<title>Trivial mandatory constraint in getUserMedia</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 setting a trivial mandatory constraint (width &gt;=0) in getUserMedia works</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 setting a trivial mandatory constraint in getUserMedia works", {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();
+  }), function(error) {
+    assert_equals(error.name, "ContraintNotSatisfied");
+    assert_equals(error.constraintName, "width");
+    t.done();
+  });
+});
+</script>
+</body>
+</html>