Update web-platform-tests to revision ddfc95cf0493ae147a4f6a4d7be8eff1a0c23098

This commit is contained in:
Anthony Ramine 2018-01-18 10:15:04 +01:00
parent 1f6a864ab5
commit 7e6290451f
832 changed files with 16026 additions and 2649 deletions

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<meta charset="utf-8">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<link rel=stylesheet href=stylesheet.py>
<link rel=stylesheet media="screen and (max-width:10px)" href=stylesheet.py?stylesNotMatchingEnvironment&delay=2>
<h1>Dominic Farolino</h1>
<script>
function styleExists(styleText) {
for (let styleRule of document.styleSheets) {
let currentStyleText = styleRule.cssRules["0"].cssText;
if (currentStyleText == styleText) {
return true;
}
}
return false;
}
test(() => {
const h1 = document.querySelector('h1');
const computedColor = getComputedStyle(h1).color;
const expectedColor = "rgb(128, 0, 128)";
assert_equals(computedColor, expectedColor);
assert_true(styleExists("h1 { color: purple; }")); // first style sheet
assert_false(styleExists("h1 { color: brown; }")); // second style sheet (should not be loaded yet)
}, "Only the style sheet loaded via a link element whose media attribute matches the environment should block following script execution");
const secondStylesheetTest = async_test("Both style sheets loaded via the link elements should be registered as style sheets for the document after 2 seconds");
secondStylesheetTest.step_timeout(() => {
assert_true(styleExists("h1 { color: purple; }")); // first style sheet
assert_true(styleExists("h1 { color: brown; }")); // second style sheet (loaded now!)
secondStylesheetTest.done();
}, 3000);
</script>

View file

@ -0,0 +1,10 @@
from time import sleep
def main(request, response):
if "delay" in request.GET:
delay = int(request.GET["delay"])
sleep(delay)
if "stylesNotMatchingEnvironment" in request.GET:
return 'h1 {color: brown;}'
else:
return 'h1 {color: purple;}'

View file

@ -0,0 +1,14 @@
WEBVTT
Cues that have overlapping time ranges.
1
00:00:01.000 --> 00:00:02.000
Bear is Coming!!!!!
2
00:00:02.500 --> 00:00:03.500
I said Bear is coming!!!!
3
00:00:04.000 --> 00:00:05.000
I said Bear is coming now!!!!

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<title>Enter, Exit events for a cue with negative duration</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
var track = video.addTextTrack("subtitles");
// Add a cue with negative duration.
var cue = new VTTCue(1, -10, "Sausage?");
track.addCue(cue);
assert_equals(track.cues.length, 1);
// Verify that enter and exit events are fired.
var enterEvent = false;
cue.onenter = t.step_func(function() {
enterEvent = true;
});
cue.onexit = t.step_func_done(function() {
assert_true(enterEvent);
});
video.src = getVideoURI("/media/test");
video.play();
});
</script>
</video>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<title>Enter, Exit events for cues with negative timestamps</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
var track = video.addTextTrack("subtitles");
// Add cue with negative startTime.
var cue = new VTTCue(-10, 1, "Sausage?");
track.addCue(cue);
assert_equals(track.cues.length, 1);
cue.onenter = t.step_func(function() {
cue.onexit = t.step_func_done();
});
// Add cue with negative startTime and negative endTime.
// This cue should never be active.
var missedCue = new VTTCue(-110, -3.4, "Pepperoni?");
track.addCue(missedCue);
assert_equals(track.cues.length, 2);
missedCue.onenter = t.unreached_func();
missedCue.onexit = t.unreached_func();
video.src = getVideoURI("/media/test");
video.play();
});
</script>
</video>

View file

