Update web-platform-tests to revision c583bcd7eb30f38cb2d673031cde245776f1da5a

This commit is contained in:
WPT Sync Bot 2018-11-02 21:35:53 -04:00
parent ba1ed11ced
commit bd791500b2
107 changed files with 2870 additions and 469 deletions

View file

@ -82,7 +82,7 @@ matrix:
apt:
packages:
- libnss3-tools
env: JOB=wpt_integration TOXENV=py27,py27-flake8 SCRIPT=tools/ci/ci_wpt.sh
env: JOB=wpt_integration TOXENV=py27 SCRIPT=tools/ci/ci_wpt.sh
- name: "resources/ tests"
if: type = pull_request
os: linux

View file

@ -43,6 +43,19 @@
}, val[0])
})
;["Request", "Response"].forEach(val => {
test(() => {
const obj = new self[0][val]("about:blank");
assert_global(obj);
const cloneObj = obj.clone();
assert_global(cloneObj);
const involvedCloneObj = self[val].prototype["clone"].call(cloneObj);
assert_global(cloneObj);
}, val)
})
// Note: these are not [NewObject] and can be cached. But across globals?
;[["getElementsByTagName", "x"],
["getElementsByTagNameNS", null, "x"],

View file

@ -42,3 +42,10 @@ function test_entries(actualEntries, expectedEntries) {
}
})
}
function delayedLoadListener(callback) {
window.addEventListener('load', function() {
// TODO(cvazac) Remove this setTimeout when spec enforces sync entries.
step_timeout(callback, 0)
})
}

View file

@ -14,6 +14,15 @@ function importWorklet(worklet, code) {
return worklet.addModule(url);
}
async function animationFrames(frames) {
for (let i = 0; i < frames; i++)
await new Promise(requestAnimationFrame);
}
async function workletPainted() {
await animationFrames(2);
}
// To make sure that we take the snapshot at the right time, we do double
// requestAnimationFrame. In the second frame, we take a screenshot, that makes
// sure that we already have a full frame.
@ -24,10 +33,6 @@ async function importWorkletAndTerminateTestAfterAsyncPaint(worklet, code) {
}
await importWorklet(worklet, code);
requestAnimationFrame(function() {
requestAnimationFrame(function() {
takeScreenshot();
});
});
await workletPainted();
takeScreenshot();
}

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Whitespace across display:contents shadow host</title>
<link rel="help" href="https://drafts.csswg.org/css-display-3/#valdef-display-contents">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-rules">
<link rel="match" href="../reference/pass_if_two_words.html">
<p>There should be a space between "two" and "words" below.</p>
<div id="host" style="display:contents"></div> <span>words</span>
<script>
host.attachShadow({mode:"open"}).innerHTML = "two";
</script>

View file

@ -3,7 +3,7 @@
<title>CSS Flexbox Test: Flex item - contiguous text runs - node removal</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-items">
<link rel="match" href="anonymous-flex-item-ref.html">
<link rel="match" href="../reference/pass_if_two_words.html">
<p>There should be a space between "two" and "words" below.</p>
<div style="display:flex">two <span id="spanRemove"></span>words</div>
<script>

View file

@ -3,6 +3,6 @@
<title>CSS Flexbox Test: Flex item - contiguous text runs - display:none</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-items">
<link rel="match" href="anonymous-flex-item-ref.html">
<link rel="match" href="../reference/pass_if_two_words.html">
<p>There should be a space between "two" and "words" below.</p>
<div style="display:flex">two <span style="display:none"></span>words</div>

View file

@ -3,7 +3,7 @@
<title>CSS Flexbox Test: Flex item - contiguous text runs - display:none dynamic</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-items">
<link rel="match" href="anonymous-flex-item-ref.html">
<link rel="match" href="../reference/pass_if_two_words.html">
<p>There should be a space between "two" and "words" below.</p>
<div style="display:flex">two <span id="noneSpan"></span>words</div>
<script>

View file

@ -0,0 +1,3 @@
spec: https://drafts.csswg.org/css-overscroll-behavior/
suggested_reviewers:
- majido

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Inheritance of CSS Overscroll Behavior properties</title>
<link rel="help" href="https://drafts.csswg.org/css-overscroll-behavior/#property-index">
<meta name="assert" content="Properties inherit or not according to the spec.">
<meta name="assert" content="Properties have initial values according to the spec.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/inheritance-testcommon.js"></script>
</head>
<body>
<div id="container">
<div id="target"></div>
</div>
<script>
assert_not_inherited('overscroll-behavior-x', 'auto', 'contain');
assert_not_inherited('overscroll-behavior-y', 'auto', 'contain');
</script>
</body>
</html>

View file

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html class="reftest-wait">
<title>Registering a property causes invalidation for initial value</title>
<link rel="help" href="https://www.w3.org/TR/css-paint-api-1/#examples">
<link rel="match" href="parse-input-arguments-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<body>
<style>
#target {
background: paint(geometry);
width: 100px;
height: 100px;
}
</style>
<div id="target"></div>
<script id="code" type="text/worklet">
registerPaint('geometry', class {
static get inputProperties() { return ['--color']; }
paint(ctx, geom, styleMap) {
ctx.strokeStyle = styleMap.get('--color').toString();
ctx.lineWidth = 4;
ctx.strokeRect(0, 0, geom.width, geom.height);
}
});
</script>
<script>
async function test() {
getComputedStyle(target);
let code = document.getElementById('code').textContent;
await importWorklet(CSS.paintWorklet, code);
await workletPainted();
CSS.registerProperty({
name: '--color',
syntax: '<color>',
initialValue: 'green',
inherits: false
});
await workletPainted();
takeScreenshot();
}
test();
</script>
</body>
</html>

