OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>MediaCapabilities.decodingInfo()</title> | 2 <title>MediaCapabilities.decodingInfo()</title> |
3 <script src=/resources/testharness.js></script> | 3 <script src=/resources/testharness.js></script> |
4 <script src="/resources/testharnessreport.js"></script> | 4 <script src="/resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 // Minimal VideoConfiguration that will be allowed per spec. All optional | 7 // Minimal VideoConfiguration that will be allowed per spec. All optional |
8 // properties are missing. | 8 // properties are missing. |
9 var minimalVideoConfiguration = { | 9 var minimalVideoConfiguration = { |
10 contentType: 'video/webm; codecs="vp9"', | 10 contentType: 'video/webm; codecs="vp9"', |
(...skipping 18 matching lines...) Expand all Loading... |
29 }, "Test that decodingInfo rejects if the MediaConfiguration isn't valid"); | 29 }, "Test that decodingInfo rejects if the MediaConfiguration isn't valid"); |
30 | 30 |
31 promise_test(t => { | 31 promise_test(t => { |
32 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ | 32 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
33 video: minimalVideoConfiguration, | 33 video: minimalVideoConfiguration, |
34 audio: minimalAudioConfiguration, | 34 audio: minimalAudioConfiguration, |
35 })); | 35 })); |
36 }, "Test that decodingInfo rejects if the MediaConfiguration does not have a typ
e"); | 36 }, "Test that decodingInfo rejects if the MediaConfiguration does not have a typ
e"); |
37 | 37 |
38 promise_test(t => { | 38 promise_test(t => { |
| 39 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 40 type: 'file', |
| 41 })); |
| 42 }, "Test that decodingInfo rejects if the configuration doesn't have an audio or
video field"); |
| 43 |
| 44 promise_test(t => { |
| 45 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 46 type: 'file', |
| 47 video: { |
| 48 contentType: 'video/webm; codecs="vp9"', |
| 49 width: 800, |
| 50 height: 600, |
| 51 bitrate: 3000, |
| 52 framerate: -1, |
| 53 }, |
| 54 })); |
| 55 }, "Test that decodingInfo rejects if the video configuration has a negative fra
merate"); |
| 56 |
| 57 promise_test(t => { |
| 58 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 59 type: 'file', |
| 60 video: { |
| 61 contentType: 'video/webm; codecs="vp9"', |
| 62 width: 800, |
| 63 height: 600, |
| 64 bitrate: 3000, |
| 65 framerate: 0, |
| 66 }, |
| 67 })); |
| 68 }, "Test that decodingInfo rejects if the video configuration has a framerate se
t to 0"); |
| 69 |
| 70 promise_test(t => { |
| 71 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 72 type: 'file', |
| 73 video: { |
| 74 contentType: 'video/webm; codecs="vp9"', |
| 75 width: 800, |
| 76 height: 600, |
| 77 bitrate: 3000, |
| 78 framerate: Infinity, |
| 79 }, |
| 80 })); |
| 81 }, "Test that decodingInfo rejects if the video configuration has a framerate se
t to Infinity"); |
| 82 |
| 83 promise_test(t => { |
| 84 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 85 type: 'file', |
| 86 video: { |
| 87 contentType: 'fgeoa', |
| 88 width: 800, |
| 89 height: 600, |
| 90 bitrate: 3000, |
| 91 framerate: 24, |
| 92 }, |
| 93 })); |
| 94 }, "Test that decodingInfo rejects if the video configuration contentType doesn'
t parse"); |
| 95 |
| 96 promise_test(t => { |
| 97 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 98 type: 'file', |
| 99 video: { |
| 100 contentType: 'audio/fgeoa', |
| 101 width: 800, |
| 102 height: 600, |
| 103 bitrate: 3000, |
| 104 framerate: 24, |
| 105 }, |
| 106 })); |
| 107 }, "Test that decodingInfo rejects if the video configuration contentType isn't
of type video"); |
| 108 |
| 109 promise_test(t => { |
| 110 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 111 type: 'file', |
| 112 video: { |
| 113 contentType: 'video/webm; codecs="vp9"; foo="bar"', |
| 114 width: 800, |
| 115 height: 600, |
| 116 bitrate: 3000, |
| 117 framerate: 24, |
| 118 }, |
| 119 })); |
| 120 }, "Test that decodingInfo rejects if the video configuration contentType has mo
re than one parameter"); |
| 121 |
| 122 promise_test(t => { |
| 123 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 124 type: 'file', |
| 125 video: { |
| 126 contentType: 'video/webm; foo="bar"', |
| 127 width: 800, |
| 128 height: 600, |
| 129 bitrate: 3000, |
| 130 framerate: 24, |
| 131 }, |
| 132 })); |
| 133 }, "Test that decodingInfo rejects if the video configuration contentType has on
e parameter that isn't codecs"); |
| 134 |
| 135 promise_test(t => { |
| 136 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 137 type: 'file', |
| 138 audio: { contentType: 'fgeoa' }, |
| 139 })); |
| 140 }, "Test that decodingInfo rejects if the audio configuration contenType doesn't
parse"); |
| 141 |
| 142 promise_test(t => { |
| 143 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 144 type: 'file', |
| 145 audio: { contentType: 'video/fgeoa' }, |
| 146 })); |
| 147 }, "Test that decodingInfo rejects if the audio configuration contentType isn't
of type audio"); |
| 148 |
| 149 promise_test(t => { |
| 150 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 151 type: 'file', |
| 152 audio: { contentType: 'audio/webm; codecs="opus"; foo="bar"' }, |
| 153 })); |
| 154 }, "Test that decodingInfo rejects if the audio configuration contentType has mo
re than one parameters"); |
| 155 |
| 156 promise_test(t => { |
| 157 return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.decodin
gInfo({ |
| 158 type: 'file', |
| 159 audio: { contentType: 'audio/webm; foo="bar"' }, |
| 160 })); |
| 161 }, "Test that decodingInfo rejects if the audio configuration contentType has on
e parameter that isn't codecs"); |
| 162 |
| 163 promise_test(t => { |
39 return navigator.mediaCapabilities.decodingInfo({ | 164 return navigator.mediaCapabilities.decodingInfo({ |
40 type: 'file', | 165 type: 'file', |
41 video: minimalVideoConfiguration, | 166 video: minimalVideoConfiguration, |
42 audio: minimalAudioConfiguration, | 167 audio: minimalAudioConfiguration, |
43 }).then(ability => { | 168 }).then(ability => { |
44 assert_idl_attribute(ability, 'supported'); | 169 assert_idl_attribute(ability, 'supported'); |
45 assert_idl_attribute(ability, 'smooth'); | 170 assert_idl_attribute(ability, 'smooth'); |
46 assert_idl_attribute(ability, 'powerEfficient'); | 171 assert_idl_attribute(ability, 'powerEfficient'); |
47 }); | 172 }); |
48 }, "Test that decodingInfo returns a valid MediaCapabilitiesInfo objects"); | 173 }, "Test that decodingInfo returns a valid MediaCapabilitiesInfo objects"); |
(...skipping 27 matching lines...) Expand all Loading... |
76 assert_equals(e.name, 'TypeError'); | 201 assert_equals(e.name, 'TypeError'); |
77 ++invalidCaught; | 202 ++invalidCaught; |
78 if (invalidCaught == invalidTypes.length) | 203 if (invalidCaught == invalidTypes.length) |
79 t.done(); | 204 t.done(); |
80 })); | 205 })); |
81 } | 206 } |
82 }), t.unreached_func('Promise.all should not reject for valid types')); | 207 }), t.unreached_func('Promise.all should not reject for valid types')); |
83 }, "Test that decodingInfo rejects if the MediaConfiguration does not have a val
id type"); | 208 }, "Test that decodingInfo rejects if the MediaConfiguration does not have a val
id type"); |
84 | 209 |
85 </script> | 210 </script> |
OLD | NEW |