Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-audio-video.html

Issue 1703333002: Fix a test race - synchronize test completion to media's loadstart event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/FlagExpectations/site-per-process ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « third_party/WebKit/LayoutTests/FlagExpectations/site-per-process ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698