Auto merge of #19738 - servo:wptup, r=jdm

Update web-platform-tests

<!-- 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/19738)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-01-17 13:05:26 -06:00 committed by GitHub
commit 9f2b33c646
647 changed files with 9013 additions and 4820 deletions

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<title>A 'change' event is fired when a TextTrack's mode changes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function(t) {
var video = document.createElement('video');
var track = video.addTextTrack('subtitles', 'test', 'en');
// addTextTrack() defaults to "hidden", so settings
// mode to "showing" should trigger a "change" event.
track.mode = 'showing';
assert_equals(video.textTracks.length, 1);
video.textTracks.onchange = t.step_func_done(function() {
assert_equals(event.target, video.textTracks);
assert_true(event instanceof Event, 'instanceof');
assert_not_exists(event, 'track');
});
});
</script>

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
:cue { color: red; }
:cue(i) { color: red; }
</style>
<script>
test(function() {
assert_equals(document.styleSheets[0].cssRules.length, 0);
}, ":cue pseudo-class is not supported and dropped during parsing");
</script>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<title>Negative timestamps</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="resources/settings.vtt" default>
<script>
async_test(function(t) {
var testTrack = document.querySelector("track");
testTrack.onload = t.step_func_done(function() {
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);
// 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);
// Set startTime and endTime to negative values.
var testCue = testTrack.track.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);
});
});
</script>
</video>

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<title>Empty cues</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function(t) {
var video = document.createElement("video");
video.src = getVideoURI("/media/test");
video.addTextTrack("captions", "regular captions track", "en");
video.textTracks[0].addCue(new VTTCue(0, 4, ""));
video.onplaying = t.step_func_done();
video.play();
});
</script>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<title>A track with the "default" attribute loads automatically</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track kind="captions" src="resources/default-styles.vtt">
<track kind="captions" src="resources/metadata-area.vtt">
<track kind="captions" src="resources/webvtt-file.vtt" id="default" default>
<script>
async_test(function(t) {
var timer = null;
var tracks = document.querySelectorAll("track");
for (var track of tracks) {
track.onload = t.step_func(function() {
assert_equals(event.target.readyState, HTMLTrackElement.LOADED);
assert_equals(event.target.id, "default");
assert_true(event.target.default);
// End the test after a brief pause so we allow other tracks to load if they will.
if (timer)
clearTimeout(timer);
timer = t.step_timeout(t.step_func_done(), 200);
});
}
});
</script>
</video>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<title>Track deletion during setup</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="resources/metadata.vtt">
</video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
var track = document.querySelector("track");
t.step_timeout(function() {
video.parentNode.removeChild(video);
}, 61);
track.onload = t.step_func(function() {
var track2 = document.createElement("track");
video.appendChild(track2);
t.step_timeout(t.step_func_done(), 100);
});
assert_equals(track.readyState, HTMLTrackElement.NONE);
assert_equals(track.track.mode, "disabled");
track.track.mode = "hidden";
video.src = getVideoURI("/media/test");
});
</script>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<title>TextTrack "id" attribute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track id="LoremIpsum" src="resources/captions-fast.vtt" default>
<script>
test(function() {
var video = document.querySelector("video");
var track = document.querySelector("track");
var textTrack = track.track;
// Test default attribute value.
assert_equals(textTrack.id, "LoremIpsum");
assert_equals(video.textTracks[0].id, "LoremIpsum");
// Make sure we can look up tracks by id.
assert_equals(video.textTracks.getTrackById("LoremIpsum"), textTrack);
// Test that it's readonly.
textTrack.id = "newvalue";
assert_equals(textTrack.id, "LoremIpsum");
});
</script>
</video>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>Inserting a track element immediately after video load</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function(t) {
var video = document.createElement('video');
video.src = getVideoURI('/media/test');
video.load();
video.appendChild(document.createElement('track'));
video.onloadedmetadata = t.step_func_done();
});
</script>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<title>Add and remove track node</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
test(function() {
var video = document.createElement('video');
var tracka = document.createElement('track');
video.appendChild(tracka);
var trackb = document.createElement('track');
video.appendChild(trackb);
// Adding tracks outside the DOM tree.
assert_array_equals(video.textTracks, [tracka.track, trackb.track]);
// Inserting the parent video element into the document.
document.body.appendChild(video);
assert_array_equals(video.textTracks, [tracka.track, trackb.track]);
// Inserting and removing another track in the document.
var trackc = document.createElement('track');
video.appendChild(trackc);
assert_array_equals(video.textTracks, [tracka.track, trackb.track, trackc.track]);
trackb.parentNode.removeChild(trackb);
assert_array_equals(video.textTracks, [tracka.track, trackc.track]);
// Removing the video from the document.
document.body.removeChild(video);
assert_array_equals(video.textTracks, [tracka.track, trackc.track]);
tracka.parentNode.removeChild(tracka);
assert_array_equals(video.textTracks, [trackc.track]);
});
</script>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<title>Multiple 'metadata' tracks with 'default'</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track kind="metadata" src="resources/default-styles.vtt" id="t1">
<track kind="metadata" src="resources/class.vtt" default id="t2hidden">
<track kind="metadata" src="resources/metadata-area.vtt" id="t3">
<track kind="metadata" src="resources/webvtt-file.vtt" default id="t4hidden">
<script>
async_test(function() {
var video = document.querySelector('video');
video.onloadstart = this.step_func_done(function() {
assert_equals(video.textTracks.length, 4);
for (var track of video.textTracks) {
assert_equals(track.kind, 'metadata');
var trackElement = document.getElementById(track.id);
if (track.id.indexOf('hidden') != -1) {
assert_true(trackElement.default);
assert_equals(track.mode, 'hidden');
} else {
assert_false(trackElement.default);
assert_equals(track.mode, 'disabled');
}
}
});
video.src = getVideoURI("/media/test");
});
</script>
</video>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<title>TextTrackCueList functionality: length, operator[], and getCueById()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="resources/settings.vtt" kind="captions" default>
<script>
async_test(function(t) {
var testTrack = document.querySelector("track");
testTrack.onload = t.step_func_done(function() {
var cues = testTrack.track.cues;
// Testing TextTrackCueList length.
assert_equals(cues.length, 4);
// Testing TextTrackCueList [] operator.
assert_equals(cues[0].id, "1");
assert_equals(cues[3].id, "4");
assert_object_equals(cues[4], undefined);
// Testing TextTrackCueList getCueById().
assert_equals(cues.getCueById("1").startTime, 0);
assert_equals(cues.getCueById("4").startTime, 121);
assert_object_equals(cues.getCueById("junk"), undefined);
});
});
</script>
</video>

