Update web-platform-tests to revision f915dfd69790e7ca09f9bef4eb08cd30163cb3e3

This commit is contained in:
WPT Sync Bot 2019-05-28 10:22:49 +00:00
parent 2ac916b5a1
commit fde011e73d
70 changed files with 1490 additions and 483 deletions

View file

@ -17,6 +17,9 @@ async_test(function(t) {
var video = document.createElement('video');
video.src = getVideoURI('/media/movie_5');
// uanset media element's `show-poster` flag in order to run `time marches on`
// when we add new cues into media element's cues list.
video.play();
var trackElement = document.createElement('track');
trackElement.onload = t.step_func(eventCallback);
@ -36,4 +39,4 @@ async_test(function(t) {
trackElement.default = true;
video.appendChild(trackElement);
});
</script>
</script>

View file

@ -21,7 +21,7 @@
break;
case 1:
case 3:
case 5:
case 4:
assert_unreached("'error' event did not fire, stage = " + stage);
break;
case 2:
@ -30,21 +30,10 @@
assert_equals(cues[cues.length-1].text, 'I said Bear is coming now!!!! Tab separators.', "Last cue content check");
++stage;
testTrack.src = ""; // this should fail
// CuesList will be cleared in the next tick. Spec claims that this should happen immediately,
// but all implementations are doing this asynchronously.
assert_equals(cues.length, 4, "Number of cues immediately after 'src' mutation with the empty URL");
assert_equals(cues.length, 0, "cues list is reset immediately after 'src' mutation with the new URL");
// This should raise onError event. If no, we'll know about this after some time.
timer = t.step_timeout(t.unreached_func("'error' event is not fired when an empty URL is set"), 100);
break;
case 4:
assert_equals(testTrack.readyState, HTMLTrackElement.LOADED, "readyState after loading of the second track");
assert_equals(cues.length, 4, "Number of cues after loading of the second track");
assert_equals(cues[cues.length-1].text, 'I said Bear is coming now!!!! Tab separators.', "Last cue content check");
++stage;
testTrack.removeAttribute('src');
// This should raise onError event, so we'll wait for it for some time
timer = t.step_timeout(t.unreached_func("'error' event is not fired when an empty URL is set"), 100);
break;
default:
assert_unreached("unexpected stage number = " + stage);
break;
@ -55,7 +44,6 @@
switch (stage) {
case 0:
case 2:
case 4:
assert_unreached("'error' event fired, stage = " + stage);
break;
case 1:
@ -72,8 +60,14 @@
assert_equals(cues.length, 0, "Number of cues with an empty URL set");
++stage;
testTrack.src = "resources/settings.vtt";
// error should happen when we remove `src` during loading, so we have to wait a task because loading starts asynchronously.
t.step_timeout(() => {
testTrack.removeAttribute('src');
// This should raise onError event, so we'll wait for it for some time
timer = t.step_timeout(t.unreached_func("'error' event is not fired when an empty URL is set"), 100);
}, 0);
break;
case 5:
case 4:
clearTimeout(timer);
assert_equals(testTrack.readyState, HTMLTrackElement.ERROR, "readyState after removing 'src' attr");
assert_equals(cues.length, 0, "Number of cues after removing 'src' attr");
@ -89,4 +83,4 @@
testTrack.onerror = t.step_func(step_onError);
});
</script>
</video>
</video>

View file

@ -18,9 +18,7 @@
assert_equals(cues[cues.length-1].text, 'I said Bear is coming now!!!! Tab separators.', "Last cue content check");
++stage;
testTrack.src = "resources/entities.vtt";
// CuesList will be cleared in a microtask. Spec claims that this should happen immediately,
// but all known implementations are doing this asynchronously.
assert_equals(cues.length, 4, "Number of cues immediately after 'src' mutation with the new URL");
assert_equals(cues.length, 0, "cues list is reset immediately after 'src' mutation with the new URL");
break;
case 1:
assert_equals(testTrack.readyState, HTMLTrackElement.LOADED), "readyState after loading of the second track";
@ -54,4 +52,4 @@
testTrack.onerror = t.unreached_func("'error' event should not fire");
});
</script>
</video>
</video>

View file

@ -33,11 +33,12 @@ async_test(function(t) {
assert_equals(track1.track.cues.length, 12);
assert_equals(track1.track.cues[11].startTime, 22);
// Add a caption track, configured to load automatically.
// Add a caption track, and explicitly enable it.
track2 = document.createElement('track');
track2.setAttribute('kind', 'captions');
track2.setAttribute('default', 'default');
track2.setAttribute('src', 'resources/webvtt-file.vtt');
track2.track.mode = 'showing';
track2.onload = t.step_func(captionsTrackLoaded);
video.appendChild(track2);
}
@ -56,7 +57,7 @@ async_test(function(t) {
track3.mode = 'showing';
}
function trackAdded() {
function trackAdded(event) {
// Check that metadata track state has not changed.
assert_equals(track1.readyState, HTMLTrackElement.LOADED);
assert_equals(track1.track.mode, 'hidden');

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<title>HTMLTrackElement Text Track Selection Task Order</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
/**
* This test is used to ensure that we queue 'honor user preferences for automatic
* text track selection' as a macro task, not a micro task. In this test, we
* trigger a media event before queuing a text track selection task, and check
* the text track's mode to know whether the text track selection runs after the
* task for media event.
*/
async_test(function(t) {
let video = document.createElement("video");
video.play();
video.onplay = t.step_func(startedPlay);
// When we create a text track element, it queue a task to run automatic
// text track selection later.
let track = document.createElement("track");
track.default = true;
video.appendChild(track);
assert_equals(track.track.mode, "disabled", "Text track's mode is disabled by default.");
function startedPlay() {
assert_equals(track.track.mode, "disabled", "Text track selection hasn't started yet.");
track.onerror = t.step_func_done(trackError);
}
function trackError() {
assert_equals(track.track.mode, "showing", "Text track selection modified track's mode.");
t.done();
}
});
</script>