OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
5 (Please avoid writing new tests using video-test.js) --> | 5 (Please avoid writing new tests using video-test.js) --> |
6 <script src=video-test.js></script> | 6 <script src=video-test.js></script> |
7 </head> | 7 </head> |
8 <body> | 8 <body> |
9 <p>Verify there is a 'durationchange' event just before 'ended' event if
the initially reported duration exceeds the actual data.</p> | 9 <p>Verify there is a 'durationchange' event just before 'ended' event if
the initially reported duration exceeds the actual data.</p> |
10 <script> | 10 <script> |
11 var initialReportedDuration = -1; | 11 var initialReportedDuration = -1; |
12 | 12 |
13 video = document.createElement('video'); | 13 video = document.createElement('video'); |
14 document.body.appendChild(video); | 14 document.body.appendChild(video); |
15 video.src = "content/truncated.webm"; | 15 video.src = "content/truncated.webm"; |
16 video.play(); | 16 video.play(); |
17 waitForEvent('durationchange', function() { | 17 waitForEvent('durationchange', function() { |
18 // Note the initial reported duration | 18 // Note the initial reported duration |
19 if (initialReportedDuration == -1) | 19 if (initialReportedDuration == -1) |
20 initialReportedDuration = video.duration; | 20 initialReportedDuration = video.duration; |
21 }); | 21 }); |
22 | 22 |
23 waitForEventAndEnd('ended', function() { | 23 waitForEventAndEnd('ended', function() { |
24 // Verify that the actual duration is less than | 24 // Verify that the actual duration is less than |
25 // the initial reported duration | 25 // the initial reported duration |
26 testExpected("video.duration < initialReportedDuration", true); | 26 testExpected("video.duration < initialReportedDuration", true); |
27 }); | 27 }); |
28 </script> | 28 </script> |
29 </body> | 29 </body> |
30 </html> | 30 </html> |
OLD | NEW |