View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<title>TextTracks in a TextTrackList are kept in the correct order</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track kind="captions" src="resources/webvtt-file.vtt">
</video>
<script>
test(function() {
var video = document.querySelector("video");
// Add a track with video.addTextTrack().
video.addTextTrack("descriptions", "Descriptions Track", "en");
// Add a track element with DOM API.
var trackElement = document.createElement("track");
trackElement.setAttribute("kind", "chapters");
video.appendChild(trackElement);
// Verify track order.
assert_equals(video.textTracks.length, 3);
assert_equals(video.textTracks[0].kind, "captions");
assert_equals(video.textTracks[1].kind, "chapters");
assert_equals(video.textTracks[2].kind, "descriptions");
// Verify the default parameters of the text track object
// returned by addTextTrack().
assert_equals(video.textTracks[2].mode, "hidden");
assert_not_equals(video.textTracks[2].cues, null);
assert_equals(video.textTracks[2].cues.length, 0);
// Add another track element, it should insert
// before the addTextTrack() track.
trackElement = document.createElement("track");
trackElement.setAttribute("kind", "metadata");
video.appendChild(trackElement);
assert_equals(video.textTracks.length, 4);
assert_equals(video.textTracks[0].kind, "captions");
assert_equals(video.textTracks[1].kind, "chapters");
assert_equals(video.textTracks[2].kind, "metadata");
assert_equals(video.textTracks[3].kind, "descriptions");
});
</script>

View file

