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

Unified Diff: LayoutTests/http/tests/media/media-source/mediasource-closed-on-htmlmediaelement-destruction.html

Issue 245893002: Improve unprefixed MediaSource test coverage. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/http/tests/media/media-source/mediasource-closed-on-htmlmediaelement-destruction.html
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-closed-on-htmlmediaelement-destruction.html b/LayoutTests/http/tests/media/media-source/mediasource-closed-on-htmlmediaelement-destruction.html
new file mode 100644
index 0000000000000000000000000000000000000000..15c027d546347040a9d44be1c468374ca5583be1
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-source/mediasource-closed-on-htmlmediaelement-destruction.html
@@ -0,0 +1,54 @@
+<!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>
+ <video id="vid"></video>
+ <script>
+ window.jsTestIsAsync = true;
+
+ async_test(function(test)
+ {
+ var ms = new MediaSource();
+
+ function sourceOpened()
+ {
+ consoleWrite("sourceOpened called.");
+ var vid = document.getElementById('vid');
+ var buffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp8"');
+
+ consoleWrite("Removing video element from DOM.");
+ vid.parentNode.removeChild(vid);
+ vid = null;
+
+ consoleWrite("Running the garbage collector.");
+ asyncGC(test.step_func(function()
+ {
+ assert_equals(ms.readyState, "closed", "MediaSource object is closed.");
+
+ assert_throws( { name: "InvalidStateError"} ,
+ function() { buffer.timestampOffset = 42; },
+ "buffer.timestampOffset threw an exception as expected in the 'closed' state.");
+
+ test.done();
+ }));
+ }
+
+ function sourceClosed()
+ {
+ consoleWrite("sourceClosed called.");
+ }
+
+ ms.addEventListener('sourceopen', test.step_func(sourceOpened));
+ ms.addEventListener('sourceclose', test.step_func(sourceClosed));
+ document.getElementById('vid').src = window.URL.createObjectURL(ms);
+ }, "Tests that the MediaSource is closed when the HTMLMediaElement is destroyed.");
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698