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

Unified Diff: LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html

Issue 552303006: Prevent more script-observable cases of HTMLMediaElement GC (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: make gc-while-seeking.html non-flaky Created 6 years, 3 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/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html b/LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html
new file mode 100644
index 0000000000000000000000000000000000000000..7e1b1a2f5d7d783c73b6c0f5d891ddf5dc3e74fd
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="/js-test-resources/js-test.js"></script>
+ <script src="/media-resources/video-test.js"></script>
+ <script src="/w3c/resources/testharness.js"></script>
+ <script src="/w3c/resources/testharnessreport.js"></script>
+ <script src="mediasource-util.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ window.jsTestIsAsync = true;
+
+ async_test(function(test)
+ {
+ var video = document.createElement("video");
+ var ms = new MediaSource();
+
+ function sourceOpened()
+ {
+ consoleWrite("sourceOpened called.");
+ var buffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp8"');
+
+ consoleWrite("Running the garbage collector.");
+ video = null;
+ asyncGC(test.step_func(function()
+ {
+ assert_equals(ms.readyState, "open", "MediaSource object is open.");
+
+ consoleWrite("Setting MediaSource duration.");
+ ms.duration = 100;
+ }));
+ }
+
+ function durationChanged()
+ {
+ consoleWrite("durationChanged called.");
+ test.done();
+ }
+
+ ms.addEventListener("sourceopen", test.step_func(sourceOpened));
+ video.addEventListener("durationchange", test.step_func(durationChanged));
+ video.src = window.URL.createObjectURL(ms);
+ }, "Tests that the MediaSource keeps the HTMLMediaElement alive.");
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698