test_seek-7.html (1356B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Media test: seek tests</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 7 <script type="text/javascript" src="manifest.js"></script> 8 <script type="text/javascript" src="seek_support.js"></script> 9 </head> 10 <body> 11 <pre id="test"> 12 <script class="testbody" type="text/javascript"> 13 14 // The data being used in these tests is specified in manifest.js. 15 // The functions to build the test array and to run a specific test are in 16 // seek_support.js. 17 18 const SEEK_TEST_NUMBER = 7; 19 20 function test_seek7(v, seekTime, is, ok, finish) { 21 22 // If a NaN is passed to currentTime, make sure this is caught 23 // otherwise an infinite loop in the Ogg backend occurs. 24 var completed = false; 25 var thrown1 = false; 26 var thrown3 = false; 27 28 function startTest() { 29 if (completed) 30 return; 31 32 try { 33 v.currentTime = NaN; 34 } catch(e) { 35 thrown1 = true; 36 } 37 38 try { 39 v.currentTime = Math.random; 40 } catch(e) { 41 thrown3 = true; 42 } 43 44 completed = true; 45 ok(thrown1, "Setting currentTime to invalid value of NaN"); 46 ok(thrown3, "Setting currentTime to invalid value of a function"); 47 finish(); 48 } 49 50 v.addEventListener("loadedmetadata", startTest); 51 52 } 53 54 manager.runTests(createTestArray(), startTest); 55 56 </script> 57 </pre> 58 </body> 59 </html>