13f3856f7e38d176b0f3285407f39a50f2c15789
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / mediacapture-streams / GUM-impossible-constraint.https.html
1 <!doctype html>
2 <html>
3 <head>
4 <title>Trivial mandatory constraint in getUserMedia</title>
5 <link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
6 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
7 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#idl-def-NavigatorUserMediaError">
8 </head>
9 <body>
10 <p class="instructions">When prompted, accept to share your video stream.</p>
11 <h1 class="instructions">Description</h1>
12 <p class="instructions">This test checks that setting an impossible mandatory
13 constraint (width &gt;=1G) in getUserMedia works</p>
14
15 <div id='log'></div>
16 <script src=/resources/testharness.js></script>
17 <script src=/resources/testharnessreport.js></script>
18 <script>
19 var t = async_test("Tests that setting an impossible constraint in getUserMedia fails", {timeout:10000});
20 t.step(function() {
21   // Note - integer conversion is weird for +inf and numbers > 2^32, so we
22   // use a number less than 2^32 for testing.
23   navigator.mediaDevices.getUserMedia({video: {width: {min:100000000}}})
24     .then(t.step_func(function (stream) {
25       assert_unreached("a Video stream of width 100M cannot be created");
26       t.done();
27     }), t.step_func(function(error) {
28       assert_equals(error.name, "OverconstrainedError", "An impossible constraint triggers a OverconstrainedError");
29       assert_equals(error.constraint, "width", "The name of the not satisfied error is given in error.constraint");
30       t.done();
31     }));
32 });
33 </script>
34 </body>
35 </html>