Index: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-stops-delaying-load-event.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-stops-delaying-load-event.html b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-stops-delaying-load-event.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0744b55bfe7006166bbe3a76a959fecf83337511 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-stops-delaying-load-event.html |
@@ -0,0 +1,49 @@ |
+<!DOCTYPE html> |
+<html> |
+ <head> |
+ <script src="/w3c/resources/testharness.js"></script> |
+ <script src="/w3c/resources/testharnessreport.js"></script> |
+ </head> |
+ <body> |
+ <script> |
+ async_test(function(test) |
+ { |
+ var receivedLoadEvent = false; |
+ |
+ window.addEventListener("load", test.step_func(function() { |
+ assert_false(receivedLoadEvent, "window should not receive multiple load events"); |
+ receivedLoadEvent = true; |
+ }), false); |
foolip
2016/06/20 09:30:12
Trailing false is not needed.
wolenetz
2016/06/21 22:25:47
Done.
|
+ |
+ assert_equals(document.readyState, "loading", "document should not be complete yet"); |
+ var video = document.createElement("video"); |
+ var mediaSource = new MediaSource(); |
+ |
+ // |video| should stop delaying the load event long before either a |
+ // "progress", "stalled" or "suspend" event are enqueued. |
+ video.addEventListener("suspend", test.unreached_func("unexpected 'suspend' event")); |
+ video.addEventListener("stalled", test.unreached_func("unexpected 'stalled' event")); |
+ video.addEventListener("progress", test.unreached_func("unexpected 'progress' event")); |
+ |
+ // No error is expected. |
+ video.addEventListener("error", test.unreached_func("unexpected 'error' event")); |
+ |
+ mediaSource.addEventListener("sourceopen", test.step_func(function() { |
+ assert_true(receivedLoadEvent, "load event should have been received first"); |
foolip
2016/06/20 09:30:12
It looks to me like the implementation would first
wolenetz
2016/06/21 22:25:47
Acknowledged.
wolenetz
2016/09/02 23:00:57
I've filed https://crbug.com/643846 to follow-up o
|
+ assert_equals(video.networkState, video.NETWORK_LOADING); |
+ assert_equals(video.readyState, video.HAVE_NOTHING); |
+ assert_equals(document.readyState, "complete", "document should be complete"); |
+ test.done(); |
+ })); |
+ |
+ var mediaSourceURL = URL.createObjectURL(mediaSource); |
+ document.body.appendChild(video); |
foolip
2016/06/20 09:30:12
Test should run fine without appending unless ther
wolenetz
2016/06/21 22:25:47
Done. And reconfirmed that without the .cpp portio
|
+ video.src = mediaSourceURL; |
+ test.add_cleanup(function() { |
+ document.body.removeChild(video); |
foolip
2016/06/20 09:30:12
Removing the video from the document ought not mat
wolenetz
2016/06/21 22:25:47
Done.
|
+ URL.revokeObjectURL(mediaSourceURL); |
+ }); |
+ }, "MediaSource attachment should immediately stop delaying the load event"); |
+ </script> |
+ </body> |
+</html> |