| Index: media/test/data/decode_capabilities_test.html
|
| diff --git a/media/test/data/decode_capabilities_test.html b/media/test/data/decode_capabilities_test.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6b0191a02d02b3b293c3ad7f97bf695a4ea8d558
|
| --- /dev/null
|
| +++ b/media/test/data/decode_capabilities_test.html
|
| @@ -0,0 +1,72 @@
|
| +<!DOCTYPE html>
|
| +<title>Decode Capabilities Test</title>
|
| +<div id="console"></div>
|
| +<script type='text/javascript'>
|
| + function log(message) {
|
| + let consoleElement = document.getElementById('console');
|
| + let entry = document.createElement('div');
|
| + entry.appendChild(document.createTextNode(message));
|
| + consoleElement.appendChild(entry);
|
| + console.log(message);
|
| + }
|
| +
|
| + function runTest(configuration) {
|
| + try {
|
| + navigator.mediaCapabilities.decodingInfo(configuration)
|
| + .then((result) => {
|
| + log('Decoding is '
|
| + + (result.supported ? '' : 'un') + 'supported');
|
| +
|
| + document.title = result.supported ? 'SUPPORTED' : 'UNSUPPORTED';
|
| + })
|
| + .catch((e) => {
|
| + log('Promise rejected: ' + e);
|
| + document.title = "ERROR";
|
| + });
|
| +
|
| + } catch (e) {
|
| + log('Exception:' + e);
|
| + document.title = "ERROR";
|
| + }
|
| + }
|
| +
|
| + function testVideoDecodeContentType(contentType) {
|
| + // Clear previous test result from title.
|
| + document.title = '';
|
| +
|
| + log("Testing video content type: " + contentType);
|
| +
|
| + const configuration = {
|
| + // TODO(chcunningham): Add tests for type: "media-source".
|
| + type : 'file',
|
| + video : {
|
| + contentType : contentType,
|
| +
|
| + // Any reasonable value will do.
|
| + width : 640,
|
| + height : 480,
|
| + bitrate : 10000,
|
| + framerate : 30
|
| + }
|
| + };
|
| +
|
| + runTest(configuration);
|
| + }
|
| +
|
| + function testAudioDecodeContentType(contentType) {
|
| + // Clear previous test result from title.
|
| + document.title = '';
|
| +
|
| + log("Testing audio content type: " + contentType);
|
| +
|
| + const configuration = {
|
| + // TODO(chcunningham): Add tests for type: "media-source".
|
| + type : 'file',
|
| + audio : {
|
| + contentType : contentType
|
| + }
|
| + };
|
| +
|
| + runTest(configuration);
|
| + }
|
| +</script>
|
|
|