Index: third_party/WebKit/LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-audio-video.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-audio-video.html b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-audio-video.html |
index 0fded5e8603868e79d0fc9bd67ad16b5c3fc364f..522ac47277f10ba0915ae1ac3d7a2065c3115153 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-audio-video.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-audio-video.html |
@@ -3,13 +3,31 @@ |
<video></video> |
<script> |
window.addEventListener('load', function () { |
+ var windowOpener = window.opener; |
+ var isAudioLoaded = false; |
+ var isVideoLoaded = false; |
+ function checkTestCompletion() { |
+ if (isAudioLoaded && isVideoLoaded && windowOpener) { |
+ windowOpener.postMessage('done', '*'); |
+ } |
+ } |
+ |
// Assigning via JavaScript after 'load' rather than direclty in the |
// markup in order to avoid the console's flaky "what line am I on?" |
// autodetection. |
- document.querySelector('audio').src = "http://127.0.0.1:8080/resources/test.mp4"; |
- document.querySelector('video').src = "http://127.0.0.1:8080/resources/test.mp4"; |
- if (window.opener) |
- window.opener.postMessage('done', '*'); |
+ var audioElement = document.querySelector('audio'); |
+ audioElement.src = "http://127.0.0.1:8080/resources/test.mp4"; |
+ audioElement.addEventListener("loadstart", function(event) { |
+ isAudioLoaded = true; |
+ checkTestCompletion(); |
+ }); |
+ |
+ var videoElement = document.querySelector('video'); |
+ videoElement.src = "http://127.0.0.1:8080/resources/test.mp4"; |
+ videoElement.addEventListener("loadstart", function(event) { |
+ isVideoLoaded = true; |
+ checkTestCompletion(); |
+ }); |
}); |
</script> |
</body> |