OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test MediaKeys::isTypeSupported()</title> | 4 <title>Test MediaKeys::isTypeSupported()</title> |
5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
7 </head> | 7 </head> |
8 <body> | 8 <body> |
9 <div id="log"></div> | 9 <div id="log"></div> |
10 <script> | 10 <script> |
11 // Timeout for all tests to run. | 11 // Timeout for all tests to run. |
12 setup({ timeout: 60000 }); | 12 setup({ timeout: 60000 }); |
13 | 13 |
14 // Generate a distinct test for each type in |types|. | 14 // Generate a distinct test for each type in |types|. |
15 function test_type_support(types, expectation, description) | 15 function test_type_support(types, expectation, description) |
16 { | 16 { |
17 for (var i = 0; i < types.length; ++i) { | 17 for (var i = 0; i < types.length; ++i) { |
18 var type = types[i]; | 18 var type = types[i]; |
19 test(function() | 19 test(function() |
20 { | 20 { |
21 assert_true(type.length == 1 || type.length == 2); | 21 assert_true(type.length == 1 || type.length == 2); |
22 assert_equals(MediaKeys.isTypeSupported.apply( | 22 assert_equals(MediaKeys.isTypeSupported.apply( |
23 this, type), expectation, 'isTypeSupported'); | 23 this, type), expectation, 'isTypeSupported'); |
| 24 if (type.length == 1) { |
| 25 // Calling with undefined as the second argument |
| 26 // should behave same as calling with only one |
| 27 // argument. |
| 28 type.push(undefined); |
| 29 assert_equals(MediaKeys.isTypeSupported.apply( |
| 30 this, type), expectation, 'isTypeSupported'); |
| 31 } |
24 }, description + ": '" + type.join("', '") + "'", | 32 }, description + ": '" + type.join("', '") + "'", |
25 { timeout: 60000 }); | 33 { timeout: 60000 }); |
26 } | 34 } |
27 }; | 35 }; |
28 | 36 |
29 test_type_support([ | 37 test_type_support([ |
30 // Empty key system. | 38 // Empty key system. |
31 [''], | 39 [''], |
32 ['', 'video/webm'], | 40 ['', 'video/webm'], |
33 // Unsupported key system. | 41 // Unsupported key system. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // The actually codec names are case sensitive. | 132 // The actually codec names are case sensitive. |
125 ['org.w3.clearkey', 'video/webm; codecs="Vp8"'], | 133 ['org.w3.clearkey', 'video/webm; codecs="Vp8"'], |
126 ['org.w3.clearkey', 'video/webm; codecs="VP8"'], | 134 ['org.w3.clearkey', 'video/webm; codecs="VP8"'], |
127 // Non-ASCII contentTypes. | 135 // Non-ASCII contentTypes. |
128 ['org.w3.clearkey', 'video/webm\u263A'], | 136 ['org.w3.clearkey', 'video/webm\u263A'], |
129 ['org.w3.clearkey', 'video/webm; codecs="vp8\u263A"'], | 137 ['org.w3.clearkey', 'video/webm; codecs="vp8\u263A"'], |
130 ], false, 'Test Clear Key with invalid contentTypes'); | 138 ], false, 'Test Clear Key with invalid contentTypes'); |
131 </script> | 139 </script> |
132 </body> | 140 </body> |
133 </html> | 141 </html> |
OLD | NEW |