annacc@chromium.org | 334e066 | 2011-11-13 00:47:57 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 | |
| 6 | <script src=../media-file.js></script> |
| 7 | <script src=../video-test.js></script> |
| 8 | <script> |
| 9 | |
| 10 | numberOfTrackTests = 3; |
| 11 | |
| 12 | function trackLoaded() |
| 13 | { |
| 14 | numberOfTracksLoaded++; |
| 15 | if (numberOfTracksLoaded == numberOfTrackTests) { |
| 16 | testTrack(0); |
| 17 | testTrack(1); |
| 18 | testTrackError(2); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | function testTrack(i) |
| 23 | { |
| 24 | findMediaElement(); |
| 25 | var expected = |
| 26 | { |
| 27 | length : 2, |
| 28 | tests: |
| 29 | [ |
| 30 | { |
| 31 | property : "id", |
| 32 | values : [1, 2], |
| 33 | }, |
| 34 | { |
| 35 | property : "startTime", |
| 36 | values : [0.0, 31.0], |
| 37 | }, |
| 38 | { |
| 39 | property : "endTime", |
| 40 | values : [30.5, 1200.5], |
| 41 | }, |
| 42 | { |
eric.carlson@apple.com | 40e816e | 2012-01-10 21:14:23 +0000 | [diff] [blame] | 43 | property : "text", |
annacc@chromium.org | 334e066 | 2011-11-13 00:47:57 +0000 | [diff] [blame] | 44 | values : ["Bear is Coming!!!!!", "I said Bear is coming!!!!"], |
| 45 | }, |
| 46 | ], |
| 47 | }; |
| 48 | testCues(i, expected); |
| 49 | |
| 50 | allTestsEnded(); |
| 51 | } |
| 52 | |
| 53 | function testTrackError(i) |
| 54 | { |
| 55 | findMediaElement(); |
| 56 | var expected = |
| 57 | { |
| 58 | length : 0, |
| 59 | tests: |
| 60 | [], |
| 61 | }; |
| 62 | testCues(i, expected); |
| 63 | |
| 64 | allTestsEnded(); |
| 65 | } |
| 66 | </script> |
| 67 | </head> |
eric.carlson@apple.com | c15ec23 | 2011-12-07 04:04:44 +0000 | [diff] [blame] | 68 | <body onload="enableAllTextTracks()"> |
annacc@chromium.org | 334e066 | 2011-11-13 00:47:57 +0000 | [diff] [blame] | 69 | <p>Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.</p> |
| 70 | <video> |
| 71 | <track src="captions-webvtt/tc004-webvtt-file.vtt" onload="trackLoaded()"> |
| 72 | <track src="captions-webvtt/tc004-webvtt-rubbish.vtt" onload="trackLoaded()"> |
| 73 | <track src="captions-webvtt/tc004-no-webvtt.vtt" onerror="trackLoaded()"> |
| 74 | </video> |
| 75 | </body> |
| 76 | </html> |