chromium/third_party/blink/web_tests/fast/mediastream/getusermedia-promise.html

<!DOCTYPE HTML>
<html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<script>

promise_test(function() {
  assert_idl_attribute(navigator, 'mediaDevices');
  assert_idl_attribute(navigator.mediaDevices, 'getUserMedia');

  return navigator.mediaDevices.getUserMedia({audio: true}).then(function(s) {
    assert_equals(s.getTracks().length, 1);
  });
}, 'getUserMedia() audio track');

promise_test(function() {
  assert_idl_attribute(navigator, 'mediaDevices');
  assert_idl_attribute(navigator.mediaDevices, 'getUserMedia');

  return navigator.mediaDevices.getUserMedia({audio: true, video:true})
      .then(function(s) {
    assert_equals(s.getTracks().length, 2);
    assert_equals(s.getAudioTracks().length, 1);
    assert_equals(s.getVideoTracks().length, 1);
  });
}, 'getUserMedia() audio and video tracks');

promise_test(async () => {
  await navigator.mediaDevices.getUserMedia(
      {audio: {'mandatory': { 'valid_but_unsupported_1': 0}}});
}, 'getUserMedia() with unsupported mandatory constraint does not throw');


</script>
</body>
</html>