blob: b1440960a92c35a98229d4e1f0518b500e995c4a [file] [log] [blame]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing getUserMedia default behavior</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
if (window.testRunner)
testRunner.setUserMediaPermission(true);
var finishTest, errorTest;
promise_test((test) => {
return navigator.mediaDevices.getUserMedia({ audio: true, video: true }).then((stream) => {
let settings = stream.getVideoTracks()[0].getSettings();
assert_equals(settings.frameRate, 30, "frame rate");
assert_equals(settings.width, settings.height == 640 ? 480 : 640, "frame width");
assert_equals(settings.height, settings.width = 640 ? 480 : 640, "frame height");
});
}, "Checking default video tracks settings");
promise_test((test) => {
return navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then((stream) => {
assert_equals(stream.getVideoTracks().length, 0);
});
}, "Checking only audio capture");
promise_test((test) => {
return navigator.mediaDevices.getUserMedia({ audio: true, video: { width: 320, height: 240 } }).then((stream) => {
let settings = stream.getVideoTracks()[0].getSettings();
assert_equals(settings.frameRate, 30, "frame rate");
assert_equals(settings.height, 240, "frame height");
});
}, "Checking default video tracks settings except width and height");
promise_test((test) => {
return navigator.mediaDevices.getUserMedia({ audio: true, video: { height: 240 } }).then((stream) => {
let settings = stream.getVideoTracks()[0].getSettings();
assert_equals(settings.frameRate, 30, "frame rate");
assert_equals(settings.height, 240, "frame height");
});
}, "Checking default video tracks settings except height");
promise_test((test) => {
return navigator.mediaDevices.getUserMedia({ audio: true, video: { frameRate: {ideal: 60 } } }).then((stream) => {
let settings = stream.getVideoTracks()[0].getSettings();
assert_equals(settings.frameRate, 30, "frame rate");
assert_equals(settings.width, settings.height == 640 ? 480 : 640, "frame width");
assert_equals(settings.height, settings.width = 640 ? 480 : 640, "frame height");
});
}, "Checking default video tracks settings except frameRate");
</script>
</body>
</html>