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..ef851018f5638b69ec19653b5ec30c625cf2e6b7 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-stops-delaying-load-event.html |
@@ -0,0 +1,45 @@ |
+<!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; |
+ })); |
+ |
+ 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"); |
+ 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); |
+ video.src = mediaSourceURL; |
+ test.add_cleanup(function() { URL.revokeObjectURL(mediaSourceURL); }); |
+ }, "MediaSource attachment should immediately stop delaying the load event"); |
+ </script> |
+ </body> |
+</html> |