| <!DOCTYPE HTML> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="./resources/getUserMedia-helper.js"></script> |
| <script> |
| var mediaStream; |
| var track; |
| |
| function limitPrecision(value, precision) |
| { |
| if (typeof value === "number" && value % 1 != 0) |
| return value.toFixed(precision); |
| return value; |
| } |
| |
| function listTrackSettings(track) |
| { |
| debug(`${track.kind} track settings:`); |
| settings = track.getSettings(); |
| for (var property in settings) { |
| if (settings.hasOwnProperty(property) || settings.__proto__.hasOwnProperty(property)) { |
| if (property == "deviceId") |
| value = "<UUID>"; |
| else |
| value = limitPrecision(settings[property], 3); |
| debug(` settings.${property} = ${value}`); |
| } |
| } |
| |
| debug(""); |
| } |
| |
| function checkTrackSettings(t) |
| { |
| track = t; |
| |
| capabilities = track.getCapabilities(); |
| settings = track.getSettings(); |
| for (var property in settings) { |
| if (settings.hasOwnProperty(property) || settings.__proto__.hasOwnProperty(property)) { |
| shouldBeTrue(`"${property}" in track.getCapabilities()`); |
| } |
| } |
| } |
| |
| function gotStream(stream) |
| { |
| mediaStream = stream; |
| |
| listTrackSettings(mediaStream.getVideoTracks()[0]); |
| listTrackSettings(mediaStream.getAudioTracks()[0]); |
| |
| debug('According to the spec: "[every setting] MUST be a member of the set defined for that property by getCapabilities()"<br>'); |
| checkTrackSettings(mediaStream.getVideoTracks()[0]); |
| checkTrackSettings(mediaStream.getAudioTracks()[0]); |
| finishJSTest(); |
| } |
| |
| function start() |
| { |
| description("Tests MediaStreamTrack.getSettings."); |
| getUserMedia("allow", {audio:true, video:true}, gotStream); |
| } |
| |
| window.jsTestIsAsync = true; |
| window.successfullyParsed = true; |
| </script> |
| |
| </head> |
| <body onload="start()"> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |