test for permission denied
authorDominique Hazael-Massieux <dom@w3.org>
Thu, 31 May 2012 21:36:58 +0200
changeset 25 7652f93149c0
parent 24 76158c0e308a
child 26 de85fe3f590f
test for permission denied
submitted/W3C/deny.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/submitted/W3C/deny.html	Thu May 31 21:36:58 2012 +0200
@@ -0,0 +1,37 @@
+<!doctype html>
+<html>
+<head>
+  <title>getUserMedia() triggers error callback when auth is denied</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, <strong>please deny</strong> access to the video stream.</p>
+<h1>Description</h1>
+<p>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=featuredetection.js></script>
+<script src=prefix.js></script>
+<script>
+var t = async_test("Tests that the error callback is triggered when permission is denied");
+if (window.navigator.getUserMedia) { 
+  navigator.getUserMedia({video: true}, function (stream) {
+    t.step(function () {
+      assert_unreached("The success callback should not be triggered since access is to be denied");
+      t.done();
+    });
+  }, function (error) {
+    t.step(function () {
+      console.log(error);
+      assert_equals(error.code, 1, "Error code 1 is returned for permission denied");
+      t.done();
+    });
+  });
+}
+</script>
+</body>
+</html>