Update web-platform-tests to revision 10168e9a5d44efbc6e7d416d1d454eb9c9f1396c

This commit is contained in:
Josh Matthews 2018-01-31 09:13:41 -05:00
parent c88dc51d03
commit 0e1caebaf4
791 changed files with 23381 additions and 5501 deletions

View file

@ -2,8 +2,13 @@
<title>canPlayType</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<audio id="audio"></audio>
<video id="video"></video>
<div id="log"></div>
<script>
let VIDEO_ELEM = document.getElementById('video');
let AUDIO_ELEM = document.getElementById('audio');
function t(type, expected) {
assert_equals(canPlayType(type), expected, type);
}
@ -22,12 +27,13 @@ test(function() {
}, 'utility code');
function canPlayType(type) {
var canPlay = document.createElement('audio').canPlayType(type);
assert_equals(canPlay, document.createElement('video').canPlayType(type),
let audioCanPlay = AUDIO_ELEM.canPlayType(type);
let videoCanPlay = VIDEO_ELEM.canPlayType(type);
assert_equals(audioCanPlay, videoCanPlay,
'audio.canPlayType() and video.canPlayType() agree');
assert_in_array(canPlay, ['', 'maybe', 'probably'],
assert_in_array(audioCanPlay, ['', 'maybe', 'probably'],
'return value is one of "", "maybe" and "probably"');
return canPlay;
return audioCanPlay;
}
test(function() {
@ -37,20 +43,22 @@ test(function() {
t('application/octet-stream; codecs="mp4a.40.2"', '');
t('application/octet-stream; codecs="theora, vorbis"', '');
t('application/octet-stream; codecs="avc1.42E01E, mp4a.40.2"', '');
}, 'application/octet-stream');
}, 'application/octet-stream not supported');
test(function() {
t('application/marks-fantasmagorical-format', '');
t('video/x-new-fictional-format', '');
t('video/x-new-fictional-format;codecs="kittens,bunnies"', '');
}, 'video/x-new-fictional-format');
}, 'fictional formats and codecs not supported');
function type_codecs_test(type, audioCodecs, videoCodecs) {
var typeSupported = false;
var codecSupported = false;
// Test 'type' without codecs.
// Spec: Generally, a user agent should never return "probably" for a type
// that allows the codecs parameter if that parameter is not present.
test(function() {
// Spec: Generally, a user agent should never return "probably" for a type
// that allows the codecs parameter if that parameter is not present.
t(type, 'maybe');
t(type + ';', 'maybe');
t(type + ';codecs', 'maybe');
@ -66,9 +74,11 @@ function type_codecs_test(type, audioCodecs, videoCodecs) {
}, typeWithCodec + ' (optional)');
}
// Test each audio and video codec separately.
audioCodecs.forEach(test_codec);
videoCodecs.forEach(test_codec);
// Test different pairings and orderings of audio+video codecs.
if (audioCodecs.length > 0 && videoCodecs.length > 0) {
test(function() {
audioCodecs.forEach(function(ac) {

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/common/reftest-wait.js"></script>
<title>Text track cue layout after controls are added (reference)</title>
<style>
::cue {
font-size: 50px;
}
/* Video width should be large enough to display all of the media controls. */
video {
border: 1px solid gray;
width: 500px;
}
</style>
<video controls onloadeddata="this.onloadeddata = null; takeScreenshot();">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
</video>
<script>
// Add a single cue at line -2, where it would be if there were controls visible
// at the bottom. (This assumes that those controls are less than 50px high.)
// cue at line -1.
var video = document.querySelector("video");
var track = video.addTextTrack("captions");
var cue = new VTTCue(0, 1, "text");
cue.line = -2;
track.addCue(cue);
track.mode = "showing";
</script>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/common/reftest-wait.js"></script>
<link rel="match" href="track-cue-rendering-after-controls-added-ref.html">
<title>Text track cue layout after controls are added</title>
<style>
::cue {
font-size: 50px;
}
</style>
<!-- Width should be large enough to display all of the media controls. -->
<video style="border:1px solid gray; width: 500px;">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
</video>
<script>
// Add a cue that will overlap with the video controls.
var video = document.querySelector("video");
var track = video.addTextTrack("captions");
track.addCue(new VTTCue(0, 1, "text"));
track.mode = "showing";
video.onloadeddata = function() {
// Double nesting of requestAnimationFrame to
// make sure cue layout and paint happens.
window.requestAnimationFrame(function() {
window.requestAnimationFrame(function() {
video.controls = true;
// Wait for the relayout before screenshot.
window.requestAnimationFrame(function() {
takeScreenshot();
});
});
});
};
</script>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/common/reftest-wait.js"></script>
<title>Text track cue layout after controls are removed (reference)</title>
<style>
::cue {
font-size: 50px;
}
video {
border: 1px solid gray;
}
</style>
<video onloadeddata="this.onloadeddata = null; takeScreenshot();">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
</video>
<script>
// Add a single cue at line -2, where it would be if there were controls visible
// at the bottom. (This assumes that those controls are less than 50px high.)
// cue at line -1.
var video = document.querySelector("video");
var track = video.addTextTrack("captions");
var cue = new VTTCue(0, 1, "text");
cue.line = -2;
track.addCue(cue);
track.mode = "showing";
</script>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/common/reftest-wait.js"></script>
<link rel="match" href="track-cue-rendering-after-controls-removed-ref.html">
<title>Text track cue layout after controls are removed</title>
<style>
::cue {
font-size: 50px;
}
</style>
<video controls style="border:1px solid gray">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
</video>
<script>
// Add a cue that will overlap with the video controls.
var video = document.querySelector("video");
var track = video.addTextTrack("captions");
track.addCue(new VTTCue(0, 1, "text"));
track.mode = "showing";
video.onloadeddata = function() {
// Double nesting of requestAnimationFrame to
// make sure cue layout and paint happens.
window.requestAnimationFrame(function() {
window.requestAnimationFrame(function() {
// Remove the controls. The cue should not move.
video.controls = false;
takeScreenshot();
});
});
};
</script>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html class="reftest-wait">
<title>Reference test for track-webvtt-non-snap-to-lines.html</title>
<script src="/common/reftest-wait.js"></script>
<script src="/common/media.js"></script>
<style>
.container {
position: relative;
display: inline-block;
}
.cue {
position: absolute;
top: 48px;
font-family: sans-serif;
background: green;
color: rgba(255, 255, 255, 1);
font-size: 12px;
padding: 0px 2px;
}
</style>
<div class="container">
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();">
<script>
document.currentScript.parentNode.src = getVideoURI("/media/test");
</script>
</video>
<span class="cue">Bear is Coming!!!!!</span>
</div>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html class="reftest-wait">
<title>Position is not adjusted for non snap-to-lines cues</title>
<link rel="match" href="track-webvtt-non-snap-to-lines-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/common/media.js"></script>
<style>
::cue {
background: green;
}
</style>
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();"></video>
<script>
var video = document.querySelector("video");
var track = video.addTextTrack("captions");
var cue = new VTTCue(0, 1, "Bear is Coming!!!!!");
cue.snapToLines = false;
cue.line = 20;
cue.align = "left";
track.addCue(cue);
track.mode = "showing";
video.src = getVideoURI("/media/test");
</script>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html class="reftest-wait">
<title>WebVTT two-cue layout after the first cue has ended (reference)</title>
<script src="/common/reftest-wait.js"></script>
<video style="border:1px solid gray">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
</video>
<script>
// Add a single cue at line -2, where it would be if there was a first
// cue at line -1.
var video = document.querySelector("video");
var track = video.addTextTrack("captions");
var cue = new VTTCue(0, 3, "cue 2");
cue.line = -2;
track.addCue(cue);
track.mode = "showing";
video.onloadeddata = function() {
takeScreenshot();
};
</script>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html class="reftest-wait">
<title>WebVTT two-cue layout after the first cue has ended</title>
<link rel="match" href="track-webvtt-two-cue-layout-after-first-end-ref.html">
<script src="/common/reftest-wait.js"></script>
<video style="border:1px solid gray">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
</video>
<script>
// Add two cues, where the first cue ends before the second.
var video = document.querySelector("video");
var track = video.addTextTrack("captions");
track.addCue(new VTTCue(0, 1, "cue 1"));
track.addCue(new VTTCue(0, 3, "cue 2"));
track.mode = "showing";
video.onloadeddata = function() {
// Double nesting of requestAnimationFrame to
// make sure cue layout and paint happens.
window.requestAnimationFrame(function() {
window.requestAnimationFrame(function() {
// Seek past the end of the first cue. The second cue should not move.
video.currentTime = 2;
video.onseeked = function() { takeScreenshot(); };
});
});
};
</script>
</html>

View file

@ -0,0 +1,80 @@
<!DOCTYPE html>
<title>Test relList attribute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
let link_support_table = {};
// https://html.spec.whatwg.org/multipage/links.html#linkTypes
link_support_table['link'] = {
supported : ['modulepreload', 'preload', 'preconnect', 'dns-prefetch',
'stylesheet', 'import', 'icon', 'alternate', 'prefetch',
'prerender', 'next', 'manifest', 'apple-touch-icon',
'apple-touch-icon-precomposed', 'canonical'],
unsupported : ['author', 'bookmark', 'external', 'help', 'license',
'nofollow', 'pingback', 'prev', 'search', 'tag',
'noreferrer', 'noopener']
};
link_support_table['a'] = {
supported : ['noreferrer', 'noopener'],
unsupported : ['author', 'bookmark', 'external', 'help', 'license',
'nofollow', 'pingback', 'prev', 'search', 'tag',
'modulepreload', 'preload', 'preconnect', 'dns-prefetch',
'stylesheet', 'import', 'icon', 'alternate', 'prefetch',
'prerender', 'next', 'manifest', 'apple-touch-icon',
'apple-touch-icon-precomposed', 'canonical']
};
link_support_table['area'] = link_support_table['a'];
function test_rellist(tag_name, rel_table) {
let element = document.createElement(tag_name);
let tag = element.tagName;
// Test that setting rel is also setting relList, for both
// valid and invalid values.
element.rel = 'whatever';
assert_true(element.relList.contains('whatever'), 'tag = ' + tag + ', setting rel must work');
element.rel = 'prefetch';
assert_true(element.relList.contains('prefetch'), 'tag = ' + tag + ', setting rel must work');
// Test that add() works.
element.relList.add('preloadwhatever');
assert_equals(element.rel, 'prefetch preloadwhatever', 'tag = ' + tag + ', add must work');
assert_true(element.relList.contains('preloadwhatever'), 'tag = ' + tag + ', add must work');
// Test that remove() works.
element.relList.remove('preloadwhatever');
assert_equals(element.rel, 'prefetch', 'tag = ' + tag + ', remove must work');
assert_false(element.relList.contains('preloadwhatever'), 'tag = ' + tag + ', remove must work');
// Test that toggle() works.
element.relList.toggle('prefetch', false);
assert_equals(element.rel, '', 'tag = ' + tag + ', toggle must work');
element.relList.toggle('prefetch', true);
assert_equals(element.rel, 'prefetch', 'tag = ' + tag + ', toggle must work');
// Test that replace() works.
element.relList.replace('prefetch', 'first');
assert_equals(element.rel, 'first', 'tag = ' + tag + ', replace must work');
// Test that indexed item getter works.
element.relList.add('second');
assert_equals(element.relList.length, 2, 'tag = ' + tag + ', relList length must be correct');
assert_equals(element.relList[0], 'first', 'tag = ' + tag + ', relList indexed item must work');
assert_equals(element.relList[1], 'second', 'tag = ' + tag + ', relList indexed item must work');
// Test that relList is [SameObject].
let savedRelList = element.relList;
element.rel = 'something';
assert_equals(element.relList, savedRelList, 'tag = ' + tag + ', SameObject must work');
// Test that supports() is returning true for valid values
// and false for invalid ones.
let supported = rel_table['supported'];
for (let link_type in supported) {
assert_true(element.relList.supports(supported[link_type]), 'tag = ' + tag + ', link type = ' + supported[link_type] + ' must be supported');
}
let unsupported = rel_table['unsupported'];
for (let link_type in unsupported) {
assert_false(element.relList.supports(unsupported[link_type]), 'tag = ' + tag + ', link type = ' + unsupported[link_type] + ' must be unsupported');
}
}
test(function() {
test_rellist('LINK', link_support_table['link']);
test_rellist('A', link_support_table['a']);
test_rellist('AREA', link_support_table['area']);
}, 'Make sure that relList based feature detection is working');
</script>

View file

@ -0,0 +1,29 @@
<html>
<head>
<title>Inline async module script execution order</title>
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
let loaded = [];
let test = async_test("Inline async module script execution order");
window.addEventListener("load", test.step_func(function() {
assert_array_equals(loaded,
["fast", "fast", "fast", "slow", "slow", "slow"]);
test.done();
}));
</script>
<script type="module" async src="resources/slow-module.js?pipe=trickle(d2)&unique=1"></script>
<script type="module" async>
import "./resources/slow-module.js?pipe=trickle(d2)&unique=2";
loaded.push("slow");
</script>
<script type="module" async src="resources/fast-module.js?unique=1"></script>
<script type="module" async>
import "./resources/fast-module.js?unique=2";
loaded.push("fast");
</script>
</body>
</html>

View file

@ -59,4 +59,3 @@ document.head.appendChild(script4_dynamic_error);
<script onload="onLoad(test4_load);" onerror="onError(test4_load);" type="module" async>"use strict";onExecute(test4_load);</script>
<script onload="onLoad(test1_error);" onerror="onError(test1_error);" type="module">"use strict";import "./not_found.js";</script>
<script onload="onLoad(test4_error);" onerror="onError(test4_error);" type="module" async>"use strict";import "./not_found.js";</script>
</script>

View file

@ -10,7 +10,11 @@
window.evaluated_module_script = true;
</script>
<script>
test(() => assert_true(window.evaluated_module_script), "module script in XHTML documents should be evaluated.");
var test = async_test("module script in XHTML documents should be evaluated.");
window.addEventListener("load", () => {
test.step(() => { assert_true(window.evaluated_module_script); });
test.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,3 @@
// This module is imported with pipe=trickle(d2) to make it load more slowly
// than fast-module.js
loaded.push("slow");

View file

@ -1,57 +0,0 @@
<!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 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.
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

@ -1,57 +0,0 @@
<!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 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.
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>