@ -0,0 +1,28 @@
<!doctype html>
<title>Float precision of VTTCue attributes line, position and size</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
test(function() {
var cue = new VTTCue(0, 1, 'text');
// Assign a value which is exactly representable as double but not float.
var doubleValue = 1.000000000000004;
cue.line = doubleValue;
assert_equals(cue.line, doubleValue);
cue.position = doubleValue;
assert_equals(cue.position, doubleValue);
cue.size = doubleValue;
assert_equals(cue.size, doubleValue);
// Assign a value which is exactly representable as float but is non-integral.
var floatValue = 1.5;
cue.line = floatValue;
assert_equals(cue.line, floatValue);
cue.position = floatValue;
assert_equals(cue.position, floatValue);
cue.size = floatValue;
assert_equals(cue.size, floatValue);
}, document.title+', stored as floats');
</script>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<title>Importing a module multiple times with the same specifier</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
window.log = [];
</script>
<script type="module">
import { foo } from './export-something.js';
import { set_foo } from './export-something.js';
import default1 from './export-default.js';
import default2 from './export-default.js';
test(() => {
assert_array_equals(log, ['export-something', 'export-default']);
assert_equals(foo, 42);
set_foo(43);
assert_equals(foo, 43);
assert_equals(default1, "fox");
assert_equals(default2, "fox");
}, 'Duplicated imports with the same specifier');
</script>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<title>Importing a module multiple times with the different specifier</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
window.log = [];
</script>
<script type="module">
import { foo } from './export-something.js';
import { set_foo } from '../module/export-something.js';
import default1 from './export-default.js';
import default2 from '../module/export-default.js';
test(() => {
assert_array_equals(log, ['export-something', 'export-default']);
assert_equals(foo, 42);
set_foo(43);
assert_equals(foo, 43);
assert_equals(default1, "fox");
assert_equals(default2, "fox");
}, 'Duplicated imports with the different specifier');
</script>

View file

@ -0,0 +1,2 @@
log.push("export-default");
export default "fox";

View file

@ -55,6 +55,33 @@
</tr>
</tbody>
</table>
<table id="table10" style="display:none">
<tbody>
<tr>
<td>cell</td>
<td>cell</td>
</tr>
</tbody>
<caption>caption 10</caption>
</table>
<table id="table11" style="display:none">
<caption id="caption11">caption 11</caption>
</table>
<table id="table12" style="display:none">
<caption>caption 1</caption>
<caption>caption 2</caption>
</table>
<table id="table13" style="display:none">
</table>
<table id="table14" style="display:none">
<tbody>
<tr>
<td>cell</td>
<td>cell</td>
</tr>
</tbody>
<caption id="caption14">caption 14</caption>
</table>
<script>
test(function () {
var table0 = document.getElementById('table0');
@ -158,6 +185,92 @@
table9.caption = caption;
});
}, "Assigning a foreign caption to table.caption")
test(function() {
var table = document.createElement("table");
var caption = document.createElement("caption");
caption.innerHTML = "new caption";
table.caption = caption;
assert_equals(caption.parentNode, table);
assert_equals(table.firstChild, caption);
assert_equals(table.caption.innerHTML, "new caption");
}, "Set table.caption when the table doesn't already have a caption")
test(function() {
var table10 = document.getElementById("table10");
var caption = document.createElement("caption");
caption.innerHTML = "new caption";
table10.caption = caption;
assert_equals(caption.parentNode, table10);
assert_equals(table10.firstChild, caption);
assert_equals(table10.caption.innerHTML, "new caption");
var captions = table10.getElementsByTagName('caption');
assert_equals(captions.length, 1);
}, "Set table.caption when the table has a caption child but with other siblings before it")
test(function() {
var table11 = document.getElementById("table11");
var caption = document.createElement("caption");
caption.innerHTML = "new caption";
table11.caption = caption;
assert_equals(caption.parentNode, table11);
assert_equals(table11.firstChild, caption);
assert_equals(table11.caption.innerHTML, "new caption");
var captions = table11.getElementsByTagName('caption');
assert_equals(captions.length, 1);
}, "Set table.caption when the table has a caption descendant")
test(function() {
var table12 = document.getElementById("table12");
var caption = document.createElement("caption");
caption.innerHTML = "new caption";
table12.caption = caption;
assert_equals(caption.parentNode, table12);
assert_equals(table12.firstChild, caption);
assert_equals(table12.caption.innerHTML, "new caption");
var captions = table12.getElementsByTagName('caption');
assert_equals(captions.length, 2);
assert_equals(captions[0].innerHTML, "new caption");
assert_equals(captions[1].innerHTML, "caption 2");
}, "Set table.caption when the table has two caption children")
promise_test(async t => {
var table13 = document.getElementById("table13");
var iframe = document.createElement("iframe");
iframe.srcdoc = '<table><caption id="caption13">caption 13</caption></table>';
document.body.appendChild(iframe);
var iframeWatcher = new EventWatcher(t, iframe, "load");
await iframeWatcher.wait_for("load");
var caption = iframe.contentWindow.document.getElementById("caption13");
table13.caption = caption;
assert_equals(caption.parentNode, table13);
assert_equals(table13.firstChild, caption);
assert_equals(table13.caption.innerHTML, "caption 13");
var captions = table13.getElementsByTagName('caption');
assert_equals(captions.length, 1);
}, "Assigning a caption has a different owner document to table.caption")
test(function() {
var table14 = document.getElementById("table14");
var caption = document.getElementById("caption14");
table14.caption = caption;
assert_equals(caption.parentNode, table14);
assert_equals(table14.firstChild, caption);
var captions = table14.getElementsByTagName('caption');
assert_equals(captions.length, 1);
}, "Assigning the caption already in the table to table.caption")
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!DOCTYPE html>
<title>HTMLAnchorElement relList</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
var element = document.createElement("a");
// Test that setting rel is also setting relList, for both
// valid and invalid values.
element.rel = "whatever";
assert_true(element.relList.contains("whatever"));
element.rel = "prefetch";
assert_true(element.relList.contains("prefetch"));
// Test that add() works.
element.relList.add("preloadwhatever");
assert_equals(element.rel, "prefetch preloadwhatever");
assert_true(element.relList.contains("preloadwhatever"));
// Test that remove() works.
element.relList.remove("preloadwhatever");
assert_equals(element.rel, "prefetch");
assert_false(element.relList.contains("preloadwhatever"));
// Test that toggle() works.
element.relList.toggle("prefetch", false);
assert_equals(element.rel, "");
element.relList.toggle("prefetch", true);
assert_equals(element.rel, "prefetch");
// Test that replace() works.
element.relList.replace("prefetch", "first");
assert_equals(element.rel, "first");
// Test that indexed item getter works.
element.relList.add("second");
assert_equals(element.relList.length, 2);
assert_equals(element.relList[0], "first");
assert_equals(element.relList[1], "second");
// Test that supports() is returning true for valid values
// and false for invalid ones.
assert_false(element.relList.supports("bogus"));
assert_false(element.relList.supports("alternate"));
assert_false(element.relList.supports("author"));
assert_false(element.relList.supports("bookmark"));
assert_false(element.relList.supports("external"));
assert_false(element.relList.supports("help"));
assert_false(element.relList.supports("license"));
assert_false(element.relList.supports("next"));
assert_false(element.relList.supports("nofollow"));
assert_false(element.relList.supports("prev"));
assert_false(element.relList.supports("search"));
assert_false(element.relList.supports("tag"));
assert_true(element.relList.supports("noreferrer"));
assert_true(element.relList.supports("noopener"));
}, "Make sure that relList based feature detection is working");
</script>

