Skip to content

Commit b63072d

Browse files
Fredrik Söderquistchromium-wpt-export-bot
Fredrik Söderquist
authored andcommitted
Adjust track vs. video loading in track-remove-insert-ready-state.html
When the test was upstreamed to WPT in d86c4f8fdaaf4da023fc71172e20508f2ffd31ec, the <script> element that starts the load for the video resource was moved to be a child of the <video> element. This means that the load of the <track> element will start when the <video> elements end tag is encountered, while the load of the video resource starts a bit earlier. Thus if the video resource some completes loading (enough) before the <video> element is closed by the parser, the <track> element may not have been selected and set to 'showing' yet. This can lead to flakiness. Restore the location of the <script> that defines the async_test() to that which it had before the export. Bug: 1453552 Change-Id: I02efc27e36ca288754d0854aee14637415baea6b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4624051 Reviewed-by: Dale Curtis <[email protected]> Commit-Queue: Fredrik Söderquist <[email protected]> Cr-Commit-Position: refs/heads/main@{#1160554}
1 parent 19cc639 commit b63072d

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

html/semantics/embedded-content/media-elements/track/track-element/track-remove-insert-ready-state.html

+24-24
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@
55
<script src="/resources/testharnessreport.js"></script>
66
<video>
77
<track src="resources/no-webvtt.vtt" kind="captions" default>
8-
<script>
9-
async_test(function(t) {
10-
var video = document.querySelector('video');
11-
video.src = getVideoURI('/media/test');
12-
video.oncanplaythrough = t.step_func(canplaythrough);
8+
</video>
9+
<script>
10+
async_test(function(t) {
11+
var video = document.querySelector('video');
12+
video.src = getVideoURI('/media/test');
13+
video.oncanplaythrough = t.step_func(canplaythrough);
1314

14-
function canplaythrough() {
15-
video.oncanplaythrough = null;
16-
var track = document.querySelector('track');
15+
function canplaythrough() {
16+
video.oncanplaythrough = null;
17+
var track = document.querySelector('track');
1718

18-
// Track should have error as ready state.
19-
assert_equals(track.readyState, HTMLTrackElement.ERROR);
19+
// Track should have error as ready state.
20+
assert_equals(track.readyState, HTMLTrackElement.ERROR);
2021

21-
// Remove the video element from body.
22-
document.body.removeChild(video);
22+
// Remove the video element from body.
23+
document.body.removeChild(video);
2324

24-
// Reset the video src attribute to re-trigger resource selection for tracks.
25-
video.src = getVideoURI('/media/test');
25+
// Reset the video src attribute to re-trigger resource selection for tracks.
26+
video.src = getVideoURI('/media/test');
2627

27-
// Append the video element back to the body.
28-
document.body.appendChild(video);
28+
// Append the video element back to the body.
29+
document.body.appendChild(video);
2930

30-
assert_equals(track.readyState, HTMLTrackElement.ERROR);
31+
assert_equals(track.readyState, HTMLTrackElement.ERROR);
3132

32-
video.onplaying = t.step_func_done();
33-
video.play();
34-
// The video should start playing.
35-
}
36-
});
37-
</script>
38-
</video>
33+
video.onplaying = t.step_func_done();
34+
video.play();
35+
// The video should start playing.
36+
}
37+
});
38+
</script>

0 commit comments

Comments
 (0)