@ -9,25 +9,33 @@
var testTrack = document.querySelector("track");
testTrack.onload = t.step_func_done(function() {
var cues = testTrack.track.cues;
assert_equals(testTrack.track.cues.length, 4);
// Add cue with negative startTime.
var cue = new VTTCue(-3439332606, 3.4, "Sausage?");
testTrack.track.addCue(cue);
assert_equals(testTrack.track.cues.length, 5);
assert_equals(cues.length, 5);
// Add cue with negative startTime and negative endTime.
cue = new VTTCue(-110, -3.4, "Pepperoni?");
testTrack.track.addCue(cue);
assert_equals(testTrack.track.cues.length, 6);
assert_equals(cues.length, 6);
// Set startTime and endTime to negative values.
var testCue = testTrack.track.cues[2];
var testCue = cues[2];
assert_equals(testCue.startTime, 0);
testCue.startTime = -5;
assert_equals(testCue.startTime, -5);
assert_equals(testCue.endTime, 30.5);
testCue.endTime = -3439332606;
assert_equals(testCue.endTime, -3439332606);
// Check negative cues ordering.
testCue = cues[3];
assert_equals(testCue.startTime, 31);
testCue.startTime = -200;
// Verify that this cue is moved to 2nd position.
assert_equals(cues[1].startTime, -200);
});
});
</script>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/common/reftest-wait.js"></script>
<style>
.container {
position: relative;
display: inline-block;
width: 320px;
height: 240px;
}
.cue {
position: absolute;
top: 0;
left: 0;
right: 0;
overflow: hidden;
}
.cue > span {
font-family: sans-serif;
background: green;
color: green;
font-size: 120px;
padding: 2px;
}
</style>
<div class="container">
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
</video>
<div class="cue"><span>PAS</span></div>
</div>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/common/reftest-wait.js"></script>
<link rel="match" href="track-cue-rendering-line-doesnt-fit-ref.html">
<script>
function addCue(track, cueData) {
var cue = new VTTCue(0, 10, 'XXX');
for (var prop in cueData)
cue[prop] = cueData[prop];
track.addCue(cue);
}
</script>
<style>
video::cue {
font-size: 120px;
color: green;
background-color: green;
}
</style>
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
<script>
var video = document.querySelector("video");
var track = video.addTextTrack('subtitles');
addCue(track, { line: 0, align: 'start', text: 'PAS' });
// This cue will not fit, and will not be displayed.
addCue(track, { line: 1, align: 'start', text: 'FAI' });
track.mode = 'showing';
</script>
</video>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/common/reftest-wait.js"></script>
<style>
.container {
transform: translate(1px, 0px);
position: relative;
display: inline-block;
width: 320px;
height: 240px;
}
.cue {
position: absolute;
top: 0;
left: 0;
right: 0;
overflow: hidden;
text-align: start;
}
.cue > span {
font-family: sans-serif;
background: green;
color: green;
font-size: 50px;
padding: 2px;
}
</style>
<div class="container">
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
</video>
<div class="cue"><span>XXX</span></div>
</div>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/common/reftest-wait.js"></script>
<link rel="match" href="track-cue-rendering-transformed-video-ref.html">
<style>
video {
transform: translate(1px, 0px);
}
video::cue {
font-size: 50px;
color: green;
background-color: green;
}
</style>
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
<script>
var video = document.querySelector('video');
var track = video.addTextTrack('subtitles');
var cue = new VTTCue(0, 10, 'XXX');
cue.align = 'start';
cue.line = 0;
track.addCue(cue);
track.mode = 'showing';
</script>
</video>
</html>

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<title>TextTrack's cues are indexed and updated in order during video playback</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="resources/cues-chrono-order.vtt" kind="captions" default>
<script>
// Use the cuechange event on TextTrack.
async_test(function(t) {
var video = document.querySelector("video");
var testTrack = document.querySelector("track");
video.src = getVideoURI("/media/test");
video.oncanplaythrough = t.step_func(attemptTests);
function attemptTests() {
assert_equals(testTrack.track.cues.length, 3);
testTrack.oncuechange = t.step_func(cueChangedFromTrackElement);
video.play();
}
var currentCueIndex;
var cueChangeCount = 0;
function cueChangedFromTrackElement() {
currentCueIndex = Math.floor(cueChangeCount / 2);
currentCue = event.target.track.cues[currentCueIndex];
if (cueChangeCount % 2 == 0) {
// Cue entered.
assert_equals(currentCue, testTrack.track.activeCues[0]);
assert_equals(currentCue.id, (currentCueIndex + 1).toString());
}
++cueChangeCount;
if (cueChangeCount == testTrack.track.cues.length * 2)
t.done();
}
});
</script>
</video>

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<title>TextTrack's cues are indexed and updated in order during video playback</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="resources/cues-chrono-order.vtt" kind="captions" default>
<script>
// Use the enter and exit events on TextTrackCue.
async_test(function(t) {
var video = document.querySelector("video");
var testTrack = document.querySelector("track");
video.src = getVideoURI("/media/test");
video.oncanplaythrough = t.step_func(attemptTests);
function attemptTests() {
assert_equals(testTrack.track.cues.length, 3);
for (var i = 0; i < testTrack.track.cues.length; i++) {
testTrack.track.cues[i].onenter = t.step_func(cueEntered);
testTrack.track.cues[i].onexit = t.step_func(cueExited);
}
video.play();
}
var cueCount = 0;
function cueEntered() {
var currentCue = event.target;
// This cue is the currently active cue.
assert_equals(currentCue, testTrack.track.activeCues[0]);
assert_equals(currentCue.id, (cueCount + 1).toString());
}
function cueExited() {
++cueCount;
if (cueCount == testTrack.track.cues.length)
t.done();
}
});
</script>
</video>

View file

@ -28,4 +28,4 @@
<script type="module" src="./cycle-unresolvable-a.js"
onerror="unreachable()" onload="log.push(2)"></script>
<script type="module" src="./cycle-unresolvable.js"
onerror="unreachable()" onload="log.push(3)" async></script>
onerror="unreachable()" onload="log.push(3)"></script>

View file

@ -32,6 +32,10 @@ test(function() {
assert_equals(element.relList.length, 2);
assert_equals(element.relList[0], "first");
assert_equals(element.relList[1], "second");
// Test that relList is [SameObject].
let savedRelList = element.relList;
element.rel = "something";
assert_equals(element.relList, savedRelList);
// Test that supports() is returning true for valid values
// and false for invalid ones.

View file

@ -32,6 +32,10 @@ test(function() {
assert_equals(element.relList.length, 2);
assert_equals(element.relList[0], "first");
assert_equals(element.relList[1], "second");
// Test that relList is [SameObject].
let savedRelList = element.relList;
element.rel = "something";
assert_equals(element.relList, savedRelList);
// Test that supports() is returning true for valid values
// and false for invalid ones.