| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 | 5 |
| 6 <script src=../media-file.js></script> | 6 <script src=../media-file.js></script> |
| 7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 8 (Please avoid writing new tests using video-test.js) --> | 8 (Please avoid writing new tests using video-test.js) --> |
| 9 <script src=../video-test.js></script> | 9 <script src=../video-test.js></script> |
| 10 <script> | 10 <script> |
| 11 var cue; | 11 var cue; |
| 12 var track; | 12 var track; |
| 13 var j = 0; | 13 var j = 0; |
| 14 var cueLimit = 10; | 14 var cueLimit = 10; |
| 15 | 15 |
| 16 function checkNativeProperty() | 16 function checkNativeProperty() |
| 17 { | 17 { |
| 18 cue = this; | 18 cue = this; |
| 19 testExpected("cue.hasOwnProperty('custom')", true); | 19 testExpected("cue.hasOwnProperty('custom')", true); |
| 20 if (++j >= cueLimit) | 20 if (++j >= cueLimit) |
| 21 endTest(); | 21 endTest(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 function startTest() | 24 function startTest() |
| 25 { | 25 { |
| 26 findMediaElement(); | 26 findMediaElement(); |
| 27 video.src = findMediaFile('video', '../content/test'); | 27 video.src = findMediaFile('video', '../content/test'); |
| 28 | 28 |
| 29 video.textTracks.custom = "trackList"; |
| 30 testExpected("video.textTracks.hasOwnProperty('custom')", true); |
| 31 |
| 29 consoleWrite("** Add a text track to the video element **"); | 32 consoleWrite("** Add a text track to the video element **"); |
| 33 |
| 30 track = video.addTextTrack("captions", "regular captions track", "en
"); | 34 track = video.addTextTrack("captions", "regular captions track", "en
"); |
| 31 track.custom = "track"; | 35 track.custom = "track"; |
| 32 testExpected("track.hasOwnProperty('custom')", true); | 36 testExpected("track.hasOwnProperty('custom')", true); |
| 33 | 37 |
| 34 consoleWrite("** Add cues with own native property to the track with
enter event listener. **"); | 38 consoleWrite("** Add cues with own native property to the track with
enter event listener. **"); |
| 35 for (var i = 0; i < cueLimit; i++) { | 39 for (var i = 0; i < cueLimit; i++) { |
| 36 var c = new VTTCue(i / 4, i / 2 + 1, "Label" + i); | 40 var c = new VTTCue(i / 4, i / 2 + 1, "Label" + i); |
| 37 c.custom = "cue"; | 41 c.custom = "cue"; |
| 38 c.addEventListener("enter", checkNativeProperty); | 42 c.addEventListener("enter", checkNativeProperty); |
| 39 track.addCue(c); | 43 track.addCue(c); |
| 44 c = null; |
| 40 } | 45 } |
| 41 for (var i = 0; i < 10; i++) { | 46 for (var i = 0; i < 10; i++) { |
| 42 cue = track.cues[i]; | 47 cue = track.cues[i]; |
| 43 testExpected("cue.hasOwnProperty('custom')", true); | 48 testExpected("cue.hasOwnProperty('custom')", true); |
| 44 } | 49 } |
| 45 | 50 |
| 46 consoleWrite(""); | 51 consoleWrite(""); |
| 47 consoleWrite("** Trigger a garbage collection. **"); | 52 consoleWrite("** Trigger a garbage collection. **"); |
| 48 track = null; | 53 track = null; |
| 54 cue = null; |
| 49 gc(); | 55 gc(); |
| 56 |
| 57 testExpected("video.textTracks.hasOwnProperty('custom')", true); |
| 58 |
| 50 track = video.textTracks[0]; | 59 track = video.textTracks[0]; |
| 51 testExpected("track.hasOwnProperty('custom')", true); | 60 testExpected("track.hasOwnProperty('custom')", true); |
| 52 | 61 |
| 53 consoleWrite(""); | 62 consoleWrite(""); |
| 54 consoleWrite("** Play the video and test cue wrappers. **"); | 63 consoleWrite("** Play the video and test cue wrappers. **"); |
| 55 run("video.play()"); | 64 run("video.play()"); |
| 56 track.mode = "showing"; | 65 track.mode = "showing"; |
| 57 } | 66 } |
| 58 </script> | 67 </script> |
| 59 </head> | 68 </head> |
| 60 | 69 |
| 61 <body onload="startTest()"> | 70 <body onload="startTest()"> |
| 62 <p>Tests that added cue object wrappers live across garbage collections.
</p> | 71 <p>Tests that added cue object wrappers live across garbage collections.
</p> |
| 63 <video controls /> | 72 <video controls /> |
| 64 </body> | 73 </body> |
| 65 </html> | 74 </html> |
| OLD | NEW |