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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/media/track/track-cue-gc-wrapper.html
diff --git a/LayoutTests/media/track/track-cue-gc-wrapper.html b/LayoutTests/media/track/track-cue-gc-wrapper.html
new file mode 100644
index 0000000000000000000000000000000000000000..4bf8ac40a61730a8c8e7bc57978f12945e3b9fcb
--- /dev/null
+++ b/LayoutTests/media/track/track-cue-gc-wrapper.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <script src=../media-file.js></script>
+ <script src=../video-test.js></script>
+ <script>
+ var cue;
+ var track;
+ var j = 0;
+ var cueLimit = 10;
+
+ function checkNativeProperty()
+ {
+ cue = this;
+ testExpected("cue.hasOwnProperty('custom')", true);
+ if (++j >= cueLimit)
+ endTest();
+ }
+
+ function startTest()
+ {
+ findMediaElement();
+ video.src = findMediaFile('video', '../content/test');
+
+ consoleWrite("** Add a text track to the video element **");
+ track = video.addTextTrack("captions", "regular captions track", "en");
+ track.custom = "track";
+ testExpected("track.hasOwnProperty('custom')", true);
+
+ consoleWrite("** Add cues with own native property to the track with enter event listener. **");
+ for (var i = 0; i < cueLimit; i++) {
+ var c = new VTTCue(i / 4, i / 2 + 1, "Label" + i);
+ c.custom = "cue";
+ c.addEventListener("enter", checkNativeProperty);
+ track.addCue(c);
+ }
+ for (var i = 0; i < 10; i++) {
+ cue = track.cues[i];
+ testExpected("cue.hasOwnProperty('custom')", true);
+ }
+
+ consoleWrite("");
+ consoleWrite("** Trigger a garbage collection. **");
+ track = null;
+ gc();
+ track = video.textTracks[0];
+ testExpected("track.hasOwnProperty('custom')", true);
+
+ consoleWrite("");
+ consoleWrite("** Play the video and test cue wrappers. **");
+ run("video.play()");
+ track.mode = "showing";
+ }
+ </script>
+ </head>
+
+ <body onload="startTest()">
+ <p>Tests that added cue object wrappers live across garbage collections.</p>
+ <video controls />
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698