Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: LayoutTests/media/track/track-cue-gc-wrapper.html

Issue 242113012: Make text track and cue wrapper objects dependent on their media element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tidy up code in places Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 var cue;
10 var track;
11 var j = 0;
12 var cueLimit = 10;
13
14 function checkNativeProperty()
15 {
16 cue = this;
17 testExpected("cue.hasOwnProperty('custom')", true);
18 if (++j >= cueLimit)
19 endTest();
20 }
21
22 function startTest()
23 {
24 findMediaElement();
25 video.src = findMediaFile('video', '../content/test');
26
27 consoleWrite("** Add a text track to the video element **");
28 track = video.addTextTrack("captions", "regular captions track", "en ");
29 track.custom = "track";
30 testExpected("track.hasOwnProperty('custom')", true);
31
32 consoleWrite("** Add cues with own native property to the track with enter event listener. **");
33 for (var i = 0; i < cueLimit; i++) {
34 var c = new VTTCue(i / 4, i / 2 + 1, "Label" + i);
35 c.custom = "cue";
36 c.addEventListener("enter", checkNativeProperty);
37 track.addCue(c);
38 }
39 for (var i = 0; i < 10; i++) {
40 cue = track.cues[i];
41 testExpected("cue.hasOwnProperty('custom')", true);
42 }
43
44 consoleWrite("");
45 consoleWrite("** Trigger a garbage collection. **");
46 track = null;
47 gc();
48 track = video.textTracks[0];
49 testExpected("track.hasOwnProperty('custom')", true);
50
51 consoleWrite("");
52 consoleWrite("** Play the video and test cue wrappers. **");
53 run("video.play()");
54 track.mode = "showing";
55 }
56 </script>
57 </head>
58
59 <body onload="startTest()">
60 <p>Tests that added cue object wrappers live across garbage collections. </p>
61 <video controls />
62 </body>
63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698