From ee1fcf6ccb9d5d60e211323aa28da1b7a705ff5a Mon Sep 17 00:00:00 2001 From: Dale Curtis Date: Thu, 5 Oct 2023 15:04:27 -0700 Subject: [PATCH] Improve error resilience for resize-during-playback.html test. This ensures the event watcher is registered before events may be generated and ensures an error event doesn't cause a timeout. R=tguilbert Bug: 1489726 Change-Id: I4bbdbce140684f72c994fe37f443955f49116826 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4917304 Auto-Submit: Dale Curtis Commit-Queue: Dale Curtis Commit-Queue: Thomas Guilbert Reviewed-by: Thomas Guilbert Cr-Commit-Position: refs/heads/main@{#1206066} --- .../the-video-element/resize-during-playback.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/html/semantics/embedded-content/the-video-element/resize-during-playback.html b/html/semantics/embedded-content/the-video-element/resize-during-playback.html index 1b057bbeac322e..e1f35768bc41b4 100644 --- a/html/semantics/embedded-content/the-video-element/resize-during-playback.html +++ b/html/semantics/embedded-content/the-video-element/resize-during-playback.html @@ -14,12 +14,15 @@ const video = document.createElement('video'); assert_implements_optional(video.canPlayType(`video/${format}`), `${format} supported`); + const eventWatcher = new EventWatcher(t, video, ['resize', 'playing', 'error', 'ended']); + // Load the video and wait for initial resize event. - video.src = `/media/400x300-red-resize-200x150-green.${format}`; video.muted = true; video.preload = 'auto'; + video.onerror = t.unreached_func("error during playback"); + video.src = `/media/400x300-red-resize-200x150-green.${format}`; document.body.appendChild(video); - const eventWatcher = new EventWatcher(t, video, ['resize', 'playing', 'error', 'ended']); + await eventWatcher.wait_for(['resize']); assert_equals(video.videoWidth, 400, 'width after first resize event'); assert_equals(video.videoHeight, 300, 'height after first resize event');