View file

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html class="reftest-wait">
<title>Registering a property causes invalidation for applied value</title>
<link rel="help" href="https://www.w3.org/TR/css-paint-api-1/#examples">
<link rel="match" href="parse-input-arguments-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<body>
<style>
#target {
background: paint(geometry);
width: 100px;
height: 100px;
--length: 100px;
}
</style>
<div id="target"></div>
<script id="code" type="text/worklet">
registerPaint('geometry', class {
static get inputProperties() { return ['--length']; }
paint(ctx, geom, styleMap) {
let value = styleMap.get('--length');
let pass = value.value === 100 && value.unit === 'px';
ctx.strokeStyle = pass ? 'green' : 'red';
ctx.lineWidth = 4;
ctx.strokeRect(0, 0, geom.width, geom.height);
}
});
</script>
<script>
async function test() {
getComputedStyle(target);
let code = document.getElementById('code').textContent;
await importWorklet(CSS.paintWorklet, code);
await workletPainted();
CSS.registerProperty({
name: '--length',
syntax: '<length>',
initialValue: '0px',
inherits: false
});
await workletPainted();
takeScreenshot();
}
test();
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visufx.html#propdef-overflow">
<style>
/* Avoid auto scrollbars on the viewport, because that might trigger re-layout
(and thus hide bugs). */
body { overflow:hidden; }
.container { width:100px; }
</style>
<p>There should be a blue rectangle below, and possibly a scrollbar (depending
on OS / browser), that shouldn not obscure any parts of the rectangle. The
word "FAIL" should not be seen.</p>
<div class="container" style="overflow:auto; height:200px;">
<div id="child" style="display:inline-block; box-sizing:border-box; width:100%; height:100%; border:10px solid blue;"></div>
<br>FAIL
</div>
<div class="container" style="visibility:hidden; overflow:scroll;">
<div id="ref"></div>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(()=> {
var child = document.getElementById("child");
assert_equals(child.offsetWidth, ref.offsetWidth);
}, "Auto scrollbar affects size of children");
</script>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: letter spacing after bidi</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#letter-spacing-property">
<link rel="match" href="reference/letter-spacing-bidi-001-ref.html">
<meta name="assert" content="Letter spacing is inserted after RTL reordering, so letter spacing cannot apply to any of the letters in the span below,
since they get split appart.">
<style>
div {
font-family: monospace;
font-size: 3em;
}
span {
letter-spacing: 1ch;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 4.
<div>12345</div>
<div>a<span></span>ב</div>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: letter spacing at bidi fragment boudary</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#letter-spacing-property">
<link rel="help" href="https://drafts.csswg.org/css-writing-modes-4/#bidi-fragmentation">
<link rel="match" href="reference/letter-spacing-bidi-002-ref.html">
<meta name="assert" content="When bidi would cause to pieces of a single inline box to be appart if there was enough room to fit everything in one line,
the two pieces are separate fragments even if they end up next to eachother due to line breaking.
Letter spacing at the boundary of such separate fragments comes from their common ancestor,
not from the letter-spacing property on the fragmented inline box itself.">
<style>
div {
font-family: monospace;
font-size: 3em;
width: 0;
}
span {
letter-spacing: 1ch;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 3.
<div>12345</div>
<div>a<span></span> ב</div>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: letter spacing at end of line</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#letter-spacing-property">
<link rel="match" href="reference/letter-spacing-end-of-line-001-ref.html">
<meta name="assert" content="Letter-spacing must not be applied at the beginning or at the end of a line.">
<style>
div {
font-family: monospace;
font-size: 3em;
}
span {
float:left;
letter-spacing: 1ch;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 4.
<div>12345</div>
<div><span>aa</span>a</div>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: letter on nested element</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#letter-spacing-property">
<link rel="match" href="reference/letter-spacing-nesting-001-ref.html">
<meta name="assert" content="A given value of letter-spacing only affects the spacing between characters completely contained within the element for which it is specified">
<style>
div {
font-family: monospace;
font-size: 3em;
}
span {
letter-spacing: 1ch;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 5.
<div>123456</div>
<div>a<span>aa</span>a</div>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: letter spacing on element with single character</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#letter-spacing-property">
<link rel="match" href="reference/letter-spacing-nesting-002-ref.html">
<meta name="assert" content="Applying letter-spacing to an element containing only a single character has no effect on the rendered result">
<style>
div {
font-family: monospace;
font-size: 3em;
}
span {
letter-spacing: 1ch;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 3.
<div>12345</div>
<div>a<span>a</span>a</div>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<style>
div {
font-family: monospace;
font-size: 3em;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 4.
<div>12345</div>
<div>abאב</div>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<style>
div {
font-family: monospace;
font-size: 3em;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 3.
<div>12345</div>
<div>aaב<br>ב</div>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<style>
div {
font-family: monospace;
font-size: 3em;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 4.
<div>12345</div>
<div>a aa</div>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<style>
div {
font-family: monospace;
font-size: 3em;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 5.
<div>123456</div>
<div>aa aa</div>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<style>
div {
font-family: monospace;
font-size: 3em;
}
</style>
<p>Test passes if the rightmost character of the line that starts with “a” is under the number 3.
<div>12345</div>
<div>aaa</div>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text Test: overflow-wrap: break-word</title>
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
<meta name="flags" content="ahem">
<link rel="match" href="reference/overflow-wrap-break-word-001-ref.html">
<meta name="assert" content="A Single leading white-space constitutes a soft breaking opportunity, honoring the 'white-space: pre-wrap' property, that must prevent the word to be broken.">
<style>
div {
position: relative;
font-size: 20px;
font-family: Ahem;
}
.fail {
position: absolute;
color: red;
z-index: -1;
}
span { color: green; }
.test {
color: green;
line-height: 1em;
width: 5ch;
white-space: pre-wrap;
overflow-wrap: break-word;
}
</style>
<body>
<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
<div class="fail">XXX<span>XX<br></span><span>XXXXX<br></span>XXXXX<br>XXXX<span>X<br></span><span>XXXXX</span></div>
<div class="test">XXX
XXXXXXXXX</div>
</body>

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<p>Test passes if the characters below are arranged in a square and if there is no red.
<div>ああ<br>ああ</div>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<style>
div { white-space: pre; }
span { background: blue; }
</style>
<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
<div>ああ<span>&#x3000;</span><br>ああ</div>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<style>
div { white-space: pre; }
span { background: blue; }
</style>
<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
<div>ああ<span>&#x3000;&#x3000; &#x3000; &#x3000;</span><br>ああ</div>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<style>
div { white-space: pre; }
span {
background: blue;
/* to make the span go under the right border */
z-index:-1;
position: relative;
}
aside {
display: inline-block;
width: 0.5em;
border-right: 1em white solid;
}
</style>
<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
<div>ああ<aside><span>&#x3000;</span></aside><br>ああ</div>

View file

@ -1,3 +0,0 @@
<!DOCTYPE html>
<p>There should be a space between "Two" and "words".</p>
Two words

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: ideographic space at the end of line must be removed</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
<link rel="match" href="reference/trailing-ideographic-space-001-ref.html">
<meta name="assert" content="An ideographic space (U+3000) at the end of the line must be removed.">
<style>
div { width: 2em; }
span { background: red; } /* If the space hangs instead of being removed, there will be red */
</style>
<p>Test passes if the characters below are arranged in a square and if there is no red.
<div>ああ<span>&#x3000;</span>ああ</div>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: sequence of spaces and ideographic spaces at the end of line must be removed</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
<link rel="match" href="reference/trailing-ideographic-space-001-ref.html">
<meta name="assert" content="An sequence ideographic space (U+3000) and regular spaces at the end of the line must be removed.">
<style>
div { width: 2em; }
span { background: red; } /* If the space hangs instead of being removed, there will be red */
</style>
<p>Test passes if the characters below are arranged in a square and if there is no red.
<div>ああ<span>&#x3000;&#x3000; &#x3000; &#x3000;</span>ああ</div>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: preserved ideographic space at the end of line must hang</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
<link rel="match" href="reference/trailing-ideographic-space-003-ref.html">
<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
<meta name="assert" content="An ideographic space (U+3000) at the end of the line must hang if white-space preserves spaces.">
<style>
div {
width: 2.5em;
white-space: pre-wrap;
}
span { background: blue; } /* If the space is removed instead of hanging, there will be no blue box*/
</style>
<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
<div>ああ<span>&#x3000;</span>ああ</div>
<!--
We're using a 2.5em width and two references, instead of 2em and just the first one,
because in addition to requiring the spaces to hang,
the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
In browsers that don't do that, the whole sequence of preserved spaces will be visible, and the first ref will be matched.
In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
-->

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: preserved sequences of spaces and ideographic spaces at the end of line must hang</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
<link rel="match" href="reference/trailing-ideographic-space-004-ref.html">
<link rel="match" href="reference/trailing-ideographic-space-alt-003-ref.html">
<meta name="assert" content="An sequence ideographic space (U+3000) and regular spaces at the end of the line must hang if white-space preserves spaces.">
<style>
div {
width: 2.5em;
white-space: pre-wrap;
}
span { background: blue; } /* If the spaces are removed instead of hanging, there will be no blue box*/
</style>
<p>Test passes if the characters below are arranged in a square and if there is a blue rectangle at the end of the first line.
<div>ああ<span>&#x3000;&#x3000; &#x3000; &#x3000;</span>ああ</div>
<!--
We're using a 2.5em width and two references, instead of 2em and just the first one,
because in addition to requiring the spaces to hang,
the spec allows, but does not require, browsers to visually collapse the advance widths of characters that overflow.
In browsers that don't do that, the whole space will be visible, and the first ref will be matched.
In browsers that do, only the first 0.5em worth of space will be preserved, and the second ref will match.
-->

View file

@ -1,11 +1,11 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-rules">
<link rel="match" href="reference/white-space-empty-text-sibling-ref.html">
<p>There should be a space between "Two" and "words".</p>
<link rel="match" href="../../reference/pass_if_two_words.html">
<p>There should be a space between "two" and "words" below.</p>
<div id="block"> <span>words</span></div>
<script>
block.insertBefore(document.createTextNode(""), block.firstChild);
block.insertBefore(document.createTextNode(""), block.firstChild);
block.offsetTop;
block.firstChild.data = "Two";
block.firstChild.data = "two";
</script>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS test reference</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<style>
div {
border: 5px solid;
width: 2em;
}
div::nth-of-type(1) { border-color: blue; }
div::nth-of-type(2) { border-color: green; }
div::nth-of-type(3) { border-color: orange; }
</style>
<p>Test passes if the text in each of the following 3 boxes is broken into separate lines at the same points.
<div lang=ja><br>い)<br><br>(い</div>
<div lang=ja><br>い)<br><br>(い</div>
<div lang=ja><br>い)<br><br>(い</div>

View file

@ -0,0 +1,7 @@
<!doctype html>
<meta charset=utf-8>
<title>CSS-Text reference file</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
<p>This test passes if the four characters below are arranged in a two-by-two square.
<div>字字<br>字字</div>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: break-all and punctuation</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#word-break-property">
<link rel="match" href="reference/word-break-break-all-020-ref.html">
<meta name="assert" content="work-break:break-all does not affect rules governing the soft wrap opportunities created by punctuation.">
<style>
div {
border: 5px solid;
width: 2em;
}
div::nth-of-type(1) { border-color: blue; }
div::nth-of-type(2) { border-color: green; }
div::nth-of-type(3) { border-color: orange; }
div::nth-of-type(3) { word-break: break-word; }
</style>
<p>Test passes if the text in each of the following 3 boxes is broken into separate lines at the same points.
<div lang=ja>あい)あ(い</div>
<div lang=ja><br>い)<br><br>(い</div>
<div lang=ja>あい)あ(い</div>
<!--
If the first box (blue) is wrong,
customary rules for line breaking japanese are not implemented (or not correctly).
If the third box (orange) is wrong,
customary rules for line breaking japanese are discarded
when applying 'word-break: break-all', which is a spec violation.
-->

View file

@ -0,0 +1,28 @@
<!doctype html>
<meta charset=utf-8>
<title>CSS-Text test: word-break keep-all does not affect U+3000</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
<meta name=flags content="">
<meta name=assert content="U+3000, despite being called Ideographic Space, does not belong to the ID line breaking class, or any other class whose wrapping opportunities are suppressed by word-break:keep-all. A break after it should still be allowed.">
<link rel="match" href="reference/word-break-keep-all-005-ref.html">
<link rel=help href="https://drafts.csswg.org/css-text-3/#valdef-word-break-keep-all">
<style>
div {
width: 4em;
word-break: keep-all;
}
</style>
<p>This test passes if the four characters below are arranged in a two-by-two square.
<div lang=ja>字字 字字</div>
<!--
If keep-all has no effect at all, breaks are allowed everywhere,
and the result will be:
字字 字
If keep-all correctly suppresses wrapping opportunities between CJK ideographs
but also incorrectly suppresses the wrapping opportunity after U+3000,
no wrapping is possible, and the result will be:
字字 字字
-->

View file

@ -0,0 +1,33 @@
<!doctype html>
<meta charset=utf-8>
<title>CSS-Text test: word-break keep-all does not affect punctuation</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
<meta name=flags content="">
<meta name=assert content="word-break:keep-all does not affect rules governing the soft wrap opportunities created by punctuation">
<link rel="match" href="reference/word-break-keep-all-005-ref.html">
<link rel=help href="https://drafts.csswg.org/css-text-3/#propdef-word-break">
<style>
div {
width: 4em;
word-break: keep-all;
}
span { color: transparent }
</style>
<p>This test passes if the four characters below are arranged in a two-by-two square.
<div lang=ja>字字<span></span>字字</div>
<!--
U+3001 : IDEOGRAPHIC COMMA is made transparent for visual simplicity,
the change in color has no effect on layout.
If keep-all has no effect at all, breaks are allowed everywhere
(except before U+3001, but this has no incidence in this case)
and the result will be:
字字、字
If keep-all correctly suppresses wrapping opportunities between CJK ideographs
but also incorrectly suppresses the wrapping opportunity after U+3001,
no wrapping is possible, and the result will be:
字字、字字
-->

View file

@ -1,6 +1,5 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Reftest Reference</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<p>There should be a space between "two" and "words" below.</p>
two words

View file

@ -0,0 +1,113 @@
test(function() {
var test_window = window.open('', '', 'height=1,width=1');
var test_document = test_window.document;
var frame = test_document.createElement('iframe');
test_document.body.appendChild(frame);
frame.contentWindow.onpagehide = function(evt) {
assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
"expected no popup during pagehide");
};
frame.contentDocument.onvisibilitychange = function(evt) {
assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
"expected no popup during visibilitychange");
};
frame.contentWindow.onbeforeunload = function(evt) {
assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
"expected no popup during beforeunload");
};
frame.contentWindow.onunload = function(evt) {
assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
"expected no popup during unload");
};
frame.remove();
}, 'no popups with frame removal');
async_test(function(t) {
var test_window = window.open('', '', 'height=1,width=1');
var test_document = test_window.document;
var frame = test_document.createElement('iframe');
test_document.body.appendChild(frame);
frame.contentWindow.onpagehide = t.step_func(function(evt) {
assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
"expected no popup during pagehide");
});
frame.contentDocument.onvisibilitychange = t.step_func(function(evt) {
assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
"expected no popup during visibilitychange");
});
frame.contentWindow.onbeforeunload = t.step_func(function(evt) {
assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
"expected no popup during beforeunload");
});
frame.contentWindow.onunload = t.step_func(function(evt) {
assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
"expected no popup during unload");
});
frame.onload = t.step_func_done();
frame.contentWindow.location.href = "about:blank";
}, 'no popups with frame navigation');
async_test(function(t) {
var test_window = window.open('', '', 'height=1,width=1');
var test_document = test_window.document;
var frame = test_document.createElement('iframe');
test_document.body.appendChild(frame);
frame.contentWindow.onpagehide = t.step_func(function(evt) {
assert_equals(test_window.open('', '', 'height=1,width=1'), null,
"expected no popup during pagehide");
});
frame.contentDocument.onvisibilitychange = t.step_func(function(evt) {
assert_equals(test_window.open('', '', 'height=1,width=1'), null,
"expected no popup during visibilitychange");
});
frame.contentWindow.onbeforeunload = t.step_func(function(evt) {
assert_equals(test_window.open('', '', 'height=1,width=1'), null,
"expected no popup during beforeunload");
});
frame.contentWindow.onunload = t.step_func(function(evt) {
assert_equals(test_window.open('', '', 'height=1,width=1'), null,
"expected no popup during unload");
});
frame.onload = t.step_func_done();
frame.contentWindow.location.href = "about:blank";
}, 'no popups from synchronously reachable window');
async_test(function(t) {
var test_window = window.open('', '', 'height=1,width=1');
var test_document = test_window.document;
var frame = test_document.createElement('iframe');
test_document.body.appendChild(frame);
frame.contentWindow.onpagehide = t.step_func(function(evt) {
assert_equals(window.open('', '', 'height=1,width=1'), null,
"expected no popup during pagehide");
});
frame.contentDocument.onvisibilitychange = t.step_func(function(evt) {
assert_equals(window.open('', '', 'height=1,width=1'), null,
"expected no popup during visibilitychange");
});
frame.contentWindow.onbeforeunload = t.step_func(function(evt) {
assert_equals(window.open('', '', 'height=1,width=1'), null,
"expected no popup during beforeunload");
});
frame.contentWindow.onunload = t.step_func(function(evt) {
assert_equals(window.open('', '', 'height=1,width=1'), null,
"expected no popup during unload");
});
frame.onload = t.step_func_done();
frame.contentWindow.location.href = "about:blank";
}, 'no popups from another synchronously reachable window');

View file

@ -251,6 +251,8 @@ testText("<div><table style='border-collapse:collapse'><tr><td>abc<td>def</table
testText("<div><table><tfoot>x</tfoot><tbody>y</tbody></table>", "xy", "tfoot not reordered");
testText("<table><tfoot><tr><td>footer</tfoot><thead><tr><td style='visibility:collapse'>thead</thead><tbody><tr><td>tbody</tbody></table>",
"footer\n\ntbody", "");
testText("<table><tr><td id=target>abc</td><td>def</td>", "abc", "No tab on table-cell itself");
testText("<table><tr id=target><td>abc</td><td>def</td></tr><tr id=target><td>ghi</td><td>jkl</td></tr>", "abc\tdef", "No newline on table-row itself");
/**** Table captions ****/

View file

@ -0,0 +1,47 @@
<!doctype html>
<meta charset="utf-8">
<html>
<title>MediaRecorder destroy script execution context</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<iframe src="support/MediaRecorder-iframe.html" id="subFrame-stop" name="subFrameStop"></iframe>
<iframe src="support/MediaRecorder-iframe.html" id="subFrame-allTrackEnded" name="subFrameAllTrackEnded"></iframe>
<script>
var iframeForCallingStop = document.getElementById('subFrame-stop');
var iframeForAllTrackEnded = document.getElementById('subFrame-allTrackEnded');
var testForCallingStop = async_test('MediaRecorder will not fire the stop event when stop() is called and the script execution context is going away');
var testForAllTrackEnded = async_test('MediaRecorder will not fire the stop event when all tracks are ended and the script execution context is going away');
iframeForCallingStop.onload = function(e) {
subFrameStop.window.prepareForTest();
const recorder = subFrameStop.window.recorder;
recorder.ondataavailable = testForCallingStop.step_func(blobEvent => {
iframeForCallingStop.remove();
testForCallingStop.step_timeout(testForCallingStop.step_func_done(), 0);
});
recorder.onstop = testForCallingStop.unreached_func('Unexpected stop event');
recorder.start();
assert_equals(recorder.state, 'recording', 'MediaRecorder has been started successfully');
subFrameStop.window.drawSomethingOnCanvas();
recorder.stop();
};
iframeForAllTrackEnded.onload = function(e) {
subFrameAllTrackEnded.window.prepareForTest();
const recorder = subFrameAllTrackEnded.window.recorder;
recorder.ondataavailable = testForAllTrackEnded.step_func(blobEvent => {
iframeForAllTrackEnded.remove();
testForAllTrackEnded.step_timeout(testForAllTrackEnded.step_func_done(), 0);
});
recorder.onstop = testForAllTrackEnded.unreached_func('Unexpected stop event');
recorder.start();
assert_equals(recorder.state, 'recording', 'MediaRecorder has been started successfully');
subFrameAllTrackEnded.window.drawSomethingOnCanvas();
subFrameAllTrackEnded.window.video.getVideoTracks()[0].stop();
};
</script>
</body>
</html>

View file

@ -0,0 +1,50 @@
<!doctype html>
<html>
<head>
<title>MediaRecorder Stop</title>
<link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#mediarecorder">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<canvas id="canvas" width="200" height="200">
</canvas>
<script>
function createVideoStream() {
let canvas = document.getElementById("canvas");
canvas.getContext('2d');
return canvas.captureStream();
}
async_test(t => {
let video = createVideoStream();
let recorder = new MediaRecorder(video);
recorder.onstop = t.step_func(errorEvent => {
assert_equals(errorEvent.type, 'stop', 'the error type should be stop');
assert_true(errorEvent.isTrusted, 'isTrusted should be true when the event is created by C++');
assert_equals(recorder.state, "inactive", "MediaRecorder has been stopped when all tracks are ended");
t.done();
});
assert_equals(video.getVideoTracks().length, 1, "video mediastream starts with one track");
recorder.start();
assert_equals(recorder.state, "recording", "MediaRecorder has been started successfully");
video.getVideoTracks()[0].stop();
}, "MediaRecorder will stop recording and fire a stop event when all tracks are ended");
async_test(t => {
let video = createVideoStream();
let recorder = new MediaRecorder(video);
recorder.onstop = t.step_func(errorEvent => {
assert_equals(errorEvent.type, 'stop', 'the error type should be stop');
assert_true(errorEvent.isTrusted, 'isTrusted should be true when the event is created by C++');
assert_equals(recorder.state, "inactive", "MediaRecorder has been stopped when stop() is called");
t.done();
});
recorder.start();
assert_equals(recorder.state, "recording", "MediaRecorder has been started successfully");
recorder.stop();
assert_equals(recorder.state, "recording", "State should remain the same until stop event is fired");
}, "MediaRecorder will stop recording and fire a stop event when stop() is called");
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<title>Start a MediaRecorder</title>
<html>
<body>
<canvas id="canvas" width="200px" height="200px"></canvas>
<script>
var context;
var recorder;
var video;
function createVideoStream() {
const canvas = document.getElementById("canvas");
context = canvas.getContext('2d');
return canvas.captureStream();
}
function drawSomethingOnCanvas() {
context.fillStyle = "red";
context.fillRect(0, 0, 10, 10);
}
function prepareForTest() {
video = createVideoStream();
recorder = new MediaRecorder(video);
}
</script>
</body>
</html>

View file

@ -0,0 +1,56 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Tests for PaymentRequest.canMakePayment() method</title>
<link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='/resources/testdriver-vendor.js'></script>
<script src="/resources/testdriver.js"></script>
<script>
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({
total: {
label: "Total",
amount: {
currency: "USD",
value: "1.00",
},
},
});
promise_test(async t => {
// This test might never actually hit its assertion, but that's allowed.
const request = new PaymentRequest(defaultMethods, defaultDetails);
for (let i = 0; i < 1000; i++) {
try {
await request.canMakePayment();
} catch (err) {
assert_equals(
err.name,
"NotAllowedError",
"if it throws, then it must be a NotAllowedError."
);
break;
}
}
for (let i = 0; i < 1000; i++) {
try {
await new PaymentRequest(defaultMethods, defaultDetails).canMakePayment();
} catch (err) {
assert_equals(
err.name,
"NotAllowedError",
"if it throws, then it must be a NotAllowedError."
);
break;
}
}
}, `Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException.`);
</script>
<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/META.yml">suggested reviewers</a>.
</small>

View file

@ -20,6 +20,56 @@ const defaultDetails = Object.freeze({
},
});
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
assert_true(await request.canMakePayment(), "one of the methods should be supported");
}, `If payment method identifier and serialized parts are supported, resolve promise with true.`);
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise = test_driver.bless("show payment request", () => {
request.show() // Sets state to "interactive"
});
const canMakePaymentPromise = request.canMakePayment();
try {
const result = await canMakePaymentPromise;
assert_true(
false,
`canMakePaymentPromise should have thrown InvalidStateError`
);
} catch (err) {
await promise_rejects(t, "InvalidStateError", canMakePaymentPromise);
} finally {
await request.abort();
await promise_rejects(t, "AbortError", acceptPromise);
}
// The state should be "closed"
await promise_rejects(t, "InvalidStateError", request.canMakePayment());
}, 'If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException.');
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise = test_driver.bless("show payment request", () => {
request.show() // Sets state to "interactive"
});
acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools.
await request.abort(); // The state is now "closed"
await promise_rejects(t, "InvalidStateError", request.canMakePayment());
try {
const result = await request.canMakePayment();
assert_true(
false,
`should have thrown InvalidStateError, but instead returned "${result}"`
);
} catch (err) {
assert_equals(
err.name,
"InvalidStateError",
"must be an InvalidStateError."
);
}
}, 'If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException.');
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
try {
@ -40,11 +90,6 @@ promise_test(async t => {
}
}, `If request.[[state]] is "created", then return a promise that resolves to true for known method.`);
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
assert_true(await request.canMakePayment(), "one of the methods should be supported");
}, `If payment method identifier and serialized parts are supported, resolve promise with true.`);
promise_test(async t => {
const unsupportedMethods = [
"this-is-not-supported",
@ -92,81 +137,6 @@ promise_test(async t => {
}
}
}, `If payment method identifier is unknown, resolve promise with false.`);
promise_test(async t => {
// This test might never actually hit its assertion, but that's allowed.
const request = new PaymentRequest(defaultMethods, defaultDetails);
for (let i = 0; i < 1000; i++) {
try {
await request.canMakePayment();
} catch (err) {
assert_equals(
err.name,
"NotAllowedError",
"if it throws, then it must be a NotAllowedError."
);
break;
}
}
for (let i = 0; i < 1000; i++) {
try {
await new PaymentRequest(defaultMethods, defaultDetails).canMakePayment();
} catch (err) {
assert_equals(
err.name,
"NotAllowedError",
"if it throws, then it must be a NotAllowedError."
);
break;
}
}
}, `Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException.`);
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise = test_driver.bless("show payment request", () => {
request.show() // Sets state to "interactive"
});
const canMakePaymentPromise = request.canMakePayment();
try {
const result = await canMakePaymentPromise;
assert_true(
false,
`canMakePaymentPromise should have thrown InvalidStateError`
);
} catch (err) {
await promise_rejects(t, "InvalidStateError", canMakePaymentPromise);
} finally {
await request.abort();
await promise_rejects(t, "AbortError", acceptPromise);
}
// The state should be "closed"
await promise_rejects(t, "InvalidStateError", request.canMakePayment());
}, 'If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException.');
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise = test_driver.bless("show payment request", () => {
request.show() // Sets state to "interactive"
});
acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools.
await request.abort(); // The state is now "closed"
await promise_rejects(t, "InvalidStateError", request.canMakePayment());
try {
const result = await request.canMakePayment();
assert_true(
false,
`should have thrown InvalidStateError, but instead returned "${result}"`
);
} catch (err) {
assert_equals(
err.name,
"InvalidStateError",
"must be an InvalidStateError."
);
}
}, 'If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException.');
</script>
<small>

