Update web-platform-tests to revision 50d6ee076e94273080d9f3b69be0bf4eeae156d3

This commit is contained in:
WPT Sync Bot 2018-08-22 21:45:47 -04:00
parent 3b9055510a
commit 280c87822d
331 changed files with 4209 additions and 866 deletions

View file

@ -39,8 +39,16 @@ promise_test(t => {
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
var acceptChLifetimeLoaded;
async_test(t => {
window.addEventListener('message', function(e) {
acceptChLifetimeLoaded = t.step_func(() => {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("resources/expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
});
window.addEventListener('message', t.step_func((e) => {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
@ -48,15 +56,8 @@ async_test(t => {
return;
assert_equals(e.data, "PASS");
t.done();
})
}));
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("resources/expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
</script>
<!-- Fetching this webpage should cause user-agent to persist client hint

View file

@ -39,8 +39,16 @@ promise_test(t => {
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
var acceptChLifetimeLoaded;
async_test(t => {
window.addEventListener('message', function(e) {
acceptChLifetimeLoaded = t.step_func(() => {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("resources/expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
});
window.addEventListener('message', t.step_func((e) => {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
@ -48,15 +56,9 @@ async_test(t => {
return;
assert_equals(e.data, "PASS");
t.done();
})
}));
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("resources/expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
</script>
<!-- Fetching this webpage should cause user-agent to persist client hint

View file

@ -3,6 +3,7 @@
<head>
<title>Testing @font-face font matching logic introduced in CSS Fonts level 4</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-matching-algorithm" />
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@ -33,6 +34,9 @@
<span style="font-family: 'W100';">A</span>
<span style="font-family: 'W200';">A</span>
<span style="font-family: 'W300';">A</span>
<span style="font-family: 'descriptorPriorityTest'; font-stretch: 125%;">A</span>
<span style="font-family: 'descriptorPriorityTest'; font-style: italic;">A</span>
<span style="font-family: 'descriptorPriorityTest'; font-weight: 350;">A</span>
</span>
<div id="master" class="test">A1 A2 A2 A3 A3 A3</div>
@ -79,36 +83,80 @@
];
descriptorPriorityCases.forEach(function (testCase) {
promise_test(
assert => once_fonts_are_ready.then(assert => {
verifyFont("descriptorPriorityTest", testCase.weight, testCase.style, testCase.stretch, testCase.expectedFamily);
}),
"Descriptor mathcing priority: " + testCase.description
promise_test(() => {
return once_fonts_are_ready
.then(() => verifyFont("descriptorPriorityTest", testCase.weight, testCase.style, testCase.stretch, testCase.expectedFamily));
},
"Descriptor matching priority: " + testCase.description
);
});
function load(family, name, value) {
const el1 = document.createElement("span");
const el2 = document.createElement("span");
el1.innerText = "A";
el2.innerText = "A";
let value1, value2;
if (value.indexOf("deg") > 0) {
value1 = "oblique " + value.split(" ")[1];
value2 = "oblique " + (value.split(" ")[2] || value.split(" ")[1]);
} else {
value1 = value.split(" ")[0];
value2 = value.split(" ")[1] || value1;
}
el1.style[name] = value1;
el2.style[name] = value2;
document.body.appendChild(el1);
document.body.appendChild(el2);
const initialWidth1 = el1.offsetWidth;
const initialWidth2 = el2.offsetWidth;
return new Promise((resolve) => {
el1.style.fontFamily = family;
el2.style.fontFamily = family;
(function check() {
if (el1.offsetWidth !== initialWidth1 && el2.offsetWidth !== initialWidth2) {
el1.remove();
el2.remove();
resolve();
} else {
requestAnimationFrame(check);
}
}());
});
}
function createFontFaceRules(fontFaceFamily, descriptorName, expectedMatch, unexpectedMatch) {
dynamicStyles.innerHTML =
"@font-face { font-family: " + fontFaceFamily + "; src: url('./resources/csstest-weights-100-kerned.ttf'); "+ descriptorName + ": " + expectedMatch + "; }" +
"@font-face { font-family: " + fontFaceFamily + "; src: url('./resources/csstest-weights-200-kerned.ttf'); " + descriptorName + ": " + unexpectedMatch + "; }";
return Promise.all([
load(fontFaceFamily, descriptorName, expectedMatch),
load(fontFaceFamily, descriptorName, unexpectedMatch)
]);
}
let familyId = 0;
function testDescriptor(descriptorName, testCases) {
testCases.forEach(function (testCase) {
// Go though test cases, checking each descriptor has higher priority than next in the list
for(let i = 0; i < testCase.testDescriptors.length - 1; i++) {
let expectedMatch = testCase.testDescriptors[i];
let unexpectedMatch = testCase.testDescriptors[i + 1];
familyId += 1;
const family = "MatchTestFamily" + familyId;
promise_test(
assert => once_fonts_are_ready.then(assert => {
createFontFaceRules("MatchTestFamily", descriptorName, expectedMatch, unexpectedMatch);
() => {
return createFontFaceRules(family, descriptorName, expectedMatch, unexpectedMatch)
.then(() => {
let testWeight = (descriptorName == "font-weight") ? testCase.value : "normal";
let testStyle = (descriptorName == "font-style") ? testCase.value : "normal";
let testStretch = (descriptorName == "font-stretch") ? testCase.value : "normal";
let testWeight = (descriptorName == "font-weight") ? testCase.value : "normal";
let testStyle = (descriptorName == "font-style") ? testCase.value : "normal";
let testStretch = (descriptorName == "font-stretch") ? testCase.value : "normal";
verifyFont("MatchTestFamily", testWeight, testStyle, testStretch, "'W100'");
}),
verifyFont(family, testWeight, testStyle, testStretch, "'W100'");
});
},
"Matching " + descriptorName + ": '" + testCase.value + "' should prefer '" + expectedMatch + "' over '" + unexpectedMatch + "'");
}
});

View file

@ -0,0 +1,11 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS Reference File</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<p>Pass if no space between "A", space between "B".</p>
<div><span style="float:left">A</span>A</div>
<div><span style="float:left">A</span>A</div>
<div>B B</div>
<div>B B</div>
<div>AAB B</div>
<div>AAB B</div>

View file

@ -0,0 +1,31 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS Test: White-spaces around floated ::first-letter</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<link rel="match" href="first-letter-and-whitespace-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-letter-styling">
<meta name="assert" content="Test checks that white-spaces are correctly rendered for floated ::first-letter changes">
<style>
div::first-letter {
color: black;
}
.floatLetter::first-letter {
float: left;
}
</style>
<p>Pass if no space between "A", space between "B".</p>
<div id="t1"> <!---->AA</div>
<div id="t2"> <!---->A<!----> <!---->A</div>
<div id="t3" class="floatLetter"> <!---->B<!----> <!---->B</div>
<div id="t4" class="floatLetter"> <!---->B <!---->B</div>
<div id="t5" class="floatLetter"> <!---->AAB<!----> <!---->B</div>
<div id="t6" class="floatLetter"> <!---->AAB<!----> B</div>
<script>
document.body.offsetTop;
t1.className = "floatLetter";
t2.className = "floatLetter";
t3.className = "";
t4.className = "";
t5.className = "";
t6.className = "";
</script>

View file

@ -0,0 +1,15 @@
<!doctype html>
<title>CSS Test: ShadowRoot with multiple sheet links with the same href shouldn't crash</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="help" href="https://drafts.csswg.org/css-scoping/#selectors-data-model">
<div id="host"></div>
<script>
test(function() {
host.attachShadow({ mode: "open" }).innerHTML = `
<link rel="stylesheet" href="data:text/css,">
<link rel="stylesheet" href="data:text/css,">
`;
}, "Multiple stylesheets with the same href in a ShadowRoot should not assert or crash");
</script>

View file

@ -815,7 +815,7 @@ var calcTestValues = [
// of a dimension and a percentage.
// http://www.w3.org/TR/css3-values/#calc-notation
["calc(25%*3 - 10in)", "calc(75% - 10in)", ["calc(75% - 960px)", "calc(-960px + 75%)"]],
["calc((12.5%*6 + 10in) / 4)", "calc((75% + 10in) / 4)", ["calc((75% + 960px) / 4)", "calc(240px + 18.75%)"]]
["calc((12.5%*6 + 10in) / 4)", "calc((75% + 10in) / 4)", ["calc((75% + 960px) / 4)", "calc(18.75% + 240px)"]]
]
return {

View file

@ -107,10 +107,18 @@ promise_test(async t => {
const timelineTime = animation.timeline.currentTime;
animation.startTime = timelineTime - 100 * MS_PER_SEC;
await eventWatcher.wait_for('transitionstart');
await frameTimeout(
eventWatcher.wait_for('transitionstart'),
2,
'transitionstart'
);
animation.startTime = timelineTime - 200 * MS_PER_SEC;
await eventWatcher.wait_for('transitionend');
await frameTimeout(
eventWatcher.wait_for('transitionend'),
2,
'transitionend'
);
}, 'Seeking a transition using start time dispatches transition events');
</script>

View file

@ -275,4 +275,45 @@ root.waitForAnimationFrames = (frameCount, onFrame) => {
root.waitForAllAnimations = animations =>
Promise.all(animations.map(animation => animation.ready));
/**
* Utility that takes a Promise and a maximum number of frames to wait and
* returns a new Promise that behaves as follows:
*
* - If the provided Promise resolves _before_ the specified number of frames
* have passed, resolves with the result of the provided Promise.
* - If the provided Promise rejects _before_ the specified number of frames
* have passed, rejects with the error result of the provided Promise.
* - Otherwise, rejects with a 'Timed out' error message. If |message| is
* provided, it will be appended to the error message.
*/
root.frameTimeout = (promiseToWaitOn, framesToWait, message) => {
let framesRemaining = framesToWait;
let aborted = false;
const timeoutPromise = new Promise(function waitAFrame(resolve, reject) {
if (aborted) {
resolve();
return;
}
if (framesRemaining-- > 0) {
requestAnimationFrame(() => {
waitAFrame(resolve, reject);
});
return;
}
let errorMessage = 'Timed out waiting for Promise to resolve';
if (message) {
errorMessage += `: ${message}`;
}
reject(new Error(errorMessage));
});
const wrappedPromiseToWaitOn = promiseToWaitOn.then(result => {
aborted = true;
return result;
});
return Promise.race([timeoutPromise, wrappedPromiseToWaitOn]);
};
})(window);

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Motion Path: path(string) paths</title>
<link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
<link rel="match" href="offset-path-string-ref.html">
<meta name="assert" content="This tests that path(<string>) generates a rotation and translation.">
<style>
#target {
position: absolute;
left: 300px;
top: 0px;
width: 300px;
height: 200px;
background-color: lime;
transform-origin: 0px 0px;
offset-path: path('m 0 120 v 200');
}
</style>
</head>
<body>
<div id="target"></div>
</body>
</html>

View file

@ -14,7 +14,7 @@
<script>
// arc path segments must have at least 7 arguments.
// https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
test_invalid_value("offset-path", "path('M 20 30 A 60 70 80')");
test_invalid_value("offset-path", 'path("M 20 30 A 60 70 80")');
test_invalid_value("offset-path", "ray(0 sides)");
test_invalid_value("offset-path", "ray(0deg)");

View file

@ -21,8 +21,8 @@ test_valid_value("offset-path", "ray(270deg farthest-corner contain)");
test_valid_value("offset-path", "ray(-720deg sides)");
test_valid_value("offset-path", "ray(calc(180deg - 45deg) farthest-side)", "ray(calc(135deg) farthest-side)");
test_valid_value("offset-path", "path('m 0 0 h -100')");
test_valid_value("offset-path", "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 300 300 Z')");
test_valid_value("offset-path", 'path("m 0 0 h -100")');
test_valid_value("offset-path", 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 300 300 Z")');
test_valid_value("offset-path", 'url("http://www.example.com/index.html#polyline1")');

View file

@ -17,11 +17,6 @@
width: 50px;
background: lightblue;
}
.inner-md {
height: 100px;
width: 100px;
background: lightblue;
}
.inner-lg-1 {
height: 95px;
width: 95px;

View file

@ -23,11 +23,6 @@
width: 50px;
background: lightblue;
}
.inner-md {
height: 100px;
width: 100px;
background: lightblue;
}
.inner-lg {
height: 200px;
width: 200px;

View file

@ -17,11 +17,6 @@
width: 50px;
background: lightblue;
}
.inner-md {
height: 100px;
width: 100px;
background: lightblue;
}
.inner-lg-1 {
height: 95px;
width: 95px;

View file

@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: 'contain: layout' should force all overflow to be ink overflow.</title>
<title>CSS Test: 'contain: layout' should force all overflow to be ink overflow (including when the overflow comes from floated descendants)</title>
<link rel="author" title="Morgan Rae Reschenberg" href="mailto:mreschenberg@berkeley.edu">
<link rel="help" href="https://drafts.csswg.org/css-contain/#containment-layout">
<link rel="match" href="contain-layout-overflow-002-ref.html">
@ -11,6 +11,7 @@
.contain {
contain: layout;
}
.float { float: left; }
.outer {
height: 100px;
width: 100px;
@ -23,16 +24,10 @@
width: 50px;
background: lightblue;
}
.inner-md {
height: 100px;
width: 100px;
background: lightblue;
}
.inner-lg {
height: 200px;
width: 200px;
background: lightblue;
float: left;
}
.pass {
background: green;
@ -48,24 +43,23 @@
<body>
<!--CSS Test: Elements with contain:layout that do not produce scrollable overflow should paint as if containment were not applied. -->
<div class="outer">
<div class="inner-sm contain" style="float:left;"></div>
<div class="inner-sm contain float"></div>
</div>
<br>
<!--CSS Test: Layout-contained elements that overflow their container and have children who overflow should produce the same amount of scrollable overflow as if there were no children. -->
<div class="outer auto">
<div class="outer contain">
<div class="inner-lg pass"></div>
<div class="inner-lg fail"></div>
<div class="inner-lg contain">
<div class="inner-lg pass float"></div>
<div class="inner-lg fail float"></div>
</div>
</div>
<br>
<!--CSS Test: Layout-contained elements that do not overflow their container, but have children who overflow, should not allow their children to affect the scrollable overflow regions of their parent. -->
<div class="outer auto">
<div class="inner-sm contain border">
<div class="inner-lg">
<div class="inner-lg float">
</div>
</div>
</div>

View file

@ -5607,7 +5607,7 @@ function runConformanceTest(browserTest) {
format_value(browserTest[1][i][1]) + ") " +
(browserTest[1][i][2] ? browserTest[1][i][2] + " " : "") +
"return value"
test(function() {
subsetTest(test, function() {
assert_equals(exception, null, "Setup must not throw an exception");
assert_equals(document.execCommand(browserTest[1][i][0], false, browserTest[1][i][1]),
@ -5640,7 +5640,7 @@ function runConformanceTest(browserTest) {
}
}
test(function() {
subsetTest(test, function() {
assert_equals(exception, null, "Setup must not throw an exception");
// Now test for modifications to non-editable content. First just
@ -5664,7 +5664,7 @@ function runConformanceTest(browserTest) {
"Everything outside the editable div must be unchanged, but some change did occur");
}, testName + " checks for modifications to non-editable content");
test(function() {
subsetTest(test, function() {
assert_equals(exception, null, "Setup must not throw an exception");
assert_equals(testDiv.innerHTML,
@ -5682,7 +5682,7 @@ function runConformanceTest(browserTest) {
'queryCommandValue("' + command + '") after',
];
for (var i = 0; i < 6; i++) {
test(function() {
subsetTest(test, function() {
assert_equals(exception, null, "Setup must not throw an exception");
if (expectedQueryResults[command][i] === null) {

View file

@ -15,6 +15,7 @@
<script src=../data/backcolor.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,9 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-last">
<link rel=stylesheet href=../include/reset.css>
<title>bold - HTML editing conformance tests</title>
@ -15,6 +19,7 @@
<script src=../data/bold.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/createlink.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/delete-list-items-in-table-cells.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,12 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-last">
<link rel=stylesheet href=../include/reset.css>
<title>delete - HTML editing conformance tests</title>
@ -15,6 +22,7 @@
<script src=../data/delete.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<link rel=stylesheet href=../include/reset.css>
<title>fontname - HTML editing conformance tests</title>
@ -15,6 +18,7 @@
<script src=../data/fontname.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<link rel=stylesheet href=../include/reset.css>
<title>fontsize - HTML editing conformance tests</title>
@ -15,6 +18,7 @@
<script src=../data/fontsize.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<link rel=stylesheet href=../include/reset.css>
<title>forecolor - HTML editing conformance tests</title>
@ -15,6 +18,7 @@
<script src=../data/forecolor.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,10 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-last">
<link rel=stylesheet href=../include/reset.css>
<title>formatblock - HTML editing conformance tests</title>
@ -15,6 +20,7 @@
<script src=../data/formatblock.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,12 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-last">
<link rel=stylesheet href=../include/reset.css>
<title>forwarddelete - HTML editing conformance tests</title>
@ -15,6 +22,7 @@
<script src=../data/forwarddelete.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/hilitecolor.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/indent.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/insert-list-items-in-table-cells.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/inserthorizontalrule.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/inserthtml.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/insertimage.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/insertlinebreak.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/insertorderedlist.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,12 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-last">
<link rel=stylesheet href=../include/reset.css>
<title>insertparagraph - HTML editing conformance tests</title>
@ -15,6 +22,7 @@
<script src=../data/insertparagraph.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<link rel=stylesheet href=../include/reset.css>
<title>inserttext - HTML editing conformance tests</title>
@ -15,6 +18,7 @@
<script src=../data/inserttext.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/insertunorderedlist.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<link rel=stylesheet href=../include/reset.css>
<title>italic - HTML editing conformance tests</title>
@ -15,6 +18,7 @@
<script src=../data/italic.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,6 +1,13 @@
<!doctype html>
<meta charset=utf-8>
<meta name=timeout content=long>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-last">
<link rel=stylesheet href=../include/reset.css>
<title>justifycenter - HTML editing conformance tests</title>
@ -16,6 +23,7 @@
<script src=../data/justifycenter.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,10 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-last">
<link rel=stylesheet href=../include/reset.css>
<title>justifyfull - HTML editing conformance tests</title>
@ -15,6 +20,7 @@
<script src=../data/justifyfull.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<link rel=stylesheet href=../include/reset.css>
<title>justifyleft - HTML editing conformance tests</title>
@ -15,6 +18,7 @@
<script src=../data/justifyleft.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,10 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-last">
<link rel=stylesheet href=../include/reset.css>
<title>justifyright - HTML editing conformance tests</title>
@ -15,6 +20,7 @@
<script src=../data/justifyright.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/misc.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-last">
<link rel=stylesheet href=../include/reset.css>
<meta name=timeout content=long>
<title>multitest - HTML editing conformance tests</title>
@ -16,6 +26,7 @@
<script src=../data/multitest.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<link rel=stylesheet href=../include/reset.css>
<title>outdent - HTML editing conformance tests</title>
@ -15,6 +18,7 @@
<script src=../data/outdent.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/removeformat.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<link rel=stylesheet href=../include/reset.css>
<title>strikethrough - HTML editing conformance tests</title>
@ -15,6 +18,7 @@
<script src=../data/strikethrough.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/subscript.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/superscript.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -1,5 +1,8 @@
<!doctype html>
<meta charset=utf-8>
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<link rel=stylesheet href=../include/reset.css>
<title>underline - HTML editing conformance tests</title>
@ -15,6 +18,7 @@
<script src=../data/underline.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -15,6 +15,7 @@
<script src=../data/unlink.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/subset-tests.js"></script>
<script>
"use strict";

View file

@ -0,0 +1,37 @@
// META: script=/common/get-host-info.sub.js
const BASE = location.href;
const IS_HTTPS = new URL(BASE).protocol === 'https:';
const REMOTE_HOST = get_host_info()['REMOTE_HOST'];
const REMOTE_PORT =
IS_HTTPS ? get_host_info()['HTTPS_PORT'] : get_host_info()['HTTP_PORT'];
const REMOTE_ORIGIN =
new URL(`//${REMOTE_HOST}:${REMOTE_PORT}`, BASE).origin;
const DESTINATION = new URL('../resources/cors-top.txt', BASE);
function CreateURL(url, BASE, params) {
const u = new URL(url, BASE);
for (const {name, value} of params) {
u.searchParams.append(name, value);
}
return u;
}
const redirect =
CreateURL('/fetch/api/resources/redirect.py', REMOTE_ORIGIN,
[{name: 'redirect_status', value: 303},
{name: 'location', value: DESTINATION.href}]);
promise_test(async (test) => {
const res = await fetch(redirect.href, {mode: 'no-cors'});
// This is discussed at https://github.com/whatwg/fetch/issues/737.
assert_equals(res.type, 'opaque');
}, 'original => remote => original with mode: "no-cors"');
promise_test(async (test) => {
const res = await fetch(redirect.href, {mode: 'cors'});
assert_equals(res.type, 'cors');
}, 'original => remote => original with mode: "cors"');
done();

View file

@ -1,12 +0,0 @@
<!DOCTYPE html>
<title>Cross-Origin-Resource-Policy in Service Worker</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<script>
service_worker_test(
'fetch.any.js',
'fetch.any.js test');
</script>

View file

@ -1,10 +1,5 @@
// META: global=window,worker
// META: script=/common/get-host-info.sub.js
// META: script=/resources/testharness.js
if (!self.document) {
importScripts("/resources/testharness.js");
importScripts("/common/get-host-info.sub.js");
}
const host = get_host_info();
const path = "/fetch/cross-origin-resource-policy/";

View file

@ -20,6 +20,7 @@ test(function() {
var win = window.open('', '', 'height=1,width=1');
this.add_cleanup(function() { win.close(); });
assert_equals(win.location.href, 'about:blank', 'win.location.href');
assert_equals(win.document.charset, 'UTF-8', 'win.document.charset');
}, 'first argument: empty url');
test(function () {

View file

@ -75,7 +75,7 @@ testText("<div style='display:none'>abc def", "abc def", "No whitespace compre
testText("<div style='display:none'> abc def ", " abc def ", "No removal of leading/trailing whitespace in display:none container");
testText("<div>123<span style='display:none'>abc", "123", "display:none child not rendered");
testText("<div style='display:none'><span id='target'>abc", "abc", "display:none container with non-display-none target child");
testTextInSVG("<div id='target'>abc", "", "non-display-none child of svg");
testTextInSVG("<div id='target'>abc", "abc", "non-display-none child of svg");
testTextInSVG("<div style='display:none' id='target'>abc", "abc", "display:none child of svg");
testTextInSVG("<div style='display:none'><div id='target'>abc", "abc", "child of display:none child of svg");
@ -132,13 +132,13 @@ testText("<iframe>abc", "", "<iframe> contents ignored");
testText("<iframe><div id='target'>abc", "", "<iframe> contents ignored");
testText("<iframe src='data:text/html,abc'>", "","<iframe> subdocument ignored");
testText("<audio style='display:block'>abc", "", "<audio> contents ignored");
testText("<audio style='display:block'><source id='target' class='poke' style='display:block'>", "", "<audio> contents ignored");
testText("<audio style='display:block'><source id='target' class='poke' style='display:none'>", "abc", "<audio> contents ok if display:none");
testText("<audio style='display:block'><source id='target' class='poke' style='display:block'>", "abc", "<audio> contents ok for element not being rendered");
testText("<audio style='display:block'><source id='target' class='poke' style='display:none'>", "abc", "<audio> contents ok for element not being rendered");
testText("<video>abc", "", "<video> contents ignored");
testText("<video style='display:block'><source id='target' class='poke' style='display:block'>", "", "<video> contents ignored");
testText("<video style='display:block'><source id='target' class='poke' style='display:none'>", "abc", "<video> contents ok if display:none");
testText("<video style='display:block'><source id='target' class='poke' style='display:block'>", "abc", "<video> contents ok for element not being rendered");
testText("<video style='display:block'><source id='target' class='poke' style='display:none'>", "abc", "<video> contents ok for element not being rendered");
testText("<canvas>abc", "", "<canvas> contents ignored");
testText("<canvas><div id='target'>abc", "", "<canvas><div id='target'> contents ignored");
testText("<canvas><div id='target'>abc", "abc", "<canvas><div id='target'> contents ok for element not being rendered");
testText("<img alt='abc'>", "", "<img> alt text ignored");
testText("<img src='about:blank' class='poke'>", "", "<img> contents ignored");

View file

@ -1,14 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Structured cloning of SharedArrayBuffers into a dedicated worker nested inside a dedicated worker</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#structuredserialize">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
"use strict";
fetch_tests_from_worker(new Worker("nested-worker-success.js"));
</script>

View file

@ -1,14 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Structured cloning of SharedArrayBuffers into a dedicated worker nested inside a shared worker</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#structuredserialize">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
"use strict";
fetch_tests_from_worker(new SharedWorker("nested-worker-success.js"));
</script>

View file

@ -1,11 +1,9 @@
// META: global=!default,dedicatedworker,sharedworker
// META: script=resources/test-incrementer.js
"use strict";
importScripts("/resources/testharness.js");
importScripts("resources/test-incrementer.js");
promise_test(t => {
const worker = new Worker("resources/incrementer-worker.js");
return testSharingViaIncrementerScript(t, worker, "parent worker", worker, "sub-worker");
}, "postMessaging to a dedicated sub-worker allows them to see each others' modifications");
done();

View file

@ -0,0 +1,18 @@
<!doctype html>
<title>disabled works properly for number inputs</title>
<link rel="help" href="https://html.spec.whatwg.org/#enabling-and-disabling-form-controls:-the-disabled-attribute">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1461706">
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<input type="number" disabled>
<input type="number" disabled style="-moz-appearance: textfield; -webkit-appearance: textfield">
<script>
test(function() {
for (const element of Array.from(document.querySelectorAll('input'))) {
element.focus();
assert_true(element.disabled);
assert_equals(document.activeElement, document.body);
}
}, "disabled works on number input regardless of appearance");
</script>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<title>The fieldset element: block formatting context</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
* {
margin: 0;
padding: 0;
}
fieldset { border: none; }
.float {
float: left;
width: 50px;
height: 50px;
background-color: orange;
}
</style>
<div class=float></div>
<fieldset><div class=float></div></fieldset>
<script>
test(() => {
const fieldset = document.querySelector('fieldset');
assert_equals(fieldset.offsetTop, 0, 'fieldset.offsetTop');
assert_equals(fieldset.offsetLeft, 50, 'fieldset.offsetLeft');
assert_equals(fieldset.clientHeight, 50, 'fieldset.clientHeight');
});
</script>

View file

@ -0,0 +1,61 @@
<!doctype html>
<title>fieldset default style</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
#ref {
display: block;
margin-left: 2px;
margin-right: 2px;
/* TODO replace above declarations with these when they are widely supported.
margin-inline-start: 2px;
margin-inline-end: 2px;
*/
border: groove 2px ThreeDFace;
padding: 0.35em 0.75em 0.625em 0.75em;
/* TODO replace above declarations with these when they are widely supported.
padding-block-start: 0.35em;
padding-inline-end: 0.75em;
padding-block-end: 0.625em;
padding-inline-start: 0.75em;
*/
min-width: min-content;
/* TODO change the above to min-inline-size when it's widely supported. */
}
</style>
<fieldset id=test></fieldset>
<div id=ref></div>
<script>
const testElm = document.querySelector('#test');
const refElm = document.querySelector('#ref');
const props = ['display',
'margin-top',
'margin-right',
'margin-bottom',
'margin-left',
'border-top-style',
'border-right-style',
'border-bottom-style',
'border-left-style',
'border-top-width',
'border-right-width',
'border-bottom-width',
'border-left-width',
'border-top-color',
'border-right-color',
'border-bottom-color',
'border-left-color',
'padding-top',
'padding-right',
'padding-bottom',
'padding-left',
'min-width',
];
const testStyle = getComputedStyle(testElm);
const refStyle = getComputedStyle(refElm);
props.forEach(prop => {
test(() => {
assert_equals(testStyle[prop], refStyle[prop]);
}, `${prop}`);
});
</script>

View file

@ -0,0 +1,41 @@
<!doctype html>
<title>fieldset and CSS display</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
#inline-ref { display: inline-block; }
</style>
<fieldset id="block-ref">x</fieldset>
<fieldset id="inline-ref">x</fieldset>
<fieldset id="test">x</fieldset>
<script>
const blockWidth = getComputedStyle(document.querySelector('#block-ref')).width;
const inlineWidth = getComputedStyle(document.querySelector('#inline-ref')).width;
const testElm = document.querySelector('#test');
const blocks = ['block', 'table', 'table-row-group', 'table-header-group', 'table-footer-group', 'table-row', 'table-cell',
'table-column-group', 'table-column', 'table-caption', 'list-item', 'flow', 'flow-root','run-in'];
const inlines = ['inline', 'inline-block', 'inline-table', 'ruby', 'ruby-base', 'ruby-text', 'ruby-base-container', 'ruby-text-container'];
function test_display(val, expectedWidth) {
test(() => {
testElm.style.removeProperty('display');
testElm.style.display = val;
const computed = getComputedStyle(testElm);
// Note that computed value is different from the used value.
// E.g., if ruby is not supported, the following assertion will
// fail as the computed value of display will be block.
// If ruby is supported, computed.display will return "ruby",
// but the used value is supposed to be "inline".
assert_equals(computed.display, val, `display: ${val} is not supported`);
assert_equals(computed.width, expectedWidth);
}, `fieldset with display: ${val}`);
}
for (const val of blocks) {
test_display(val, blockWidth);
}
for (const val of inlines) {
test_display(val, inlineWidth);
}
</script>

View file

@ -0,0 +1,71 @@
<!DOCTYPE html>
<title>fieldset and CSS Flexbox</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
#test, #ref, #test-inline, #ref-inline {
display: flex;
justify-content: space-around;
margin: 0;
padding: 0;
border: none
}
#test-inline, #ref-inline { display: inline-flex }
</style>
<fieldset id=test>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</fieldset>
<hr>
<div id=ref>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
<hr>
<fieldset id=test-inline>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</fieldset>
<div id=ref-inline>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
<script>
test(() => {
assert_equals(getComputedStyle(document.getElementById('test')).height,
getComputedStyle(document.getElementById('ref')).height);
}, "Flex");
test(() => {
assert_equals(getComputedStyle(document.getElementById('test-inline')).height,
getComputedStyle(document.getElementById('ref-inline')).height);
}, "Inline flex");
</script>

View file

@ -0,0 +1,72 @@
<!DOCTYPE html>
<title>fieldset and CSS Grid</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
#test, #ref, #test-inline, #ref-inline {
display: grid;
grid-template-columns: auto 50px auto;
grid-template-rows: auto 50px auto;
margin: 0;
padding: 0;
border: none
}
#test-inline, #ref-inline { display: inline-grid }
</style>
<fieldset id=test>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</fieldset>
<hr>
<div id=ref>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
<hr>
<fieldset id=test-inline>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</fieldset>
<div id=ref-inline>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
<script>
test(() => {
assert_equals(getComputedStyle(document.getElementById('test')).height,
getComputedStyle(document.getElementById('ref')).height);
}, "Grid");
test(() => {
assert_equals(getComputedStyle(document.getElementById('test-inline')).height,
getComputedStyle(document.getElementById('ref-inline')).height);
}, "Inline grid");
</script>

View file

@ -0,0 +1,29 @@
<!doctype html>
<title>fieldset multicol</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
#test { margin: 0; padding: 0; border: none }
#test, #ref { columns: 5 }
p { margin: 0 }
</style>
<fieldset id=test>
<p>1
<p>2
<p>3
<p>4
<p>5
</fieldset>
<div id=ref>
<p>1
<p>2
<p>3
<p>4
<p>5
</div>
<script>
test(() => {
assert_equals(getComputedStyle(document.getElementById('test')).height,
getComputedStyle(document.getElementById('ref')).height);
});
</script>

View file

@ -0,0 +1,4 @@
<!DOCTYPE html>
<title>Reference for fieldset and overflow</title>
<p>It should say PASS below.</p>
PASS

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>fieldset and overflow</title>
<link rel=match href=fieldset-overflow-hidden-ref.html>
<style>
fieldset { margin:0; padding: 0; overflow: hidden; border: none; border-top: 1em solid transparent; }
legend { padding: 0; }
</style>
<p>It should say PASS below.</p>
<fieldset>
<legend>PASS</legend>
</fieldset>

View file

@ -0,0 +1,10 @@
<!doctype html>
<title>Reference for fieldset painting order</title>
<style>
div { width: 200px; height: 200px; }
#a { background: green; }
#b { background: lime; position: relative; top: -100px; left: 100px; }
</style>
<p>There should be no red.</p>
<div id=a></div>
<div id=b></div>

View file

@ -0,0 +1,17 @@
<!doctype html>
<title>fieldset painting order</title>
<link rel=match href=fieldset-painting-order-ref.html>
<style>
fieldset, legend { margin: 0; padding: 0; }
fieldset {
border: 100px solid red;
width: 0;
min-width: 0;
height: 0;
}
legend { width: 200px; height: 200px; margin-left: -100px; background: green; }
legend > span { float: right; margin-top: 100px; width: 100px; height: 100px; background: red; }
fieldset > div { margin-top: -100px; background: lime; width: 200px; height: 200px; }
</style>
<p>There should be no red.</p>
<fieldset><legend><span></span></legend><div></div></fieldset>

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<title>Reference for Fieldset and transform: translateZ(0)</title>
<style>
fieldset { background: #eee; }
</style>
<p>It should say PASS below without anything obscuring the text.</p>
<fieldset>
<legend>PASS</legend>
</fieldset>

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<title>Fieldset and transform: translateZ(0)</title>
<link rel=match href=fieldset-transform-translatez-ref.html>
<style>
#outer { transform: translateZ(0); }
fieldset { background: #eee; overflow: hidden; margin: 0 0 10px; }
#inner { position: relative; }
</style>
<p>It should say PASS below without anything obscuring the text.</p>
<div id=outer>
<fieldset>
<legend>
<div id="inner">PASS</div>
</legend>
</fieldset>
</div>

View file

@ -0,0 +1,7 @@
<!doctype html>
<title>Reference for floated legend should not disappear</title>
<style>
div { width: 100px; height: 100px; background: lime; }
</style>
<p>There should be no red.</p>
<div></div>

View file

@ -0,0 +1,12 @@
<!doctype html>
<title>floated legend should not disappear</title>
<link rel=match href=legend-float-ref.html>
<style>
fieldset { margin: 0; padding: 0; border: none; width: 100px; height: 50px; background: red; }
legend { width: 100px; height: 50px; background: lime; padding: 0; }
.left { float: left; }
.right { float: right; }
</style>
<p>There should be no red.</p>
<fieldset><legend class=left></legend></fieldset>
<fieldset><legend class=right></legend></fieldset>

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<title>Reference for legend position: relative</title>
<style>
div { display: inline-block; background: lime; }
.a { width: 100px; height: 200px; }
.b { width: 100px; height: 100px; }
.c { width: 200px; height: 200px; }
</style>
<p>There should be no red.</p>
<div class=a></div><div class=b></div><div class=c></div>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>legend position: relative</title>
<link rel=match href=legend-position-relative-ref.html>
<style>
fieldset { border: 100px solid lime; width: 200px; padding: 0; margin: 0 }
legend { position: relative; left: 100px; width: 100px; padding: 0 }
.behind { position: absolute; left: 208px; width: 100px; height: 100px; background: red; z-index: -1 }
</style>
<p>There should be no red.</p>
<div class=behind></div>
<fieldset><legend></legend></fieldset>

View file

@ -0,0 +1,68 @@
<!doctype html>
<title>legend sans fieldset and CSS display</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
* { margin: 0; padding: 0; }
.table, table { display: table; width: 200px; border-collapse: collapse; }
.tbody { display: table-row-group; }
.tr { display: table-row; }
.td, td { display: table-cell; }
.col { display: table-column; }
.caption { display: table-caption; }
.li { display: list-item; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.inline-table { display: inline-table; }
.ruby { display: ruby; }
.rt { display: ruby-text; }
rt { font-size: inherit; }
</style>
<legend class=table>
<legend class=caption>caption</legend>
<legend class=col></legend><legend class=col></legend>
<legend class=tbody>
<legend class=tr>
<legend class=td>td</legend><legend class=td>td</legend>
</legend>
</legend>
</legend>
<table>
<caption>caption</caption>
<col><col>
<tbody>
<tr>
<td>td<td>td
</table>
<ul>
<legend class=li>li</legend>
<li>li</li>
</ul>
<p>foo <legend class=inline>inline</legend> <span>inline</span>
<p>foo <legend class=inline-block>inline-block</legend> <span class=inline-block>inline-block</span>
<p><legend class=ruby>ruby<legend class=rt>rt</legend></legend> <ruby>ruby<rt>rt</ruby>
<script>
function test_display(testSelector, refSelector) {
test(() => {
const testElm = document.querySelector(testSelector);
const refElm = document.querySelector(refSelector);
const testStyle = getComputedStyle(testElm);
const refStyle = getComputedStyle(refElm);
assert_equals(testStyle.display, refStyle.display, testSelector + ' display');
assert_equals(testStyle.width, refStyle.width, testSelector + ' width');
assert_equals(testStyle.height, refStyle.height, testSelector + ' height');
}, testSelector);
}
test_display('.table', 'table');
test_display('.caption', 'caption');
test_display('.col', 'col');
test_display('.tbody', 'tbody');
test_display('.tr', 'tr');
test_display('.td', 'td');
test_display('.li', 'li');
test_display('.inline', 'span');
test_display('.inline-block', 'span.inline-block');
test_display('.ruby', 'ruby');
test_display('.rt', 'rt');
</script>

View file

@ -0,0 +1,39 @@
<!doctype html>
<title>fieldset min-inline-size</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
fieldset { width: 0; height: 0 }
fieldset > div { width: 100px; height: 100px }
#vertical-lr { writing-mode: vertical-lr }
#vertical-rl { writing-mode: vertical-rl }
.override { min-inline-size: 5px }
</style>
<fieldset id=horizontal-tb><div></div></fieldset>
<fieldset id=vertical-lr><div></div></fieldset>
<fieldset id=vertical-rl><div></div></fieldset>
<script>
for (const className of ['', 'override']) {
const expected = className === '' ? '100px' : '5px';
test(() => {
const fieldset = document.getElementById('horizontal-tb');
fieldset.className = className;
assert_equals(getComputedStyle(fieldset).width, expected, 'width');
assert_equals(getComputedStyle(fieldset).height, '0px', 'height');
}, `horizontal-tb ${className}`);
test(() => {
const fieldset = document.getElementById('vertical-lr');
fieldset.className = className;
assert_equals(getComputedStyle(fieldset).width, '0px', 'width');
assert_equals(getComputedStyle(fieldset).height, expected, 'height');
}, `vertical-lr ${className}`);
test(() => {
const fieldset = document.getElementById('vertical-rl');
fieldset.className = className;
assert_equals(getComputedStyle(fieldset).width, '0px', 'width');
assert_equals(getComputedStyle(fieldset).height, expected, 'height');
}, `vertical-rl ${className}`);
}
</script>

View file

@ -1,54 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rendering requirements test (suggested default rendering): fieldset min-width is overridable</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements">
<link rel="help" href="http://drafts.csswg.org/css2/visudet.html#min-max-widths">
<link rel="help" href="http://drafts.csswg.org/css-sizing/#width-height-keywords">
<link rel="match" href="ref.html">
<meta name="flags" content="">
<meta name="assert" content="fieldset's default min-width should be overridable since it's not !important and not spec'd to be non-overridable">
<style>
body {
margin: 10px;
}
#cover {
background-color: green;
position: absolute;
left: 10px;
top: 10px;
height: 100px;
width: 100px;
z-index: 2;
}
fieldset {
min-width: 0;/* property under test */
/* zero these out so it renders more like a div element */
border: none;
margin: 0;
padding: 0;
}
.outer {
width: 100px;
}
.inner {
background-color: red;
color: red;
height: 100px;
overflow: scroll;
white-space: nowrap;
}
</style>
</head>
<body>
<div class="outer">
<fieldset>
<div class="inner">a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a</div>
</fieldset>
</div>
<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
<div id="cover"></div>
</body>
</html>

View file

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rendering requirements Reftest Reference</title>
<style>
body {
margin: 10px;
}
div {
background-color: green;
height: 100px;
width: 100px;
}
</style>
</head>
<body>
<div></div>
<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
</body>
</html>

View file

@ -1,40 +1,41 @@
<!DOCTYPE html>
<head>
<!-- TODO:
askalski: while this test pass, it does not test anything now.
It should test, whether with no document.charset set in any way, the
external scripts will get decoded using utf-8 as fallback character encoding.
It seems like utf-8 is also a fallback encoding to html (my guess), so
the part of the code I was attempting to test is never reached.
-->
<title>Script @type: unknown parameters</title>
<title>Script encoding for document encoding windows-1250</title>
<link rel="author" title="askalski" href="github.com/askalski">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#scriptingLanguages">
<link rel="author" title="Aaqa Ishtyaq" href="github.com/aaqaishtyaq">
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<!-- to avoid conflating tests for script encoding declaring the encoding at the top of file. i.e, windows-1250-->
<meta charset="windows-1250">
<script>
test(function() {
assert_equals(document.characterSet, "windows-1250")
}, "assumption: document encoding is windows-1250");
</script>
<!-- test of step4, which is taking utf-8 as fallback -->
<!-- in this case, neither response's Content Type nor charset attribute bring correct charset information.
Furthermore, document's encoding is not set.-->
-->
<script type="text/javascript"
src="serve-with-content-type.py?fn=external-script-windows1250.js&ct=text/javascript">
</script>
<script>
test(function() {
//these strings should not match, since the tested file is in windows-1250, and fallback is defined as utf-8
assert_not_equals(window.getSomeString().length, 5);
});
//these string should match since, windows-1250 is the fallback encoding.
assert_equals(window.getSomeString(), "\u015b\u0107\u0105\u017c\u017a");
}, "windows-1250 script decoded using document encoding (also windows-1250)");
</script>
<script type="text/javascript"
src="serve-with-content-type.py?fn=external-script-utf8.js&ct=text/javascript">
</script>
<script>
//these strings should match, since fallback utf-8 is the correct setting.
//these strings should match, since this string is the result of decoding the utf-8 text as windows-1250.
test(function() {
assert_equals(window.getSomeString().length, 5);
});
assert_equals(window.getSomeString(), "\u0139\u203a\xc4\u2021\xc4\u2026\u0139\u013d\u0139\u015f");
}, "UTF-8 script decoded using document encoding (windows-1250)");
</script>
</head>

View file

@ -1,16 +0,0 @@
<!doctype html>
<title>Cancelling timeout after document.open</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="/common/blank.html"></iframe>
<script>
var t = async_test();
var iframe;
onload = t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0];
iframe.contentWindow.setTimeout(t.step_func(function() {assert_unreached()}), 100);
assert_equals(iframe.contentDocument.open(), iframe.contentDocument);
setTimeout(function() {t.done();}, 200);
});
</script>

View file

@ -0,0 +1,113 @@
// An older version of the HTML Standard mandated that document.open() remove
// all tasks associated with the document on which open() is called. This step
// has been proposed to be removed. This series of tests ensures that this step
// is no longer executed.
//
// This file comprehensively (but not exhaustively) tests for many queued tasks
// that may be observable. Each taskTest() call in fact runs two tests: the
// first one "tasks without document.open()" does not actually run
// document.open(), just to test that the tested task works ordinarily; the
// second actually calls document.open() to test if the method call removes
// that specific task from the queue.
// This is necessary to allow the promise rejection test below.
setup({
allow_uncaught_exception: true
});
function taskTest(description, testBody) {
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
// The empty HTML seems to be necessary to cajole Chrome and Safari into
// firing a load event asynchronously, which is necessary to make sure the
// frame's document doesn't have a parser associated with it.
// See: https://crbug.com/875354
frame.src = "/common/blank.html";
t.add_cleanup(() => frame.remove());
frame.onload = t.step_func(() => {
// Make sure there is no parser. Firefox seems to have an additional
// non-spec-compliant readiness state "uninitialized", so test for the
// two known valid readiness states instead.
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1191683
assert_in_array(frame.contentDocument.readyState, ["interactive", "complete"]);
testBody(t, frame, doc => {});
});
}, `tasks without document.open() (${description})`);
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
// The empty HTML seems to be necessary to cajole Chrome into firing a load
// event, which is necessary to make sure the frame's document doesn't have
// a parser associated with it.
// See: https://crbug.com/875354
frame.src = "/common/blank.html";
t.add_cleanup(() => frame.remove());
frame.onload = t.step_func(() => {
// Make sure there is no parser. Firefox seems to have an additional
// non-spec-compliant readiness state "uninitialized", so test for the
// two known valid readiness states instead.
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1191683
assert_in_array(frame.contentDocument.readyState, ["interactive", "complete"]);
testBody(t, frame, doc => doc.open());
});
}, `document.open() and tasks (${description})`);
}
taskTest("timeout", (t, frame, open) => {
frame.contentWindow.setTimeout(t.step_func_done(), 100);
open(frame.contentDocument);
});
taskTest("window message", (t, frame, open) => {
let counter = 0;
frame.contentWindow.postMessage(undefined, "*");
open(frame.contentDocument);
frame.contentWindow.postMessage(undefined, "*");
frame.contentWindow.onmessage = t.step_func(e => {
assert_equals(e.data, undefined);
counter++;
assert_less_than_equal(counter, 2);
if (counter == 2) {
t.done();
}
});
});
taskTest("canvas.toBlob()", (t, frame, open) => {
const canvas = frame.contentDocument.body.appendChild(frame.contentDocument.createElement("canvas"));
canvas.toBlob(t.step_func_done());
open(frame.contentDocument);
});
taskTest("MessagePort", (t, frame, open) => {
frame.contentWindow.eval(`({ port1, port2 } = new MessageChannel());`);
frame.contentWindow.port2.onmessage = t.step_func_done(ev => {
assert_equals(ev.data, "Hello world");
});
frame.contentWindow.port1.postMessage("Hello world");
open(frame.contentDocument);
});
taskTest("Promise rejection", (t, frame, open) => {
// There is currently some ambiguity on which Window object the
// unhandledrejection event should be fired on. Here, let's account for that
// ambiguity and allow event fired on _any_ global to pass this test.
// See:
// - https://github.com/whatwg/html/issues/958,
// - https://bugs.webkit.org/show_bug.cgi?id=187822
const promise = frame.contentWindow.eval("Promise.reject(42);");
open(frame.contentDocument);
const listener = t.step_func_done(ev => {
assert_equals(ev.promise, promise);
assert_equals(ev.reason, 42);
});
frame.contentWindow.onunhandledrejection = listener;
window.onunhandledrejection = listener;
});
taskTest("marquee start", (t, frame, open) => {
const doc = frame.contentDocument;
const marquee = doc.body.appendChild(doc.createElement("marquee"));
open(frame.contentDocument);
marquee.addEventListener("start", t.step_func_done());
});

View file

@ -1,29 +0,0 @@
<title>Input Event IDL tests</title>
<link rel="help" href="https://w3c.github.io/input-events/#h-interface-inputevent"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<script>
"use strict";
function doTest([input_events]) {
const idl_array = new IdlArray();
idl_array.add_untested_idls('interface InputEvent {};');
idl_array.add_untested_idls('dictionary InputEventInit {};');
idl_array.add_idls(input_events);
idl_array.add_objects({
InputEvent: ['new InputEvent("foo")'],
});
idl_array.test();
}
function fetchText(url) {
return fetch(url).then((response) => response.text());
}
promise_test(() => {
return Promise.all(["/interfaces/input-events.idl"].map(fetchText))
.then(doTest);
}, "Test IDL implementation of Input Events");
</script>

View file

@ -0,0 +1,14 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
idl_test(
['input-events'],
['uievents', 'dom'],
idl_array => {
idl_array.add_objects({
InputEvent: ['new InputEvent("foo")'],
});
}
);

View file

@ -161,6 +161,7 @@ SET TIMEOUT: html/semantics/embedded-content/the-iframe-element/*
SET TIMEOUT: html/semantics/embedded-content/the-img-element/*
SET TIMEOUT: html/semantics/scripting-1/the-script-element/*
SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/0*
SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window.js
SET TIMEOUT: html/webappapis/scripting/event-loops/*
SET TIMEOUT: html/webappapis/scripting/events/event-handler-processing-algorithm-error/*
SET TIMEOUT: html/webappapis/scripting/processing-model-2/*

View file

@ -35,7 +35,7 @@ test(() => {
* @param PaymentOptions options
*/
async function getPaymentResponse(options, id) {
const { response } = getPaymentRequestResponse(options, id);
const { response } = await getPaymentRequestResponse(options, id);
return response;
}

View file

@ -0,0 +1,14 @@
<!doctype html>
<meta charset=utf-8>
<title>PaymentResponse.prototype.onpayerdetailschange attribute</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
test(() => {
assert_equals(Object.getPrototypeOf(PaymentResponse), window.EventTarget);
}, "PaymentResponse inherits from EventTarget");
test(() => {
assert_true("onpayerdetailchange" in PaymentResponse.prototype);
}, "PaymentResponse has an onpayerdetailchange in the prototype chain");
</script>

View file

@ -0,0 +1,66 @@
<!doctype html>
<meta charset=utf-8>
<title>PaymentResponse.prototype.onpayerdetailchange attribute</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="helpers.js"></script>
<script>
function runTest(button, options, expected){
button.disabled = true;
promise_test(async () => {
const response = await getPaymentResponse(options);
const eventPromise = new Promise(resolve => {
response.addEventListener("payerdetailchange", resolve);
});
const error = button.previousElementSibling.textContent.trim();
const retryPromise = response.retry({ error });
const event = await eventPromise;
assert_true(event instanceof PaymentRequestUpdateEvent);
for(const [prop, value] of Object.entries(expected)){
assert_equals(response[prop], value);
}
await response.complete("success");
}, button.textContent.trim());
}
</script>
<h2>Handling PaymentResponse.prototype.onpayerdetailchange events</h2>
<p>
Each button will bring up the Payment Request UI window.
When shown the payment sheet, use any details and hit pay.
</p>
<p>
When asked to retry the payment:
</p>
<ol>
<li>
<p>
Change payer's name to "pass".
</p>
<button onclick="runTest(this, { requestPayerName: true }, { payerName: 'pass' });">
PaymentRequestUpdateEvent is dispatched when payer name changes.
</button>
</li>
<li>
<p>
Change payer's email to "pass@pass.pass".
</p>
<button onclick="runTest(this, {requestPayerEmail: true}, { payerEmail: 'pass@pass.pass' });">
PaymentRequestUpdateEvent is dispatched when payer email changes.
</button>
</li>
<li>
<p>
Change payer's phone to "+1-800-000-0000".
</p>
<button onclick="runTest(this, {requestPayerPhone: true}, { payerPhone: '+1-800-000-0000' })">
PaymentRequestUpdateEvent is dispatched when payer phone changes.
</button>
</li>
<li>
<button onclick="done();">DONE!</button>
</li>
</ol>
<small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>.
</small>

View file

@ -131,10 +131,22 @@ function userCanAbortARetry(button) {
}, button.textContent.trim());
}
function userIsShownErrorsFields(button) {
button.disabled = true;
promise_test(async t => {
const { response, request } = await getPaymentRequestResponse({ requestShipping: true });
const retryPromise = response.retry({
shippingAddress: { city: "Invalid city", addressLine: "Invalid address line" },
});
await retryPromise;
await response.complete("success");
}, button.textContent.trim());
}
function abortTheUpdate(button) {
button.disabled = true;
promise_test(async t => {
const { response, request } = await getPaymentRequestResponse();
const { response, request } = await getPaymentRequestResponse({ requestShipping: true });
// causes "abort the update" to run
const shippingChangedPromise = new Promise(resolve => {
request.onshippingoptionchange = () => {
@ -146,7 +158,7 @@ function abortTheUpdate(button) {
await shippingChangedPromise;
await promise_rejects(
t,
"TypeError",
new TypeError(),
retryPromise,
"retry() aborts with a TypeError, because totals' value is invalid"
);
@ -162,12 +174,12 @@ function abortTheUpdate(button) {
function callingRetryReturnsUniquePromise(button){
button.disabled = true;
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const retryPromise = request.retry();
const { response } = await getPaymentRequestResponse();
const retryPromise = response.retry({});
const promises = new Set([
retryPromise,
request.retry(),
request.retry(),
response.retry({}),
response.retry({}),
]);
assert_equals(promises.size, 3, "Must have three unique objects");
await retryPromise;

View file

@ -9,7 +9,11 @@ class ChromeXRTest {
}
simulateDeviceConnection(init_params) {
return Promise.resolve(this.mockVRService_.addDevice(init_params));
return Promise.resolve(this.mockVRService_.addRuntime(init_params));
}
simulateDeviceDisconnection(device) {
this.mockVRService_.removeRuntime(device);
}
simulateUserActivation(callback) {
@ -30,10 +34,12 @@ class ChromeXRTest {
}
// Mocking class definitions
// Mock service implements both the VRService and XRDevice mojo interfaces.
class MockVRService {
constructor() {
this.bindingSet_ = new mojo.BindingSet(device.mojom.VRService);
this.devices_ = [];
this.runtimes_ = [];
this.interceptor_ =
new MojoInterfaceInterceptor(device.mojom.VRService.name);
@ -43,31 +49,87 @@ class MockVRService {
}
// Test methods
addDevice(fakeDeviceInit) {
let device = new MockDevice(fakeDeviceInit, this);
this.devices_.push(device);
addRuntime(fakeDeviceInit) {
let runtime = new MockRuntime(fakeDeviceInit, this);
this.runtimes_.push(runtime);
if (this.client_) {
this.client_.onDeviceChanged();
}
return device;
return runtime;
}
removeRuntime(runtime) {
// We have no way of distinguishing between devices, so just clear the
// entire list for now.
// TODO(http://crbug.com/873409) We also have no way right now to disconnect
// devices.
this.runtimes_ = [];
}
// VRService implementation.
requestDevice() {
return Promise.resolve(
{device: this.devices_[0] ? this.devices_[0].getDevicePtr() : null});
if (this.runtimes_.length > 0) {
let devicePtr = new device.mojom.XRDevicePtr();
new mojo.Binding(
device.mojom.XRDevice, this, mojo.makeRequest(devicePtr));
return Promise.resolve({device: devicePtr});
} else {
return Promise.resolve({device: null});
}
}
setClient(client) {
this.client_ = client;
}
// XRDevice implementation.
requestSession(sessionOptions, was_activation) {
let requests = [];
// Request a session from all the runtimes.
for (let i = 0; i < this.runtimes_.length; i++) {
requests[i] = this.runtimes_[i].requestRuntimeSession(sessionOptions);
}
return Promise.all(requests).then((results) => {
// Find and return the first successful result.
for (let i = 0; i < results.length; i++) {
if (results[i].session) {
return results[i];
}
}
// If there were no successful results, returns a null session.
return {session: null};
});
}
supportsSession(sessionOptions) {
let requests = [];
// Check supports on all the runtimes.
for (let i = 0; i < this.runtimes_.length; i++) {
requests[i] = this.runtimes_[i].runtimeSupportsSession(sessionOptions);
}
return Promise.all(requests).then((results) => {
// Find and return the first successful result.
for (let i = 0; i < results.length; i++) {
if (results[i].supportsSession) {
return results[i];
}
}
// If there were no successful results, returns false.
return {supportsSession: false};
});
};
}
// Implements both XRDevice and VRMagicWindowProvider. Maintains a mock for
// XRPresentationProvider.
class MockDevice {
// Implements XRFrameDataProvider and XRPresentationProvider. Maintains a mock
// for XRPresentationProvider.
class MockRuntime {
constructor(fakeDeviceInit, service) {
this.sessionClient_ = new device.mojom.XRSessionClientPtr();
this.presentation_provider_ = new MockXRPresentationProvider();
@ -86,13 +148,6 @@ class MockDevice {
}
}
// Functions for setup.
getDevicePtr() {
let devicePtr = new device.mojom.XRDevicePtr();
new mojo.Binding(device.mojom.XRDevice, this, mojo.makeRequest(devicePtr));
return devicePtr;
}
// Test methods.
setXRPresentationFrameData(poseMatrix, views) {
if (poseMatrix == null) {
@ -273,9 +328,10 @@ class MockDevice {
// do not have any use for this data at present.
}
// XRDevice implementation.
requestSession(sessionOptions, was_activation) {
return this.supportsSession(sessionOptions).then((result) => {
// Utility function
requestRuntimeSession(sessionOptions) {
return this.runtimeSupportsSession(sessionOptions).then((result) => {
// The JavaScript bindings convert c_style_names to camelCase names.
let options = new device.mojom.XRPresentationTransportOptions();
options.transportMethod =
@ -320,7 +376,7 @@ class MockDevice {
});
}
supportsSession(options) {
runtimeSupportsSession(options) {
return Promise.resolve({
supportsSession:
!options.immersive || this.displayInfo_.capabilities.canPresent

View file

@ -0,0 +1,77 @@
<!doctype html>
<meta charset=utf-8>
<title>RTCDTMFSender.prototype.insertDTMF</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
// Constraint parameter has a default value of {audio:false, video: false}.
promise_test(function() {
assert_idl_attribute(navigator, 'getDisplayMedia');
return navigator.getDisplayMedia()
.then(function(s) {
fail('getDisplayMedia should have failed');
})
.catch(function(e) {
assert_equals(e.name, 'TypeError');
});
}, 'getDisplayMedia() with no constraints');
promise_test(function() {
assert_idl_attribute(navigator, 'getDisplayMedia');
return navigator.getDisplayMedia({video: true}).then(function(s) {
assert_equals(s.getVideoTracks().length, 1);
assert_equals(s.getAudioTracks().length, 0);
});
}, 'getDisplayMedia() with video true');
promise_test(function() {
assert_idl_attribute(navigator, 'getDisplayMedia');
return navigator.getDisplayMedia({video: false})
.then(function(s) {
fail('getDisplayMedia should have failed');
})
.catch(function(e) {
assert_equals(e.name, 'TypeError');
});
}, 'getDisplayMedia() with video false');
promise_test(function() {
assert_idl_attribute(navigator, 'getDisplayMedia');
return navigator.getDisplayMedia({audio: true}).then(function(s) {
assert_equals(s.getVideoTracks().length, 0);
assert_equals(s.getAudioTracks().length, 1);
});
}, 'getDisplayMedia() with audio true');
promise_test(function() {
assert_idl_attribute(navigator, 'getDisplayMedia');
return navigator.getDisplayMedia({audio: false})
.then(function(s) {
fail('getDisplayMedia should have failed');
})
.catch(function(e) {
assert_equals(e.name, 'TypeError');
});
}, 'getDisplayMedia() with audio false');
promise_test(function() {
assert_idl_attribute(navigator, 'getDisplayMedia');
return navigator
.getDisplayMedia({audio: false, video: {width: 1280, height: 720}})
.then(function(s) {
fail('getDisplayMedia should have failed');
})
.catch(function(e) {
assert_equals(e.name, 'InvalidAccessError');
});
}, 'getDisplayMedia() call with non-bool constraint');
</script>

View file

@ -1,38 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>scroll-animations IDL tests</title>
<link rel="help" href="https://wicg.github.io/scroll-animations/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<script>
'use strict';
promise_test(async () => {
const idl = await fetch('/interfaces/scroll-animations.idl').then(r => r.text());
const web = await fetch('/interfaces/web-animations.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(web);
idl_array.add_dependency_idls(dom);
idl_array.add_objects({
ScrollTimeline: ['new ScrollTimeline()'],
});
idl_array.test();
}, 'Test scroll-animations IDL implementation');
</script>
<div id="log"></div>
</body>
</html>

View file

@ -0,0 +1,16 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
idl_test(
['scroll-animations'],
// The css-pseudo dependency shouldn't be necessary, but is:
// https://github.com/web-platform-tests/wpt/issues/12574
['web-animations', 'css-pseudo', 'dom'],
idl_array => {
idl_array.add_objects({
ScrollTimeline: ['new ScrollTimeline()'],
});
}
);

View file

@ -51,4 +51,20 @@ promise_test(async (t) => {
idlArray.test();
});
}, 'test setup (worker registration)');
promise_test(t => {
const url = encodeURI(`data:text/html,<!DOCTYPE html>
<script>
parent.postMessage({ isDefined: 'serviceWorker' in navigator }, '*');
</` + `script>`);
var p = new Promise((resolve, reject) => {
window.addEventListener('message', event => {
resolve(event.data.isDefined);
});
});
with_iframe(url);
return p.then(isDefined => {
assert_false(isDefined, 'navigator.serviceWorker should not be defined in iframe');
});
}, 'navigator.serviceWorker is not available in a data: iframe');
</script>

View file

@ -79,20 +79,6 @@ promise_test(function(t) {
});
}, 'Same-origin blob URL worker should intercept fetch().');
promise_test(function(t) {
// Data URLs should result in an opaque origin and should probably not
// have access to a cross-origin service worker. See:
//
// https://github.com/w3c/ServiceWorker/issues/1262
//
return doAsyncTest(t, {
scheme: 'data',
child: 'iframe',
check: 'controller',
expect: 'not inherit',
});
}, 'Data URL iframe should not inherit service worker controller.');
promise_test(function(t) {
return doAsyncTest(t, {
scheme: 'data',

Some files were not shown because too many files have changed in this diff Show more