Index: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-preload.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-preload.html b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-preload.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bcda95e32b886e321e6317b345db969e4d210b8a |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-preload.html |
@@ -0,0 +1,52 @@ |
+<!DOCTYPE html> |
+<html> |
+ <head> |
+ <script src="/w3c/resources/testharness.js"></script> |
+ <script src="/w3c/resources/testharnessreport.js"></script> |
+ <script src="mediasource-util.js"></script> |
+ <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
Srirama
2016/04/14 05:13:07
nit: may be use double quotes here to be consisten
wolenetz
2016/04/21 21:37:30
Copy-paste from another media-source layout test.
|
+ </head> |
+ <body> |
+ <div id="log"></div> |
Srirama
2016/04/14 05:13:07
do we need this div?
philipj_slow
2016/04/14 13:16:30
Nope :)
wolenetz
2016/04/21 21:37:30
Yet another copy-paste from another media-source l
|
+ <script> |
+ function attachWithPreloadTest(preload) |
+ { |
+ media_test(function(test) |
+ { |
+ var mediaTag = document.createElement('video'); |
philipj_slow
2016/04/14 13:16:30
s/mediaTag/video/ since it's always a video
wolenetz
2016/04/21 21:37:30
Done.
|
+ if (preload) |
+ mediaTag.preload = preload; |
+ document.body.appendChild(mediaTag); |
+ |
+ // Overload done() so that elements added to the document can be |
+ // removed. |
+ var removeMediaElement = true; |
+ var oldTestDone = test.done.bind(test); |
+ test.done = function() |
+ { |
+ if (removeMediaElement) { |
philipj_slow
2016/04/14 13:16:30
It looks like what you want for this is test.add_c
wolenetz
2016/04/21 21:37:30
Yet another copy-paste from another media-source l
|
+ document.body.removeChild(mediaTag); |
+ removeMediaElements = false; |
+ } |
+ oldTestDone(); |
+ }; |
+ |
+ var mediaSource = new MediaSource(); |
+ var mediaSourceURL = URL.createObjectURL(mediaSource); |
+ test.expectEvent(mediaSource, 'sourceopen'); |
+ mediaTag.src = mediaSourceURL; |
+ test.waitForExpectedEvents(function() |
philipj_slow
2016/04/14 13:16:30
If this is the only reason you need yo use media_t
wolenetz
2016/04/21 21:37:30
Done, though "mediaSource.onsourceopen = ..." didn
philipj_slow
2016/04/22 09:22:15
Ah, I just assumed that the MediaSource interface
wolenetz
2016/04/25 19:43:21
Acknowledged.
|
+ { |
+ URL.revokeObjectURL(mediaSourceURL); |
philipj_slow
2016/04/14 13:16:30
Maybe put this in the cleanup callback in case the
wolenetz
2016/04/21 21:37:30
Done.
|
+ test.done(); |
+ }); |
+ }, 'sourceopen occurs with element preload="' + preload + '"'); |
+ } |
+ |
+ attachWithPreloadTest(); |
philipj_slow
2016/04/14 13:16:30
I don't think it's necessary to test the default b
wolenetz
2016/04/21 21:37:30
Done.
|
+ attachWithPreloadTest('auto'); |
+ attachWithPreloadTest('metadata'); |
+ attachWithPreloadTest('none'); |
+ </script> |
+ </body> |
+</html> |