View file

@ -23,6 +23,12 @@
mojo.internal.loadMojomIfNecessary(
'mojo/public/mojom/base/string16.mojom', '../../../../mojo/public/mojom/base/string16.mojom.js');
}
var url$ =
mojo.internal.exposeNamespace('url.mojom');
if (mojo.config.autoLoadMojomDeps) {
mojo.internal.loadMojomIfNecessary(
'url/mojom/url.mojom', '../../../../url/mojom/url.mojom.js');
}
var UsbOpenDeviceError = {};
@ -518,6 +524,7 @@
this.manufacturerName = null;
this.productName = null;
this.serialNumber = null;
this.webusbLandingPage = null;
this.configurations = null;
};
UsbDeviceInfo.prototype.initFields_ = function(fields) {
@ -534,7 +541,7 @@
return err;
var kVersionSizes = [
{version: 0, numBytes: 64}
{version: 0, numBytes: 72}
];
err = messageValidator.validateStructVersion(offset, kVersionSizes);
if (err !== validator.validationError.NONE)
@ -576,16 +583,22 @@
return err;
// validate UsbDeviceInfo.webusbLandingPage
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 48, url$.Url, true);
if (err !== validator.validationError.NONE)
return err;
// validate UsbDeviceInfo.configurations
err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 48, 8, new codec.PointerTo(UsbConfigurationInfo), false, [0], 0);
err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 56, 8, new codec.PointerTo(UsbConfigurationInfo), false, [0], 0);
if (err !== validator.validationError.NONE)
return err;
return validator.validationError.NONE;
};
UsbDeviceInfo.encodedSize = codec.kStructHeaderSize + 56;
UsbDeviceInfo.encodedSize = codec.kStructHeaderSize + 64;
UsbDeviceInfo.decode = function(decoder) {
var packed;
@ -610,6 +623,7 @@
val.manufacturerName = decoder.decodeStructPointer(string16$.String16);
val.productName = decoder.decodeStructPointer(string16$.String16);
val.serialNumber = decoder.decodeStructPointer(string16$.String16);
val.webusbLandingPage = decoder.decodeStructPointer(url$.Url);
val.configurations = decoder.decodeArrayPointer(new codec.PointerTo(UsbConfigurationInfo));
return val;
};
@ -636,6 +650,7 @@
encoder.encodeStructPointer(string16$.String16, val.manufacturerName);
encoder.encodeStructPointer(string16$.String16, val.productName);
encoder.encodeStructPointer(string16$.String16, val.serialNumber);
encoder.encodeStructPointer(url$.Url, val.webusbLandingPage);
encoder.encodeArrayPointer(new codec.PointerTo(UsbConfigurationInfo), val.configurations);
};
function UsbControlTransferParams(values) {
@ -2578,6 +2593,98 @@
encoder.writeUint32(0);
encoder.encodeArrayPointer(new codec.PointerTo(UsbIsochronousPacket), val.packets);
};
function UsbDeviceClient_OnDeviceOpened_Params(values) {
this.initDefaults_();
this.initFields_(values);
}
UsbDeviceClient_OnDeviceOpened_Params.prototype.initDefaults_ = function() {
};
UsbDeviceClient_OnDeviceOpened_Params.prototype.initFields_ = function(fields) {
for(var field in fields) {
if (this.hasOwnProperty(field))
this[field] = fields[field];
}
};
UsbDeviceClient_OnDeviceOpened_Params.validate = function(messageValidator, offset) {
var err;
err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
if (err !== validator.validationError.NONE)
return err;
var kVersionSizes = [
{version: 0, numBytes: 8}
];
err = messageValidator.validateStructVersion(offset, kVersionSizes);
if (err !== validator.validationError.NONE)
return err;
return validator.validationError.NONE;
};
UsbDeviceClient_OnDeviceOpened_Params.encodedSize = codec.kStructHeaderSize + 0;
UsbDeviceClient_OnDeviceOpened_Params.decode = function(decoder) {
var packed;
var val = new UsbDeviceClient_OnDeviceOpened_Params();
var numberOfBytes = decoder.readUint32();
var version = decoder.readUint32();
return val;
};
UsbDeviceClient_OnDeviceOpened_Params.encode = function(encoder, val) {
var packed;
encoder.writeUint32(UsbDeviceClient_OnDeviceOpened_Params.encodedSize);
encoder.writeUint32(0);
};
function UsbDeviceClient_OnDeviceClosed_Params(values) {
this.initDefaults_();
this.initFields_(values);
}
UsbDeviceClient_OnDeviceClosed_Params.prototype.initDefaults_ = function() {
};
UsbDeviceClient_OnDeviceClosed_Params.prototype.initFields_ = function(fields) {
for(var field in fields) {
if (this.hasOwnProperty(field))
this[field] = fields[field];
}
};
UsbDeviceClient_OnDeviceClosed_Params.validate = function(messageValidator, offset) {
var err;
err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
if (err !== validator.validationError.NONE)
return err;
var kVersionSizes = [
{version: 0, numBytes: 8}
];
err = messageValidator.validateStructVersion(offset, kVersionSizes);
if (err !== validator.validationError.NONE)
return err;
return validator.validationError.NONE;
};
UsbDeviceClient_OnDeviceClosed_Params.encodedSize = codec.kStructHeaderSize + 0;
UsbDeviceClient_OnDeviceClosed_Params.decode = function(decoder) {
var packed;
var val = new UsbDeviceClient_OnDeviceClosed_Params();
var numberOfBytes = decoder.readUint32();
var version = decoder.readUint32();
return val;
};
UsbDeviceClient_OnDeviceClosed_Params.encode = function(encoder, val) {
var packed;
encoder.writeUint32(UsbDeviceClient_OnDeviceClosed_Params.encodedSize);
encoder.writeUint32(0);
};
var kUsbDevice_Open_Name = 0;
var kUsbDevice_Close_Name = 1;
var kUsbDevice_SetConfiguration_Name = 2;
@ -2617,13 +2724,13 @@
};
UsbDeviceProxy.prototype.open = function() {
var params = new UsbDevice_Open_Params();
var params_ = new UsbDevice_Open_Params();
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_Open_Name,
codec.align(UsbDevice_Open_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_Open_Params, params);
builder.encodeStruct(UsbDevice_Open_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2641,13 +2748,13 @@
};
UsbDeviceProxy.prototype.close = function() {
var params = new UsbDevice_Close_Params();
var params_ = new UsbDevice_Close_Params();
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_Close_Name,
codec.align(UsbDevice_Close_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_Close_Params, params);
builder.encodeStruct(UsbDevice_Close_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2665,14 +2772,14 @@
};
UsbDeviceProxy.prototype.setConfiguration = function(value) {
var params = new UsbDevice_SetConfiguration_Params();
params.value = value;
var params_ = new UsbDevice_SetConfiguration_Params();
params_.value = value;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_SetConfiguration_Name,
codec.align(UsbDevice_SetConfiguration_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_SetConfiguration_Params, params);
builder.encodeStruct(UsbDevice_SetConfiguration_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2690,14 +2797,14 @@
};
UsbDeviceProxy.prototype.claimInterface = function(interfaceNumber) {
var params = new UsbDevice_ClaimInterface_Params();
params.interfaceNumber = interfaceNumber;
var params_ = new UsbDevice_ClaimInterface_Params();
params_.interfaceNumber = interfaceNumber;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_ClaimInterface_Name,
codec.align(UsbDevice_ClaimInterface_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_ClaimInterface_Params, params);
builder.encodeStruct(UsbDevice_ClaimInterface_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2715,14 +2822,14 @@
};
UsbDeviceProxy.prototype.releaseInterface = function(interfaceNumber) {
var params = new UsbDevice_ReleaseInterface_Params();
params.interfaceNumber = interfaceNumber;
var params_ = new UsbDevice_ReleaseInterface_Params();
params_.interfaceNumber = interfaceNumber;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_ReleaseInterface_Name,
codec.align(UsbDevice_ReleaseInterface_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_ReleaseInterface_Params, params);
builder.encodeStruct(UsbDevice_ReleaseInterface_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2740,15 +2847,15 @@
};
UsbDeviceProxy.prototype.setInterfaceAlternateSetting = function(interfaceNumber, alternateSetting) {
var params = new UsbDevice_SetInterfaceAlternateSetting_Params();
params.interfaceNumber = interfaceNumber;
params.alternateSetting = alternateSetting;
var params_ = new UsbDevice_SetInterfaceAlternateSetting_Params();
params_.interfaceNumber = interfaceNumber;
params_.alternateSetting = alternateSetting;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_SetInterfaceAlternateSetting_Name,
codec.align(UsbDevice_SetInterfaceAlternateSetting_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_SetInterfaceAlternateSetting_Params, params);
builder.encodeStruct(UsbDevice_SetInterfaceAlternateSetting_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2766,13 +2873,13 @@
};
UsbDeviceProxy.prototype.reset = function() {
var params = new UsbDevice_Reset_Params();
var params_ = new UsbDevice_Reset_Params();
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_Reset_Name,
codec.align(UsbDevice_Reset_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_Reset_Params, params);
builder.encodeStruct(UsbDevice_Reset_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2790,14 +2897,14 @@
};
UsbDeviceProxy.prototype.clearHalt = function(endpoint) {
var params = new UsbDevice_ClearHalt_Params();
params.endpoint = endpoint;
var params_ = new UsbDevice_ClearHalt_Params();
params_.endpoint = endpoint;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_ClearHalt_Name,
codec.align(UsbDevice_ClearHalt_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_ClearHalt_Params, params);
builder.encodeStruct(UsbDevice_ClearHalt_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2815,16 +2922,16 @@
};
UsbDeviceProxy.prototype.controlTransferIn = function(params, length, timeout) {
var params = new UsbDevice_ControlTransferIn_Params();
params.params = params;
params.length = length;
params.timeout = timeout;
var params_ = new UsbDevice_ControlTransferIn_Params();
params_.params = params;
params_.length = length;
params_.timeout = timeout;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_ControlTransferIn_Name,
codec.align(UsbDevice_ControlTransferIn_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_ControlTransferIn_Params, params);
builder.encodeStruct(UsbDevice_ControlTransferIn_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2842,16 +2949,16 @@
};
UsbDeviceProxy.prototype.controlTransferOut = function(params, data, timeout) {
var params = new UsbDevice_ControlTransferOut_Params();
params.params = params;
params.data = data;
params.timeout = timeout;
var params_ = new UsbDevice_ControlTransferOut_Params();
params_.params = params;
params_.data = data;
params_.timeout = timeout;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_ControlTransferOut_Name,
codec.align(UsbDevice_ControlTransferOut_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_ControlTransferOut_Params, params);
builder.encodeStruct(UsbDevice_ControlTransferOut_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2869,16 +2976,16 @@
};
UsbDeviceProxy.prototype.genericTransferIn = function(endpointNumber, length, timeout) {
var params = new UsbDevice_GenericTransferIn_Params();
params.endpointNumber = endpointNumber;
params.length = length;
params.timeout = timeout;
var params_ = new UsbDevice_GenericTransferIn_Params();
params_.endpointNumber = endpointNumber;
params_.length = length;
params_.timeout = timeout;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_GenericTransferIn_Name,
codec.align(UsbDevice_GenericTransferIn_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_GenericTransferIn_Params, params);
builder.encodeStruct(UsbDevice_GenericTransferIn_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2896,16 +3003,16 @@
};
UsbDeviceProxy.prototype.genericTransferOut = function(endpointNumber, data, timeout) {
var params = new UsbDevice_GenericTransferOut_Params();
params.endpointNumber = endpointNumber;
params.data = data;
params.timeout = timeout;
var params_ = new UsbDevice_GenericTransferOut_Params();
params_.endpointNumber = endpointNumber;
params_.data = data;
params_.timeout = timeout;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_GenericTransferOut_Name,
codec.align(UsbDevice_GenericTransferOut_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_GenericTransferOut_Params, params);
builder.encodeStruct(UsbDevice_GenericTransferOut_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2923,16 +3030,16 @@
};
UsbDeviceProxy.prototype.isochronousTransferIn = function(endpointNumber, packetLengths, timeout) {
var params = new UsbDevice_IsochronousTransferIn_Params();
params.endpointNumber = endpointNumber;
params.packetLengths = packetLengths;
params.timeout = timeout;
var params_ = new UsbDevice_IsochronousTransferIn_Params();
params_.endpointNumber = endpointNumber;
params_.packetLengths = packetLengths;
params_.timeout = timeout;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_IsochronousTransferIn_Name,
codec.align(UsbDevice_IsochronousTransferIn_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_IsochronousTransferIn_Params, params);
builder.encodeStruct(UsbDevice_IsochronousTransferIn_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -2950,17 +3057,17 @@
};
UsbDeviceProxy.prototype.isochronousTransferOut = function(endpointNumber, data, packetLengths, timeout) {
var params = new UsbDevice_IsochronousTransferOut_Params();
params.endpointNumber = endpointNumber;
params.data = data;
params.packetLengths = packetLengths;
params.timeout = timeout;
var params_ = new UsbDevice_IsochronousTransferOut_Params();
params_.endpointNumber = endpointNumber;
params_.data = data;
params_.packetLengths = packetLengths;
params_.timeout = timeout;
return new Promise(function(resolve, reject) {
var builder = new codec.MessageV1Builder(
kUsbDevice_IsochronousTransferOut_Name,
codec.align(UsbDevice_IsochronousTransferOut_Params.encodedSize),
codec.kMessageExpectsResponse, 0);
builder.encodeStruct(UsbDevice_IsochronousTransferOut_Params, params);
builder.encodeStruct(UsbDevice_IsochronousTransferOut_Params, params_);
var message = builder.finish();
this.receiver_.acceptAndExpectResponse(message).then(function(message) {
var reader = new codec.MessageReader(message);
@ -3405,6 +3512,124 @@
};
UsbDeviceStub.prototype.validator = validateUsbDeviceRequest;
UsbDeviceProxy.prototype.validator = validateUsbDeviceResponse;
var kUsbDeviceClient_OnDeviceOpened_Name = 0;
var kUsbDeviceClient_OnDeviceClosed_Name = 1;
function UsbDeviceClientPtr(handleOrPtrInfo) {
this.ptr = new bindings.InterfacePtrController(UsbDeviceClient,
handleOrPtrInfo);
}
function UsbDeviceClientAssociatedPtr(associatedInterfacePtrInfo) {
this.ptr = new associatedBindings.AssociatedInterfacePtrController(
UsbDeviceClient, associatedInterfacePtrInfo);
}
UsbDeviceClientAssociatedPtr.prototype =
Object.create(UsbDeviceClientPtr.prototype);
UsbDeviceClientAssociatedPtr.prototype.constructor =
UsbDeviceClientAssociatedPtr;
function UsbDeviceClientProxy(receiver) {
this.receiver_ = receiver;
}
UsbDeviceClientPtr.prototype.onDeviceOpened = function() {
return UsbDeviceClientProxy.prototype.onDeviceOpened
.apply(this.ptr.getProxy(), arguments);
};
UsbDeviceClientProxy.prototype.onDeviceOpened = function() {
var params_ = new UsbDeviceClient_OnDeviceOpened_Params();
var builder = new codec.MessageV0Builder(
kUsbDeviceClient_OnDeviceOpened_Name,
codec.align(UsbDeviceClient_OnDeviceOpened_Params.encodedSize));
builder.encodeStruct(UsbDeviceClient_OnDeviceOpened_Params, params_);
var message = builder.finish();
this.receiver_.accept(message);
};
UsbDeviceClientPtr.prototype.onDeviceClosed = function() {
return UsbDeviceClientProxy.prototype.onDeviceClosed
.apply(this.ptr.getProxy(), arguments);
};
UsbDeviceClientProxy.prototype.onDeviceClosed = function() {
var params_ = new UsbDeviceClient_OnDeviceClosed_Params();
var builder = new codec.MessageV0Builder(
kUsbDeviceClient_OnDeviceClosed_Name,
codec.align(UsbDeviceClient_OnDeviceClosed_Params.encodedSize));
builder.encodeStruct(UsbDeviceClient_OnDeviceClosed_Params, params_);
var message = builder.finish();
this.receiver_.accept(message);
};
function UsbDeviceClientStub(delegate) {
this.delegate_ = delegate;
}
UsbDeviceClientStub.prototype.onDeviceOpened = function() {
return this.delegate_ && this.delegate_.onDeviceOpened && this.delegate_.onDeviceOpened();
}
UsbDeviceClientStub.prototype.onDeviceClosed = function() {
return this.delegate_ && this.delegate_.onDeviceClosed && this.delegate_.onDeviceClosed();
}
UsbDeviceClientStub.prototype.accept = function(message) {
var reader = new codec.MessageReader(message);
switch (reader.messageName) {
case kUsbDeviceClient_OnDeviceOpened_Name:
var params = reader.decodeStruct(UsbDeviceClient_OnDeviceOpened_Params);
this.onDeviceOpened();
return true;
case kUsbDeviceClient_OnDeviceClosed_Name:
var params = reader.decodeStruct(UsbDeviceClient_OnDeviceClosed_Params);
this.onDeviceClosed();
return true;
default:
return false;
}
};
UsbDeviceClientStub.prototype.acceptWithResponder =
function(message, responder) {
var reader = new codec.MessageReader(message);
switch (reader.messageName) {
default:
return false;
}
};
function validateUsbDeviceClientRequest(messageValidator) {
var message = messageValidator.message;
var paramsClass = null;
switch (message.getName()) {
case kUsbDeviceClient_OnDeviceOpened_Name:
if (!message.expectsResponse() && !message.isResponse())
paramsClass = UsbDeviceClient_OnDeviceOpened_Params;
break;
case kUsbDeviceClient_OnDeviceClosed_Name:
if (!message.expectsResponse() && !message.isResponse())
paramsClass = UsbDeviceClient_OnDeviceClosed_Params;
break;
}
if (paramsClass === null)
return validator.validationError.NONE;
return paramsClass.validate(messageValidator, messageValidator.message.getHeaderNumBytes());
}
function validateUsbDeviceClientResponse(messageValidator) {
return validator.validationError.NONE;
}
var UsbDeviceClient = {
name: 'device.mojom.UsbDeviceClient',
kVersion: 0,
ptrClass: UsbDeviceClientPtr,
proxyClass: UsbDeviceClientProxy,
stubClass: UsbDeviceClientStub,
validateRequest: validateUsbDeviceClientRequest,
validateResponse: null,
};
UsbDeviceClientStub.prototype.validator = validateUsbDeviceClientRequest;
UsbDeviceClientProxy.prototype.validator = null;
exports.UsbOpenDeviceError = UsbOpenDeviceError;
exports.UsbTransferDirection = UsbTransferDirection;
exports.UsbControlTransferType = UsbControlTransferType;
@ -3421,4 +3646,7 @@
exports.UsbDevice = UsbDevice;
exports.UsbDevicePtr = UsbDevicePtr;
exports.UsbDeviceAssociatedPtr = UsbDeviceAssociatedPtr;
exports.UsbDeviceClient = UsbDeviceClient;
exports.UsbDeviceClientPtr = UsbDeviceClientPtr;
exports.UsbDeviceClientAssociatedPtr = UsbDeviceClientAssociatedPtr;
})();

View file

@ -0,0 +1,79 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
(function() {
var mojomId = 'url/mojom/url.mojom';
if (mojo.internal.isMojomLoaded(mojomId)) {
console.warn('The following mojom is loaded multiple times: ' + mojomId);
return;
}
mojo.internal.markMojomLoaded(mojomId);
var bindings = mojo;
var associatedBindings = mojo;
var codec = mojo.internal;
var validator = mojo.internal;
var exports = mojo.internal.exposeNamespace('url.mojom');
function Url(values) {
this.initDefaults_();
this.initFields_(values);
}
Url.prototype.initDefaults_ = function() {
this.url = null;
};
Url.prototype.initFields_ = function(fields) {
for(var field in fields) {
if (this.hasOwnProperty(field))
this[field] = fields[field];
}
};
Url.validate = function(messageValidator, offset) {
var err;
err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
if (err !== validator.validationError.NONE)
return err;
var kVersionSizes = [
{version: 0, numBytes: 16}
];
err = messageValidator.validateStructVersion(offset, kVersionSizes);
if (err !== validator.validationError.NONE)
return err;
// validate Url.url
err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 0, false)
if (err !== validator.validationError.NONE)
return err;
return validator.validationError.NONE;
};
Url.encodedSize = codec.kStructHeaderSize + 8;
Url.decode = function(decoder) {
var packed;
var val = new Url();
var numberOfBytes = decoder.readUint32();
var version = decoder.readUint32();
val.url = decoder.decodeStruct(codec.String);
return val;
};
Url.encode = function(encoder, val) {
var packed;
encoder.writeUint32(Url.encodedSize);
encoder.writeUint32(0);
encoder.encodeStruct(codec.String, val.url);
};
exports.Url = Url;
})();

View file

@ -305,13 +305,7 @@ IdlArray.prototype.add_dependency_idls = function(raw_idls, options)
if (parsed[dep_type]) {
const inheriting = parsed[dep_type];
const inheritor = parsed.name || parsed.target;
const deps = [inheriting];
// For A includes B, we can ignore A unless B is being tested.
if (dep_type !== "includes"
|| (inheriting in this.members && !this.members[inheriting].untested)) {
deps.push(inheritor);
}
for (const dep of deps) {
for (const dep of [inheriting, inheritor]) {
new_options.only.push(dep);
all_deps.add(dep);
follow_up.add(dep);
@ -326,7 +320,7 @@ IdlArray.prototype.add_dependency_idls = function(raw_idls, options)
next.forEach(process);
}
}
}.bind(this));
});
}.bind(this);
for (let parsed of parsed_idls) {

View file

@ -2,7 +2,7 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script>
@ -20,7 +20,7 @@
document.getElementsByTagName('script')[0].parentNode.appendChild(img)
})
window.addEventListener('load', function() {
delayedLoadListener(function() {
function assertServerTimingEntries(url, expectedEntryCount) {
test_equals(performance.getEntriesByName(url)[0].serverTiming.length,
expectedEntryCount,

View file

@ -2,10 +2,11 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script>
setup({explicit_done: true})
window.addEventListener('load', function(){
delayedLoadListener(function(){
assert_not_equals(typeof performance.getEntriesByType('navigation')[0].serverTiming, 'undefined',
'An instance of `PerformanceNavigationTiming` should have a `serverTiming` attribute.')
done()

View file

@ -2,10 +2,11 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script>
setup({explicit_done: true})
window.addEventListener('load', function(){
delayedLoadListener(function(){
assert_not_equals(typeof performance.getEntriesByType('resource')[0].serverTiming, 'undefined',
'An instance of `PerformanceResourceTiming` should have a `serverTiming` attribute.')
done()

View file

@ -7,7 +7,7 @@ tests generated by:
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script>
setup({explicit_done: true})
@ -49,6 +49,6 @@ tests generated by:
document.getElementsByTagName('head')[0].appendChild(script)
urlToIndex[script.src] = i
}
window.addEventListener('load', runTests)
delayedLoadListener(runTests)
</script>
</head>

View file

@ -2,7 +2,7 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script>
(async () => {
const scope = 'does/not/exist'

View file

@ -2,12 +2,12 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script>
setup({explicit_done: true})
window.addEventListener('load', function() {
delayedLoadListener(function() {
// there should be exactly three server-timing entries, 2 for document, 1 for img#one
test_entries(performance.getEntriesByType('navigation')[0].serverTiming, [{
duration: 1.1,

View file

@ -0,0 +1,5 @@
spec: https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html
suggested_reviewers:
- irori
- jyasskin
- nyaxt

View file

@ -1,32 +0,0 @@
environment:
global:
HYPOTHESIS_PROFILE: ci
matrix:
- PYTHON: 'C:\\Python27'
- PYTHON: 'C:\\Python35'
- PYTHON: 'C:\\Python36'
# Needed to make py.test believe our top level can be imported (we
# otherwise end up in a wpt-tools directory, and of course you cannot
# import a name including a hyphen in Python, so it ignores the fact
# we have a __init__.py at the top level).
clone_folder: 'C:\projects\wpttools'
init:
- 'git config --global core.autocrlf true'
install:
- 'rm .git\index'
- 'git reset --hard'
- 'SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%'
- 'git submodule update --init --recursive'
- 'python.exe -m pip install tox codecov'
build: off
test_script:
- 'tox -e py'
on_success:
- 'coverage combine'
- 'codecov'

View file

@ -18,4 +18,10 @@ select = E,W,F,N
# N801: class names should use CapWords convention
# N802: function name should be lowercase
ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802
exclude =
.tox,
pywebsocket,
third_party,
wptserve/docs/conf.py,
wptserve/tests/functional/docroot/invalid.py
max-line-length = 141

View file

@ -0,0 +1,4 @@
flake8==3.5.0
pycodestyle==2.3.1
pyflakes==1.6.0
pep8-naming==0.4.1

View file

@ -1,26 +1,20 @@
[tox]
envlist = py27,py36,pypy
envlist = py27,py36,pypy,py27-flake8
skipsdist=True
[testenv]
# flake8 versions should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini
deps =
flake8==3.5.0
pycodestyle==2.3.1
pyflakes==1.6.0
pep8-naming==0.4.1
pytest
pytest-cov
mock
hypothesis
pytest-catchlog
commands =
pytest --cov {posargs}
flake8 --append-config=flake8.ini
commands = pytest --cov {posargs}
passenv =
HYPOTHESIS_PROFILE
[flake8]
exclude = .tox,html5lib,third_party,pywebsocket,six,_venv,webencodings,wptserve/docs,wptserve/tests/functional/docroot/,wpt,wptrunner
[testenv:py27-flake8]
deps = -r{toxinidir}/requirements_flake8.txt
commands = flake8 --append-config={toxinidir}/flake8.ini {posargs}

View file

@ -46,7 +46,7 @@ class Browser(object):
return NotImplemented
@abstractmethod
def version(self, binary=None):
def version(self, binary=None, webdriver_binary=None):
"""Retrieve the release version of the installed browser."""
return NotImplemented
@ -367,7 +367,7 @@ class Firefox(Browser):
return path
def version(self, binary=None):
def version(self, binary=None, webdriver_binary=None):
"""Retrieve the release version of the installed browser."""
version_string = call(binary, "--version").strip()
m = re.match(r"Mozilla Firefox (.*)", version_string)
@ -394,7 +394,7 @@ class Fennec(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
def version(self, binary=None):
def version(self, binary=None, webdriver_binary=None):
return None
@ -458,7 +458,7 @@ class Chrome(Browser):
os.chmod(path, st.st_mode | stat.S_IEXEC)
return path
def version(self, binary=None):
def version(self, binary=None, webdriver_binary=None):
binary = binary or self.binary
if uname[0] != "Windows":
try:
@ -497,7 +497,7 @@ class ChromeAndroid(Browser):
chrome = Chrome()
return chrome.install_webdriver(dest, channel)
def version(self, binary):
def version(self, binary=None, webdriver_binary=None):
return None
class Opera(Browser):
@ -562,7 +562,7 @@ class Opera(Browser):
os.chmod(path, st.st_mode | stat.S_IEXEC)
return path
def version(self, binary):
def version(self, binary=None, webdriver_binary=None):
"""Retrieve the release version of the installed browser."""
binary = binary or self.binary
try:
@ -593,7 +593,7 @@ class Edge(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
def version(self, binary):
def version(self, binary=None, webdriver_binary=None):
return None
@ -619,7 +619,7 @@ class InternetExplorer(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
def version(self, binary):
def version(self, binary=None, webdriver_binary=None):
return None
@ -647,8 +647,24 @@ class Safari(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
def version(self, binary):
return None
def version(self, binary=None, webdriver_binary=None):
if webdriver_binary is None:
logger.warn("Cannot find Safari version without safaridriver")
return None
# Use `safaridriver --version` to get the version. Example output:
# "Included with Safari 12.1 (14607.1.11)"
# "Included with Safari Technology Preview (Release 67, 13607.1.9.0.1)"
# The `--version` flag was added in STP 67, so allow the call to fail.
try:
version_string = call(webdriver_binary, "--version").strip()
except subprocess.CalledProcessError:
logger.warn("Failed to call %s --version", webdriver_binary)
return None
m = re.match(r"Included with Safari (.*)", version_string)
if not m:
logger.warn("Failed to extract version from: s%", version_string)
return None
return m.group(1)
class SafariWebDriver(Safari):
@ -707,7 +723,7 @@ class Servo(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
def version(self, binary):
def version(self, binary=None, webdriver_binary=None):
"""Retrieve the release version of the installed browser."""
output = call(binary, "--version")
m = re.search(r"Servo ([0-9\.]+-[a-f0-9]+)?(-dirty)?$", output.strip())
@ -737,7 +753,7 @@ class Sauce(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
def version(self, binary):
def version(self, binary=None, webdriver_binary=None):
return None
@ -759,5 +775,5 @@ class WebKit(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
def version(self, binary):
def version(self, binary=None, webdriver_binary=None):
return None

View file

@ -509,7 +509,8 @@ def setup_wptrunner(venv, prompt=True, install_browser=False, **kwargs):
venv.install_requirements(os.path.join(wptrunner_path, "requirements.txt"))
kwargs['browser_version'] = setup_cls.browser.version(kwargs.get("binary"))
kwargs['browser_version'] = setup_cls.browser.version(binary=kwargs.get("binary"),
webdriver_binary=kwargs.get("webdriver_binary"))
return kwargs

View file

@ -0,0 +1,32 @@
import mock
import subprocess
from tools.wpt import browser
@mock.patch('subprocess.check_output')
def test_safari_version(mocked_check_output):
safari = browser.Safari()
# Safari
mocked_check_output.return_value = 'Included with Safari 12.1 (14607.1.11)'
assert safari.version(webdriver_binary="safaridriver") == '12.1 (14607.1.11)'
# Safari Technology Preview
mocked_check_output.return_value = 'Included with Safari Technology Preview (Release 67, 13607.1.9.0.1)'
assert safari.version(webdriver_binary="safaridriver") == 'Technology Preview (Release 67, 13607.1.9.0.1)'
@mock.patch('subprocess.check_output')
def test_safari_version_errors(mocked_check_output):
safari = browser.Safari()
# No webdriver_binary
assert safari.version() is None
# `safaridriver --version` return gibberish
mocked_check_output.return_value = 'gibberish'
assert safari.version(webdriver_binary="safaridriver") is None
# `safaridriver --version` fails (as it does for Safari <=12.0)
mocked_check_output.return_value = 'dummy'
mocked_check_output.side_effect = subprocess.CalledProcessError(1, 'cmd')
assert safari.version(webdriver_binary="safaridriver") is None

View file

@ -57,9 +57,9 @@ def test_setup_wptrunner(venv, product):
parser = run.create_parser()
kwargs = vars(parser.parse_args(["--channel=nightly", product]))
kwargs["prompt"] = False
kwargs["webdriver_binary"] = "fake"
# Hack to get a real existing path
kwargs["binary"] = sys.argv[0]
kwargs["webdriver_binary"] = sys.argv[0]
if kwargs["product"] == "sauce":
kwargs["product"] = "sauce:firefox:63"
run.setup_wptrunner(venv, **kwargs)

View file

@ -1,5 +1,5 @@
[tox]
envlist = py27,py27-flake8
envlist = py27
skipsdist=True
[testenv]
@ -14,14 +14,3 @@ deps =
commands =
pytest --cov {posargs}
[testenv:py27-flake8]
# flake8 versions should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini
deps =
flake8==3.5.0
pycodestyle==2.3.1
pyflakes==1.6.0
pep8-naming==0.4.1
commands =
flake8 --append-config=../flake8.ini {posargs}

View file

@ -2,7 +2,7 @@
xfail_strict=true
[tox]
envlist = {py27}-{base,chrome,edge,firefox,ie,opera,safari,sauce,servo},py27-flake8
envlist = py27-{base,chrome,edge,firefox,ie,opera,safari,sauce,servo}
[testenv]
deps =
@ -23,14 +23,3 @@ deps =
commands = pytest {posargs:--cov}
setenv = CURRENT_TOX_ENV = {envname}
[testenv:py27-flake8]
# flake8 versions should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini
deps =
flake8==3.5.0
pycodestyle==2.3.1
pyflakes==1.6.0
pep8-naming==0.4.1
commands =
flake8 --append-config=../flake8.ini

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>just one argument</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
postMessage('');
this.done();
});
</script>

View file

@ -42,6 +42,7 @@ let loadChromiumResources = Promise.resolve().then(() => {
[
'/resources/chromium/mojo_bindings.js',
'/resources/chromium/string16.mojom.js',
'/resources/chromium/url.mojom.js',
'/resources/chromium/device.mojom.js',
'/resources/chromium/device_manager.mojom.js',
'/resources/chromium/web_usb_service.mojom.js',

View file

@ -2,84 +2,302 @@
<title>DedicatedWorker: WorkerOptions 'credentials'</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script>
host_info = get_host_info();
// Determines the expected cookie value to be reported by a dedicated worker
// based on the given option. The worker reports an empty string as the actual
// cookie value if the cookie wasn't sent to the server. Otherwise, it's the
// value set by the headers file:
// "dedicated-worker-options-credentials.html.headers"
function DetermineExpectedCookieValue(options) {
// Classic script loading should always send credentials regardless of the
// 'credentials' option because the spec says the option takes effect only
// for module script loading.
if (options.type == 'classic')
return 'COOKIE_VALUE';
assert_equals(options.type, 'module');
if (!options.credentials ||
options.credentials == 'same-origin' ||
options.credentials == 'include') {
return 'COOKIE_VALUE';
function DetermineExpectedCookieValue(options, config) {
// Valid WorkerOptions and test config checking.
if (config.origin !== 'same' && config.origin !== 'remote')
assert_unreached('Invalid config.origin was specified: ' + config.origin);
if (options.credentials && options.credentials !== 'omit' &&
options.credentials !== 'same-origin' &&
options.credentials !== 'include') {
assert_unreached('Invalid credentials option was specified: ' +
options.credentials);
}
if (options.credentials == 'omit')
if (options.type !== 'classic' && options.type !== 'module')
assert_unreached('Invalid type option was specified: ' + options.type);
if (options.type === 'classic')
return (config.origin === 'same') ? '1' : '';
if (options.credentials === 'omit')
return '';
assert_unreached('Invalid credentials option was specified: ' +
options.credentials);
else if (options.credentials === 'include')
return '1';
else
return (config.origin === 'same') ? '1' : '';
}
// Runs a credentials test with the given WorkerOptions.
function credentials_test(options, description) {
//
// |options| is a WorkerOptions dict.
// |config| has options as follows:
//
// config = {
// fetchType: 'top-level' or 'descendant-static' or 'descendant-dynamic'
// origin: 'remote' or 'same'
// };
//
// - |config.fetchType| indicates the type of script to load for the test.
// - |config.origin| indicates same-origin-ness of the script to load.
function credentials_test(options, config, description) {
promise_test(async () => {
const worker = new Worker('resources/credentials.py', options);
let workerURL, origin = config.origin;
if (config.fetchType === 'top-level') {
workerURL = 'resources/credentials.py';
} else if (config.fetchType === 'descendant-static') {
workerURL =
`resources/static-import-${origin}-origin-credentials-checker-worker.${origin === 'same' ? '' : 'sub.'}js`;
} else if (config.fetchType === 'descendant-dynamic') {
workerURL =
`resources/dynamic-import-${origin}-origin-credentials-checker-worker.${origin === 'same' ? '' : 'sub.'}js`;
} else {
assert_unreached('Invalid config.fetchType: ' + config.fetchType);
}
const worker = new Worker(workerURL, options);
// Wait until the worker sends the actual cookie value.
const msg_event = await new Promise(resolve => worker.onmessage = resolve);
const expectedCookieValue = DetermineExpectedCookieValue(options);
const expectedCookieValue = DetermineExpectedCookieValue(options, config);
assert_equals(msg_event.data, expectedCookieValue);
}, description);
}
// Tests for module scripts.
function init() {
// Same-origin cookie is set up in the .headers file in this directory.
promise_test(async () => {
return fetch(
`${host_info.HTTP_REMOTE_ORIGIN}/cookies/resources/set-cookie.py?name=COOKIE_NAME&path=/workers/modules/`,
{
mode: 'no-cors',
credentials: 'include'
});
}, 'Test initialization: setting up cross-origin cookie');
}
init();
// Tests for module workers.
credentials_test(
{ type: 'module'},
'new Worker() with the default credentials option should behave as ' +
'credentials=same-origin and send the credentials');
{ type: 'module' },
{ fetchType: 'top-level', origin: 'same' },
'new Worker() with type=module and default credentials option should ' +
'behave as credentials=same-origin and send the credentials');
credentials_test(
{ credentials: 'omit', type: 'module' },
'new Worker() with credentials=omit should not send the credentials');
{ fetchType: 'top-level', origin: 'same' },
'new Worker() with type=module and credentials=omit should not send the ' +
'credentials');
credentials_test(
{ credentials: 'same-origin', type: 'module' },
'new Worker() with credentials=same-origin should send the credentials');
{ fetchType: 'top-level', origin: 'same' },
'new Worker() with type=module and credentials=same-origin should send ' +
'the credentials');
credentials_test(
{ credentials: 'include', type: 'module' },
'new Worker() with credentials=include should send the credentials');
{ fetchType: 'top-level', origin: 'same' },
'new Worker() with type=module and credentials=include should send the ' +
'credentials');
// Tests for classic scripts.
// Tests for module worker static imports.
credentials_test(
{ type: 'module' },
{ fetchType: 'descendant-static', origin: 'same' },
'new Worker() with type=module and default credentials option should ' +
'behave as credentials=same-origin and send the credentials for ' +
'same-origin static imports');
credentials_test(
{ credentials: 'omit', type: 'module' },
{ fetchType: 'descendant-static', origin: 'same' },
'new Worker() with type=module and credentials=omit should not send the ' +
'credentials for same-origin static imports');
credentials_test(
{ credentials: 'same-origin', type: 'module' },
{ fetchType: 'descendant-static', origin: 'same' },
'new Worker() with type=module and credentials=same-origin should send ' +
'the credentials for same-origin static imports');
credentials_test(
{ credentials: 'include', type: 'module' },
{ fetchType: 'descendant-static', origin: 'same' },
'new Worker() with type=module and credentials=include should send the ' +
'credentials for same-origin static imports');
credentials_test(
{ type: 'module' },
{ fetchType: 'descendant-static', origin: 'remote' },
'new Worker() with type=module and default credentials option should ' +
'behave as credentials=same-origin and not send the credentials for ' +
'cross-origin static imports');
credentials_test(
{ credentials: 'omit', type: 'module' },
{ fetchType: 'descendant-static', origin: 'remote' },
'new Worker() with type-module credentials=omit should not send the ' +
'credentials for cross-origin static imports');
credentials_test(
{ credentials: 'same-origin', type: 'module' },
{ fetchType: 'descendant-static', origin: 'remote' },
'new Worker() with type=module and credentials=same-origin should not ' +
'send the credentials for cross-origin static imports');
credentials_test(
{ credentials: 'include', type: 'module' },
{ fetchType: 'descendant-static', origin: 'remote' },
'new Worker() with type=module and credentials=include should send the ' +
'credentials for cross-origin static imports');
// Tests for module worker dynamic imports.
credentials_test(
{ type: 'module' },
{ fetchType: 'descendant-dynamic', origin: 'same' },
'new Worker() with type=module and default credentials option should ' +
'behave as credentials=same-origin and send the credentials for ' +
'same-origin dynamic imports');
credentials_test(
{ credentials: 'omit', type: 'module' },
{ fetchType: 'descendant-dynamic', origin: 'same' },
'new Worker() with type=module and credentials=omit should not send the ' +
'credentials for same-origin dynamic imports');
credentials_test(
{ credentials: 'same-origin', type: 'module' },
{ fetchType: 'descendant-dynamic', origin: 'same' },
'new Worker() with type=module and credentials=same-origin should send ' +
'the credentials for same-origin dynamic imports');
credentials_test(
{ credentials: 'include', type: 'module' },
{ fetchType: 'descendant-dynamic', origin: 'same' },
'new Worker() with type=module and credentials=include should send the ' +
'credentials for same-origin dynamic imports');
credentials_test(
{ type: 'module'},
{ fetchType: 'descendant-dynamic', origin: 'remote' },
'new Worker() with type=module and default credentials option should ' +
'behave as credentials=same-origin and not send the credentials for ' +
'cross-origin dynamic imports');
credentials_test(
{ credentials: 'omit', type: 'module' },
{ fetchType: 'descendant-dynamic', origin: 'remote' },
'new Worker() with type-module credentials=omit should not send the ' +
'credentials for cross-origin dynamic imports');
credentials_test(
{ credentials: 'same-origin', type: 'module' },
{ fetchType: 'descendant-dynamic', origin: 'remote' },
'new Worker() with type=module and credentials=same-origin should not ' +
'send the credentials for cross-origin dynamic imports');
credentials_test(
{ credentials: 'include', type: 'module' },
{ fetchType: 'descendant-dynamic', origin: 'remote' },
'new Worker() with type=module and credentials=include should send the ' +
'credentials for cross-origin dynamic imports');
// Tests for classic workers.
// TODO(domfarolino): Maybe move classic worker tests up a directory?
credentials_test(
{ type: 'classic' },
{ fetchType: 'top-level', origin: 'same' },
'new Worker() with type=classic should always send the credentials ' +
'regardless of the credentials option (default).');
credentials_test(
{ credentials: 'omit', type: 'classic' },
{ fetchType: 'top-level', origin: 'same' },
'new Worker() with type=classic should always send the credentials ' +
'regardless of the credentials option (omit).');
credentials_test(
{ credentials: 'same-origin', type: 'classic' },
{ fetchType: 'top-level', origin: 'same' },
'new Worker() with type=classic should always send the credentials ' +
'regardless of the credentials option (same-origin).');
credentials_test(
{ credentials: 'include', type: 'classic' },
{ fetchType: 'top-level', origin: 'same' },
'new Worker() with type=classic should always send the credentials ' +
'regardless of the credentials option (include).');
// Tests for classic worker dynamic imports.
credentials_test(
{ type: 'classic' },
{ fetchType: 'descendant-dynamic', origin: 'same' },
'new Worker() with type=classic should always send the credentials for ' +
'same-origin dynamic imports regardless of the credentials option ' +
'(default).');
credentials_test(
{ credentials: 'omit', type: 'classic' },
{ fetchType: 'descendant-dynamic', origin: 'same' },
'new Worker() with type=classic should always send the credentials for ' +
'same-origin dynamic imports regardless of the credentials option (omit).');
credentials_test(
{ credentials: 'same-origin', type: 'classic' },
{ fetchType: 'descendant-dynamic', origin: 'same' },
'new Worker() with type=classic should always send the credentials for ' +
'same-origin dynamic imports regardless of the credentials option ' +
'(same-origin).');
credentials_test(
{ credentials: 'include', type: 'classic' },
{ fetchType: 'descendant-dynamic', origin: 'same' },
'new Worker() with type=classic should always send the credentials for ' +
'same-origin dynamic imports regardless of the credentials option ' +
'(include).');
credentials_test(
{ type: 'classic' },
{ fetchType: 'descendant-dynamic', origin: 'remote' },
'new Worker() with type=classic should never send the credentials for ' +
'cross-origin dynamic imports regardless of the credentials option ' +
'(default).');
credentials_test(
{ credentials: 'omit', type: 'classic' },
{ fetchType: 'descendant-dynamic', origin: 'remote' },
'new Worker() with type=classic should never send the credentials for ' +
'cross-origin dynamic imports regardless of the credentials option ' +
'(omit).');
credentials_test(
{ credentials: 'same-origin', type: 'classic' },
{ fetchType: 'descendant-dynamic', origin: 'remote' },
'new Worker() with type=classic should never send the credentials for ' +
'cross-origin dynamic imports regardless of the credentials option ' +
'(same-origin).');
credentials_test(
{ credentials: 'include', type: 'classic' },
{ fetchType: 'descendant-dynamic', origin: 'remote' },
'new Worker() with type=classic should never send the credentials for ' +
'cross-origin dynamic imports regardless of the credentials option ' +
'(include).');
</script>

View file

@ -1,2 +1,2 @@
Set-Cookie: COOKIE_NAME=COOKIE_VALUE
Set-Cookie: COOKIE_NAME=1
Access-Control-Allow-Credentials: true

View file

@ -2,6 +2,7 @@ def main(request, response):
cookie = request.cookies.first("COOKIE_NAME", None)
response_headers = [("Content-Type", "text/javascript"),
("Access-Control-Allow-Origin", request.headers.get("Origin")),
("Access-Control-Allow-Credentials", "true")]
cookie_value = '';

View file

@ -0,0 +1,2 @@
// Import a remote origin script.
import('http://{{domains[www1]}}:{{ports[http][0]}}/workers/modules/resources/credentials.py');

View file

@ -0,0 +1,2 @@
// Import a remote origin script.
import 'http://{{domains[www1]}}:{{ports[http][0]}}/workers/modules/resources/credentials.py';