| <!doctype html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>video track width and height should be set correctly when only one constraint is passed to getDisplayMedia</title> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="resources/getDisplayMedia-utils.js"></script> |
| </head> |
| <body> |
| |
| <script> |
| let defaultWidth; |
| let defaultHeight; |
| promise_test(async () => { |
| stream = await callGetDisplayMedia({ video: true }); |
| let settings = stream.getVideoTracks()[0].getSettings(); |
| defaultWidth = settings.width; |
| defaultHeight = settings.height; |
| }, "setup"); |
| |
| promise_test((test) => { |
| return callGetDisplayMedia({ video: { width: {ideal: 640} } }) |
| .then((stream) => { |
| let settings = stream.getVideoTracks()[0].getSettings() |
| assert_equals(settings.height, Math.floor(640 * (defaultHeight / defaultWidth))); |
| }) |
| }, "height calculated correctly only width is specified"); |
| |
| promise_test((test) => { |
| |
| return callGetDisplayMedia({ video: { height: {ideal: 240} } }) |
| .then((stream) => { |
| let settings = stream.getVideoTracks()[0].getSettings() |
| assert_equals(settings.width, Math.floor(240 * (defaultWidth / defaultHeight))); |
| }) |
| }, "width calculated correctly only height is specified"); |
| |
| </script> |
| </body> |
| </html> |