Bug 802326 - test that getUserMedia fails w/required video constraint, regardless of audio. draft
authorJan-Ivar Bruaroey <jib@mozilla.com>
Thu, 05 May 2016 16:11:08 -0400
changeset 364176 656a2913153dbc47903132e5e12b39ed6693c099
parent 364175 81137a888d3e8fb5349236ffee5de618424b43c6
child 364177 94ee40b75b0c69147f7ee54f2ee78e3075de6786
push id17378
push userjbruaroey@mozilla.com
push dateFri, 06 May 2016 02:41:52 +0000
bugs802326
milestone49.0a1
Bug 802326 - test that getUserMedia fails w/required video constraint, regardless of audio. MozReview-Commit-ID: DtvgDGIiZaN
dom/media/tests/mochitest/test_getUserMedia_constraints.html
--- a/dom/media/tests/mochitest/test_getUserMedia_constraints.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_constraints.html
@@ -130,14 +130,21 @@ runTest(function() {
       .then(() => stream.getAudioTracks()[0].applyConstraints({ })))
     .then(() => ok(true, "applyConstraints code exercised"))
     // TODO: Test outcome once fake devices support constraints (Bug 1088621)
     .then(() => mustFailWith("applyConstraints fails on non-Gum tracks",
                              "OverconstrainedError", "",
                              () => (new AudioContext())
                                  .createMediaStreamDestination().stream
                                  .getAudioTracks()[0].applyConstraints()))
+    .then(() => mustFailWith(
+        "getUserMedia with unsatisfied required constraint",
+        "OverconstrainedError", "deviceId",
+        () => navigator.mediaDevices.getUserMedia({
+          audio: true,
+          video: { deviceId: { exact: "unheardof" } },
+        })));
 });
 
 </script>
 </pre>
 </body>
 </html>