View file

@ -0,0 +1,53 @@
<!DOCTYPE html>
<title>HTMLAreaElement relList</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
var element = document.createElement("area");
// Test that setting rel is also setting relList, for both
// valid and invalid values.
element.rel = "whatever";
assert_true(element.relList.contains("whatever"));
element.rel = "prefetch";
assert_true(element.relList.contains("prefetch"));
// Test that add() works.
element.relList.add("preloadwhatever");
assert_equals(element.rel, "prefetch preloadwhatever");
assert_true(element.relList.contains("preloadwhatever"));
// Test that remove() works.
element.relList.remove("preloadwhatever");
assert_equals(element.rel, "prefetch");
assert_false(element.relList.contains("preloadwhatever"));
// Test that toggle() works.
element.relList.toggle("prefetch", false);
assert_equals(element.rel, "");
element.relList.toggle("prefetch", true);
assert_equals(element.rel, "prefetch");
// Test that replace() works.
element.relList.replace("prefetch", "first");
assert_equals(element.rel, "first");
// Test that indexed item getter works.
element.relList.add("second");
assert_equals(element.relList.length, 2);
assert_equals(element.relList[0], "first");
assert_equals(element.relList[1], "second");
// Test that supports() is returning true for valid values
// and false for invalid ones.
assert_false(element.relList.supports("bogus"));
assert_false(element.relList.supports("alternate"));
assert_false(element.relList.supports("author"));
assert_false(element.relList.supports("bookmark"));
assert_false(element.relList.supports("external"));
assert_false(element.relList.supports("help"));
assert_false(element.relList.supports("license"));
assert_false(element.relList.supports("next"));
assert_false(element.relList.supports("nofollow"));
assert_false(element.relList.supports("prev"));
assert_false(element.relList.supports("search"));
assert_false(element.relList.supports("tag"));
assert_true(element.relList.supports("noreferrer"));
assert_true(element.relList.supports("noopener"));
}, "Make sure that relList based feature detection is working");
</script>