mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #23156 - servo-wpt-sync:wpt_update_03-04-2019, r=jdm
Sync WPT with upstream (03-04-2019) Automated downstream sync of changes from upstream as of 03-04-2019. [no-wpt-sync] <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23156) <!-- Reviewable:end -->
This commit is contained in:
commit
6fa1853bb1
105 changed files with 1206 additions and 778 deletions
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Test looping edge case to verify http://crbug.com/364442.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/media.js"></script>
|
||||
<video></video>
|
||||
<script>
|
||||
// Seek towards end of video (for faster testing).
|
||||
// Play video to end with "loop" set to false.
|
||||
// Once ended, set "loop" to true. Call play.
|
||||
// Verify that "seeked" event fires, seeking back to the beginning.
|
||||
// Pause video and end test.
|
||||
async_test(function(t) {
|
||||
var video = document.querySelector("video");
|
||||
|
||||
video.onloadedmetadata = t.step_func(function() {
|
||||
// Video is initially paused and "loop" unset.
|
||||
assert_true(video.paused, "paused initially ");
|
||||
assert_false(video.loop, "loop initially");
|
||||
// Seek to just before the end of the video and play.
|
||||
video.currentTime = video.duration - 0.5;
|
||||
video.onended = t.step_func(function() {
|
||||
// Verify played to end and stopped.
|
||||
assert_true(video.ended, "ended at ended event");
|
||||
assert_true(video.paused, "paused at ended event");
|
||||
assert_equals(video.currentTime, video.duration, "currentTime at ended event");
|
||||
|
||||
// With playback ended, set "loop" attribute. This will cause ended == false.
|
||||
// looping video cannot be "ended", only paused.
|
||||
assert_false(video.loop, "loop at ended event");
|
||||
video.loop = true;
|
||||
assert_true(video.loop, "loop after seek");
|
||||
assert_false(video.ended, "ended after seek");
|
||||
assert_true(video.paused, "paused after seek");
|
||||
|
||||
video.onseeked = t.step_func_done(function() {
|
||||
// Observed seek. Verify current time decreased and still playing.
|
||||
assert_true(video.loop, "loop at seeked event")
|
||||
assert_false(video.paused, "paused at seeked event");
|
||||
assert_false(video.ended, "ended at seeked event");
|
||||
assert_less_than(video.currentTime, video.duration, "currentTime at seeked event");
|
||||
// Pausing now that test is over to prevent additional unwanted looping.
|
||||
video.pause();
|
||||
});
|
||||
|
||||
// Play video with "loop" set. Expect seek back to start.
|
||||
video.play();
|
||||
});
|
||||
|
||||
video.play();
|
||||
});
|
||||
|
||||
video.src = getVideoURI("/media/movie_5");
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue