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..1320e092560116b3a4989e5d6a1daedb4b211440 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-attach-stops-delaying-load-event.html |
@@ -0,0 +1,48 @@ |
+<!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 isLoaded = false; |
+ window.addEventListener("load", test.step_func(function() { isLoaded = true; }), false); |
+ |
+ 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() { |
+ // Let any pending "load" event also fire. Then verify we've received one. |
mlamouri (slow - plz ping)
2016/05/31 15:30:48
Shouldn't you `assert_false(isLoaded)` here? I bel
wolenetz
2016/05/31 17:50:53
Good point, that was my intent and I missed adding
wolenetz
2016/05/31 18:08:36
I looked a little closer and have further question
|
+ setTimeout(test.step_func(function() { |
+ assert_equals(video.networkState, video.NETWORK_LOADING); |
+ assert_equals(video.readyState, video.HAVE_NOTHING); |
+ assert_equals(document.readyState, "complete", "document should be complete"); |
+ assert_true(isLoaded, "load event should have fired"); |
+ test.done(); |
+ }), 0); |
+ })); |
+ |
+ var mediaSourceURL = URL.createObjectURL(mediaSource); |
+ document.body.appendChild(video); |
+ video.src = mediaSourceURL; |
+ test.add_cleanup(function() { |
+ document.body.removeChild(video); |
+ URL.revokeObjectURL(mediaSourceURL); |
+ }); |
+ }, "MediaSource attachment should immediately stop delaying the load event"); |
+ </script> |
+ </body> |
+</html> |