| 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 } | |
| 32 }, description + ": '" + type.join("', '") + "'", | 24 }, description + ": '" + type.join("', '") + "'", |
| 33 { timeout: 60000 }); | 25 { timeout: 60000 }); |
| 34 } | 26 } |
| 35 }; | 27 }; |
| 36 | 28 |
| 37 test_type_support([ | 29 test_type_support([ |
| 38 // Empty key system. | 30 // Empty key system. |
| 39 [''], | 31 [''], |
| 40 ['', 'video/webm'], | 32 ['', 'video/webm'], |
| 41 // Unsupported key system. | 33 // Unsupported key system. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // The actually codec names are case sensitive. | 124 // The actually codec names are case sensitive. |
| 133 ['org.w3.clearkey', 'video/webm; codecs="Vp8"'], | 125 ['org.w3.clearkey', 'video/webm; codecs="Vp8"'], |
| 134 ['org.w3.clearkey', 'video/webm; codecs="VP8"'], | 126 ['org.w3.clearkey', 'video/webm; codecs="VP8"'], |
| 135 // Non-ASCII contentTypes. | 127 // Non-ASCII contentTypes. |
| 136 ['org.w3.clearkey', 'video/webm\u263A'], | 128 ['org.w3.clearkey', 'video/webm\u263A'], |
| 137 ['org.w3.clearkey', 'video/webm; codecs="vp8\u263A"'], | 129 ['org.w3.clearkey', 'video/webm; codecs="vp8\u263A"'], |
| 138 ], false, 'Test Clear Key with invalid contentTypes'); | 130 ], false, 'Test Clear Key with invalid contentTypes'); |
| 139 </script> | 131 </script> |
| 140 </body> | 132 </body> |
| 141 </html> | 133 </html> |
| OLD | NEW |