DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (c68fe15a81fc)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
<!DOCTYPE html>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<canvas id='canvas' width=10 height=10/>
</body>
</body>
<script>

const constraints = { whiteBalanceMode     : "manual",
                      exposureMode         : "manual",
                      focusMode            : "single-shot",
                      focusMode            : "single-shot",

                      exposureCompensation : 133.77,
                      exposureTime         : 10000, // in nano-seconds.
                      colorTemperature     : 6000,
                      iso                  : 120.0,

                      brightness           : 3,
                      brightness           : 3,
                      contrast             : 4,
                      saturation           : 5,
                      sharpness            : 6,
                      focusDistance        : 7,


                      pan                  : 8,
                      tilt                 : 9,


                      zoom                 : 3.141592
                      // TODO: torch https://crbug.com/700607.
                    };

var canvas = document.getElementById('canvas');
var canvas = document.getElementById('canvas');
var context = canvas.getContext("2d");
context.fillStyle = "red";
context.fillRect(0, 0, 10, 10);

// These tests verify that MediaStreamTrack.getConstraints() exists and that,
// These tests verify that MediaStreamTrack.getConstraints() exists and that,
// returns the constraints passed beforehand with applyConstraints.
var makeAsyncTest = function(c) {
  async_test(function(t) {
    var stream = canvas.captureStream();
    var stream = canvas.captureStream();
    var videoTrack = stream.getVideoTracks()[0];

    const constraintsIn = { advanced : [ c ]};

    // Method applyConstraints() will fail since there is no Image Capture
    // Method applyConstraints() will fail since there is no Image Capture
    // service in this Layout Test, but |constraintsIn| should be cached.
    videoTrack.applyConstraints(constraintsIn)
        .then(() => { /* ignore */ })
        .catch((e) => { /* ignore */ })
        .then(t.step_func(() => {
        .then(t.step_func(() => {
          const constraintsOut = videoTrack.getConstraints();
          assert_object_equals(constraintsOut, constraintsIn, "constraints");
          // Clear constraints by sending an empty constraint set.
          return videoTrack.applyConstraints({})
        }))
        .then(t.step_func(() => {
          const constraintsOut = videoTrack.getConstraints();
          assert_object_equals(constraintsOut, {}, "constraints");
          assert_object_equals(constraintsOut, {}, "constraints");
          t.done();
        }));
  });
};


// Send each line of |constraints| in turn and then the whole dictionary.
for (key in constraints) {
  var one_constraint = {};
  one_constraint[key] = constraints[key];
  generate_tests(
  generate_tests(
      makeAsyncTest,
      [[ 'MediaStreamTrack.getConstraints(), key: ' + key, one_constraint ]]);
}

generate_tests(makeAsyncTest, [[
generate_tests(makeAsyncTest, [[
                 'MediaStreamTrack.getConstraints(), complete ', constraints
               ]]);


</script>
</script>