Skip to content

Commit

Permalink
[PTZ] Deny mandatory PTZ constraints in basic getUserMedia constraints
Browse files Browse the repository at this point in the history
This PR makes sure required PTZ constraints in the basic constraint set
are denied (and throw a TypeError) and PTZ capability constraints
({ zoom: true } etc.) are ideal in the basic constraint set.
Therefore, a PTZ constraint in the basic set cannot cause getUserMedia()
to fail conditionally.

Spec:
w3c/mediacapture-image#261
w3c/mediacapture-main#707

Bug: 934063
Change-Id: I7324ae32b064dbf3b89325166834e2694eca593b
  • Loading branch information
beaufortfrancois authored and chromium-wpt-export-bot committed Sep 25, 2020
1 parent 141c517 commit d35c905
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions mediacapture-image/getusermedia.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!doctype html>
<meta charset=utf-8>
<title>getUserMedia</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";

[
{ video: { pan: { min: 1 } } },
{ video: { pan: { max: 1 } } },
{ video: { pan: { exact: 1 } } },
{ video: { tilt: { min: 1 } } },
{ video: { tilt: { max: 1 } } },
{ video: { tilt: { exact: 1 } } },
{ video: { zoom: { min: 1 } } },
{ video: { zoom: { max: 1 } } },
{ video: { zoom: { exact: 1 } } }
].forEach(constraints =>
promise_test(t => {
const promise = navigator.mediaDevices.getUserMedia(constraints);
return promise_rejects_js(t, TypeError, promise);
}, `getUserMedia(${JSON.stringify(constraints)}) must fail with TypeError`)
);

</script>

0 comments on commit d35c905

Please sign in to comment.