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

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: Consistently use a Node-returning owner() 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..1db1d8ffae0e9faf80ce65604dc7ea809174c3ec
--- /dev/null
+++ b/LayoutTests/media/track/track-cue-gc-wrapper.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
acolwell GONE FROM CHROMIUM 2014/04/21 16:51:16 nit: 4 space indent tags as well please.
sof 2014/04/21 18:35:01 Done.
+<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