Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee

This commit is contained in:
WPT Sync Bot 2018-04-23 21:13:37 -04:00
parent c5f7c9ccf3
commit e891345f26
1328 changed files with 36632 additions and 20588 deletions

View file

@ -64,8 +64,6 @@ matrix:
env: JOB=tools_unittest TOXENV=py27 HYPOTHESIS_PROFILE=ci SCRIPT=tools/ci/ci_tools_unittest.sh
- python: 3.6
env: JOB=tools_unittest TOXENV=py36 HYPOTHESIS_PROFILE=ci SCRIPT=tools/ci/ci_tools_unittest.sh
- python: pypy-5.4
env: JOB=tools_unittest TOXENV=pypy HYPOTHESIS_PROFILE=ci SCRIPT=tools/ci/ci_tools_unittest.sh
- python: 2.7
env: JOB=resources_unittest TOXENV=py27 SCRIPT=tools/ci/ci_resources_unittest.sh
- python: 2.7

View file

@ -1,41 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>canvas drawCustomFocusRing() step1 test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Takeshi Kurosawa" href="mailto:kurosawa-takeshi@mitsue.co.jp">
<link rel="help" href="http://www.w3.org/TR/2dcontext/#dom-context-2d-drawcustomfocusring">
</head>
<body>
<h1>Description</h1>
<p>This test checks whether drawCustomFocusRing returns false if the element passed as an argument is not focused or is not a descendant of the element with whose context the method is associated.</p>
<div id="log"></div>
<div>
<input type="text" id="text0">
<canvas id="canvas"><input type="text" id="text1"></canvas>
</div>
<script>
(function() {
test(function() {
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var text0 = document.getElementById('text0');
text0.focus(); // document.activeElement === text0;
var text1 = document.getElementById('text1');
assert_false(context.drawCustomFocusRing(text1));
}, 'drawCustomFocusRing must return false for an element that is not focused.');
test(function() {
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var text0 = document.getElementById('text0');
text0.focus(); // document.activeElement === text0;
assert_false(context.drawCustomFocusRing(text0));
}, 'drawCustomFocusRing must return false for an element that is not a descendant of the canvas element.');
})();
</script>
</body>
</html>

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>createImageBitmap transferring test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<script src="/common/namespaces.js"></script>
<script src="common.sub.js"></script>
<div id=log></div>
<script>
let worker, continuations = {};
setup(function() {
worker = new Worker("transfer-worker.js");
worker.addEventListener("message", function(event) {
let { name, bitmap } = event.data;
if (continuations.hasOwnProperty(name)) {
continuations[name](bitmap);
}
});
});
for (let { name, factory } of imageSourceTypes) {
promise_test(function(t) {
return factory().then(createImageBitmap).then(function(bitmap) {
assert_equals(bitmap.width, 20);
assert_equals(bitmap.height, 20);
worker.postMessage({ name: t.name, bitmap: bitmap }, [bitmap]);
assert_equals(bitmap.width, 0);
assert_equals(bitmap.height, 0);
return new Promise(function(resolve) {
continuations[t.name] = resolve;
});
}).then(function(bitmap) {
assert_class_string(bitmap, "ImageBitmap");
assert_equals(bitmap.width, 20);
assert_equals(bitmap.height, 20);
});
}, `Transfer ImageBitmap created from ${name}`);
}
</script>

View file

@ -0,0 +1,3 @@
addEventListener('message', evt => {
postMessage(evt.data, [evt.data.bitmap]);
});

View file

@ -0,0 +1,29 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://wicg.github.io/BackgroundSync/spec/
promise_test(async () => {
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
const html = await fetch('/interfaces/html.idl').then(r => r.text());
const sw = await fetch('/interfaces/ServiceWorker.idl').then(r => r.text());
const idl = await fetch('/interfaces/BackgroundSync.idl').then(response => response.text());
const idlArray = new IdlArray();
idlArray.add_untested_idls(dom, { only: ['Event', 'EventInit', 'EventTarget'] });
idlArray.add_untested_idls(html, { only: [
'WorkerGlobalScope',
'WindowOrWorkerGlobalScope'
] });
idlArray.add_untested_idls(sw, { only: [
'ServiceWorkerRegistration',
'ServiceWorkerGlobalScope',
'ExtendableEvent',
'ExtendableEventInit',
] });
idlArray.add_idls(idl);
idlArray.test();
done();
}, 'Background Sync interfaces.');

View file

@ -16,6 +16,27 @@ async_test(t => {
});
}, 'Fetching a blob URL immediately before revoking it works in an iframe.');
async_test(t => {
const run_result = 'test_frame_OK';
const blob_contents = '<!doctype html>\n<meta charset="utf-8">\n' +
'<script>window.test_result = "' + run_result + '";</script>';
const blob = new Blob([blob_contents], {type: 'text/html'});
const url = URL.createObjectURL(blob);
const frame = document.createElement('iframe');
frame.setAttribute('src', '/common/blank.html');
frame.setAttribute('style', 'display:none;');
document.body.appendChild(frame);
frame.onload = t.step_func(() => {
frame.contentWindow.location = url;
URL.revokeObjectURL(url);
frame.onload = t.step_func_done(() => {
assert_equals(frame.contentWindow.test_result, run_result);
});
});
}, 'Fetching a blob URL immediately before revoking it works in an iframe navigation.');
async_test(t => {
const run_result = 'test_script_OK';
const blob_contents = 'window.script_test_result = "' + run_result + '";';

View file

@ -110,7 +110,7 @@ line syntax is:
**On Windows**: You will need to preceed the prior command with
`python` or the path to the python binary.
```bash
python wpt product [tests]
python wpt run product [tests]
```
where `product` is currently `firefox` or `chrome` and `[tests]` is a
@ -271,7 +271,7 @@ will be `C:\\OpenSSL-Win32\\bin\\openssl.cfg`).
### Trusting Root CA
To prevent browser SSL warnings when running HTTPS tests locally, the
web-platform-tests Root CA file `rootca.pem` in [tools/certs](tools/certs)
web-platform-tests Root CA file `cacert.pem` in [tools/certs](tools/certs)
must be added as a trusted certificate in your OS/browser.
Publication

View file

@ -15,7 +15,7 @@ function doTest([dom, generic_sensor, accelerometer]) {
const idl_array = new IdlArray();
idl_array.add_untested_idls(dom);
idl_array.add_untested_idls('interface EventHandler {};');
idl_array.add_idls(generic_sensor, { only: ['Sensor'] });
idl_array.add_idls(generic_sensor, { only: ['Sensor', 'SensorOptions'] });
idl_array.add_idls(accelerometer);
idl_array.add_objects({
Accelerometer: ['new Accelerometer();'],

View file

@ -0,0 +1,73 @@
<!doctype html>
<html>
<head>
<title>Description 1.0 combobox-focusable</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<link rel="stylesheet" href="/resources/testharness.css">
<link rel="stylesheet" href="/wai-aria/scripts/manual.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/wai-aria/scripts/ATTAcomm.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theTest = new ATTAcomm(
{
"steps" : [
{
"element" : "test",
"test" : {
"ATK" : [
[
"property",
"description",
"is",
""
]
],
"AXAPI" : [
[
"property",
"AXHelp",
"is",
""
]
],
"IAccessible2" : [
[
"property",
"accDescription",
"is",
""
]
],
"UIA" : [
[
"property",
"Description",
"is",
""
]
]
},
"title" : "step 1",
"type" : "test"
}
],
"title" : "Description 1.0 combobox-focusable"
}
) ;
</script>
</head>
<body>
<p>This test examines the ARIA properties for Description 1.0 combobox-focusable.</p>
<div id="test" role="combobox" tabindex="0" title="Choose your language.">
<span> English </span>
</div>
<div id="manualMode"></div>
<div id="log"></div>
<div id="ATTAmessages"></div>
</body>
</html>

View file

@ -22,7 +22,7 @@
"property",
"description",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXHelp",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accDescription",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Description",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
]
},
@ -62,7 +62,10 @@
</head>
<body>
<p>This test examines the ARIA properties for Description from content of describedby element.</p>
<input id="test" type="text" aria-label="Important stuff" aria-describedby="descId" />
<style>
.hidden { display: none; }
</style>
<input id="test" type="text" aria-label="Important stuff" aria-describedby="descId" />
<div>
<div id="descId">
<span aria-hidden="true"><i> Hello, </i></span>

View file

@ -22,7 +22,7 @@
"property",
"description",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXHelp",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accDescription",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Description",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
]
},
@ -62,7 +62,10 @@
</head>
<body>
<p>This test examines the ARIA properties for Description from content of describedby element which is hidden.</p>
<div>
<style>
.hidden { display: none; }
</style>
<div>
<input id="test" type="text" aria-labelledby="lbl1 lbl2" aria-describedby="descId" />
<span>
<span aria-hidden="true" id="lbl1">Important</span>

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"Choose your language. English"
"Choose your language."
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"Choose your language. English"
"Choose your language."
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"Choose your language. English"
"Choose your language."
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"Choose your language. English"
"Choose your language."
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"a test"
"a test This is"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"a test"
"a test This is"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"a test"
"a test This is"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"a test"
"a test This is"
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"a test"
"This is a test"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"a test"
"This is a test"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"a test"
"This is a test"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"a test"
"This is a test"
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"246810"
"2 4 6 8 10"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"246810"
"2 4 6 8 10"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"246810"
"2 4 6 8 10"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"246810"
"2 4 6 8 10"
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
]
},
@ -62,7 +62,10 @@
</head>
<body>
<p>This test examines the ARIA properties for Name from content.</p>
<div id="test" role="link" tabindex="0">
<style>
.hidden { display: none; }
</style>
<div id="test" role="link" tabindex="0">
<span aria-hidden="true"><i> Hello, </i></span>
<span>My</span> name is
<div><img src="file.jpg" title="Bryan" alt="" role="presentation" /></div>

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
]
},
@ -62,7 +62,10 @@
</head>
<body>
<p>This test examines the ARIA properties for Name from content of label.</p>
<input type="text" id="test" />
<style>
.hidden { display: none; }
</style>
<input type="text" id="test" />
<label for="test" id="label">
<span aria-hidden="true"><i> Hello, </i></span>
<span>My</span> name is

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"My name is Garaventa the weird. (QED) Where are my marbles?"
"My name is Eli the weird. (QED) Where are my marbles?"
]
]
},
@ -62,7 +62,10 @@
</head>
<body>
<p>This test examines the ARIA properties for Name from content of labelledby element.</p>
<input id="test" type="text" aria-labelledby="lblId" />
<style>
.hidden { display: none; }
</style>
<input id="test" type="text" aria-labelledby="lblId" />
<div id="lblId" >
<span aria-hidden="true"><i> Hello, </i></span>
<span>My</span> name is

View file

@ -62,7 +62,10 @@
</head>
<body>
<p>This test examines the ARIA properties for Name from content of labelledby elements one of which is hidden.</p>
<div>
<style>
.hidden { display: none; }
</style>
<div>
<input id="test" type="text" aria-labelledby="lbl1 lbl2" aria-describedby="descId" />
<span>
<span aria-hidden="true" id="lbl1">Important</span>

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"My name is Garaventa the weird. (QED)"
"My name is Eli the weird. (QED)"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"My name is Garaventa the weird. (QED)"
"My name is Eli the weird. (QED)"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"My name is Garaventa the weird. (QED)"
"My name is Eli the weird. (QED)"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"My name is Garaventa the weird. (QED)"
"My name is Eli the weird. (QED)"
]
]
},
@ -62,7 +62,10 @@
</head>
<body>
<p>This test examines the ARIA properties for Name link-mixed-content.</p>
<div id="test" role="link" tabindex="0">
<style>
.hidden { display: none; }
</style>
<div id="test" role="link" tabindex="0">
<span aria-hidden="true"><i> Hello, </i></span>
<span>My</span> name is
<div><img src="file.jpg" title="Bryan" alt="" role="presentation" /></div>

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"crazy clown"
"crazy"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"crazy clown"
"crazy"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"crazy clown"
"crazy"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"crazy clown"
"crazy"
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"peanuts"
""
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"peanuts"
""
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"peanuts"
""
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"peanuts"
""
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"peanuts"
""
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"peanuts"
""
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"peanuts"
""
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"peanuts"
""
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"crazy clown"
"crazy"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"crazy clown"
"crazy"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"crazy clown"
"crazy"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"crazy clown"
"crazy"
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"crazy clown"
"crazy"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"crazy clown"
"crazy"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"crazy clown"
"crazy"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"crazy clown"
"crazy"
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"crazy clown"
"crazy"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"crazy clown"
"crazy"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"crazy clown"
"crazy"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"crazy clown"
"crazy"
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"crazy clown"
"crazy"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"crazy clown"
"crazy"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"crazy clown"
"crazy"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"crazy clown"
"crazy"
]
]
},

View file

@ -22,7 +22,7 @@
"property",
"name",
"is",
"crazy clown"
"crazy"
]
],
"AXAPI" : [
@ -30,7 +30,7 @@
"property",
"AXDescription",
"is",
"crazy clown"
"crazy"
]
],
"IAccessible2" : [
@ -38,7 +38,7 @@
"property",
"accName",
"is",
"crazy clown"
"crazy"
]
],
"UIA" : [
@ -46,7 +46,7 @@
"property",
"Name",
"is",
"crazy clown"
"crazy"
]
]
},

View file

@ -0,0 +1 @@
@Ms2ger

View file

@ -12,15 +12,17 @@
<script>
'use strict';
promise_test(function() {
return fetch('/interfaces/background-fetch.idl')
.then(response => response.text())
.then(idls => {
var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[Exposed=ServiceWorker] interface ServiceWorkerGlobalScope {};');
idlArray.add_idls(idls);
idlArray.test();
});
promise_test(async function () {
const idls = await fetch('/interfaces/background-fetch.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[Exposed=ServiceWorker] interface ServiceWorkerGlobalScope {};');
idlArray.add_untested_idls('interface ExtendableEvent{};');
idlArray.add_untested_idls('dictionary ExtendableEventInit{};');
idlArray.add_untested_idls(dom, { only: ['EventTarget'] });
idlArray.add_idls(idls);
idlArray.test();
}, 'Exposed interfaces in a Document.');
</script>

View file

@ -3,16 +3,18 @@
importScripts('/resources/testharness.js');
importScripts('/resources/WebIDLParser.js', '/resources/idlharness.js');
promise_test(function() {
return fetch('/interfaces/background-fetch.idl')
.then(response => response.text())
.then(idls => {
var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[Exposed=ServiceWorker] interface ServiceWorkerGlobalScope {};');
idlArray.add_idls(idls);
idlArray.test();
});
promise_test(async function() {
const idls = await fetch('/interfaces/background-fetch.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[SecureContext, Exposed = (Window, Worker)] interface ServiceWorkerGlobalScope {};');
idlArray.add_untested_idls('interface ExtendableEvent{};');
idlArray.add_untested_idls('dictionary ExtendableEventInit{};');
idlArray.add_untested_idls(dom, { only: ['EventTarget'] });
idlArray.add_idls(idls);
idlArray.test();
}, 'Exposed interfaces in a Service Worker.');
done();

View file

@ -9,7 +9,7 @@
const test_desc = 'A device disconnecting while connected should fire the ' +
'gattserverdisconnected event.';
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
.then(({device, fake_peripheral}) => {
fake_peripheral.simulateGATTDisconnection();
return eventPromise(device, 'gattserverdisconnected');

View file

@ -9,7 +9,7 @@
const test_desc = 'A device disconnecting after the BluetoothDevice object ' +
'has been GC\'ed should not access freed memory.';
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
.then(({fake_peripheral}) => {
// 1. Disconnect.
fake_peripheral.simulateGATTDisconnection();

View file

@ -12,7 +12,7 @@ const test_desc = 'If a site disconnects from a device while the platform is ' +
let device, fake_peripheral;
let num_events = 0;
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
.then(_ => ({device, fake_peripheral} = _))
// 1. Listen for disconnections.
.then(() =>

View file

@ -10,7 +10,7 @@ let test_desc = 'A device that reconnects during the gattserverdisconnected ' +
'event should still receive gattserverdisconnected events after ' +
're-connection.';
let device, fake_peripheral;
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
.then(_ => ({device, fake_peripheral} = _))
// 1. Disconnect.
.then(() => new Promise(resolve => {

View file

@ -17,7 +17,7 @@ test(() => {
const test_desc_attr = 'BluetoothDevice attributes.';
let device;
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
.then(({device}) => {
assert_equals(device.constructor.name, 'BluetoothDevice');
var old_device_id = device.id;

View file

@ -14,7 +14,7 @@ const expected = new DOMException(
'requestDevice() options. https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({acceptAllDevices: true})
bluetooth_test(() => getConnectedHealthThermometerDevice({acceptAllDevices: true})
.then(({device}) => assert_promise_rejects_with_message(
device.gatt.getPrimaryServices(),
expected)),

View file

@ -22,8 +22,6 @@ bluetooth_test(() => getDiscoveredHealthThermometerDevice({
.then(() =>
fake_peripheral.setNextGATTConnectionResponse({code: HCI_SUCCESS}))
.then(() => device.gatt.connect())
.then(() =>
fake_peripheral.setNextGATTDiscoveryResponse({code: HCI_SUCCESS}))
.then(() => Promise.all([
assert_promise_rejects_with_message(
device.gatt.getPrimaryService('human_interface_device'),

View file

@ -13,7 +13,7 @@ const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
'/bluetooth/resources/health-thermometer-iframe.html'
let iframe = document.createElement('iframe');
bluetooth_test(() => setUpConnectableHealthThermometerDevice()
bluetooth_test(() => setUpHealthThermometerDevice()
// 1. Load the iframe.
.then(() => new Promise(resolve => {
iframe.src = cross_origin_src;

View file

@ -8,7 +8,7 @@
'use strict';
const test_desc = 'Discover a device using alias, name, or UUID.';
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
// Chrome will always close the previous chooser in the process of handling
// a user gesture for the next request, so these need to be done
// sequentially.

View file

@ -6,10 +6,7 @@
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Consumes a user gesture.';
const expected = new DOMException(
'Must be handling a user gesture to show a permission request.',
'SecurityError');
const test_desc = 'requestDevice calls do not consume user gestures.';
bluetooth_test(() => setUpHealthThermometerAndHeartRateDevices()
.then(() => callWithTrustedClick(() => {
@ -20,8 +17,8 @@ bluetooth_test(() => setUpHealthThermometerAndHeartRateDevices()
return Promise.all([
first.then(device => assert_equals(
device.constructor.name, 'BluetoothDevice')),
assert_promise_rejects_with_message(second,
expected, 'A request should consume a user gesture')
second.then(device => assert_equals(
device.constructor.name, 'BluetoothDevice')),
]);
})), test_desc);
</script>

View file

@ -14,7 +14,7 @@ const expected = 'SecurityError: requestDevice() called from cross-origin ' +
let iframe = document.createElement('iframe');
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
// 1. Load the iframe.
.then(() => new Promise(resolve => {
iframe.sandbox.add('allow-scripts');

View file

@ -66,7 +66,9 @@ function bluetooth_test(func, name, properties) {
.then(() => promise_test(t => Promise.resolve()
// Trigger Chromium-specific setup.
.then(performChromiumSetup)
.then(() => func(t)), name, properties));
.then(() => func(t))
.then(() => navigator.bluetooth.test.allResponsesConsumed())
.then(consumed => assert_true(consumed)), name, properties));
}
// HCI Error Codes. Used for simulateGATT[Dis]ConnectionResponse.
@ -91,6 +93,8 @@ var request_disconnection_characteristic_uuid =
"01d7d88a-7451-419f-aeb8-d65e7b9277af";
// Descriptors:
var blocklist_test_descriptor_uuid = "bad2ddcf-60db-45cd-bef9-fd72b153cf7c";
var blocklist_exclude_reads_descriptor_uuid =
"bad3ec61-3cc3-4954-9702-7977df514114";
// Sometimes we need to test that using either the name, alias, or UUID
// produces the same result. The following objects help us do that.
@ -465,6 +469,15 @@ function generateRequestDeviceArgsWithServices(services = ['heart_rate']) {
}];
}
// Causes |fake_peripheral| to disconnect and returns a promise that resolves
// once `gattserverdisconnected` has been fired on |device|.
function simulateGATTDisconnectionAndWait(device, fake_peripheral) {
return Promise.all([
eventPromise(device, 'gattserverdisconnected'),
fake_peripheral.simulateGATTDisconnection(),
]);
}
// Simulates a pre-connected device with |address|, |name| and
// |knownServiceUUIDs|.
function setUpPreconnectedDevice({
@ -674,6 +687,162 @@ function getConnectedHealthThermometerDevice(options) {
.then(() => Object.assign({device}, fakes));
}
// Returns an object containing a BluetoothDevice discovered using |options|,
// its corresponding FakePeripheral and FakeRemoteGATTServices.
// The simulated device is called 'Blocklist Device' and it has one known
// service UUIDs |blocklist_test_service_uuid| which
// correspond to a service with the same UUID. The
// |blocklist_test_service_uuid| service contains two characteristics:
// - |blocklist_exclude_reads_characteristic_uuid| (read, write)
// - 'gap.peripheral_privacy_flag' (read, write)
// The 'gap.peripheral_privacy_flag' characteristic contains three descriptors:
// - |blocklist_test_descriptor_uuid|
// - |blocklist_exclude_reads_descriptor_uuid|
// - 'gatt.client_characteristic_configuration'
// These are special UUIDs that have been added to the blocklist found at
// https://github.com/WebBluetoothCG/registries/blob/master/gatt_blocklist.txt
// There are also test UUIDs that have been added to the test environment which
// other implementations should add as test UUIDs as well.
// The device has been connected to and its attributes are ready to be
// discovered.
function getBlocklistDevice(
options = {filters: [{services: [blocklist_test_service_uuid]}]}) {
let device, fake_peripheral, fake_blocklist_test_service,
fake_blocklist_exclude_reads_characteristic,
fake_blocklist_exclude_writes_characteristic,
fake_blocklist_descriptor,
fake_blocklist_exclude_reads_descriptor,
fake_blocklist_exclude_writes_descriptor;
return setUpPreconnectedDevice({
address: '11:11:11:11:11:11',
name: 'Blocklist Device',
knownServiceUUIDs: ['generic_access', blocklist_test_service_uuid],
})
.then(_ => fake_peripheral = _)
.then(() => requestDeviceWithTrustedClick(options))
.then(_ => device = _)
.then(() => fake_peripheral.setNextGATTConnectionResponse({
code: HCI_SUCCESS,
}))
.then(() => device.gatt.connect())
.then(() => fake_peripheral.addFakeService({
uuid: blocklist_test_service_uuid,
}))
.then(_ => fake_blocklist_test_service = _)
.then(() => fake_blocklist_test_service.addFakeCharacteristic({
uuid: blocklist_exclude_reads_characteristic_uuid,
properties: ['read', 'write'],
}))
.then(_ => fake_blocklist_exclude_reads_characteristic = _)
.then(() => fake_blocklist_test_service.addFakeCharacteristic({
uuid: 'gap.peripheral_privacy_flag',
properties: ['read', 'write'],
}))
.then(_ => fake_blocklist_exclude_writes_characteristic = _)
.then(() => fake_blocklist_exclude_writes_characteristic
.addFakeDescriptor({uuid: blocklist_test_descriptor_uuid}))
.then(_ => fake_blocklist_descriptor = _)
.then(() => fake_blocklist_exclude_writes_characteristic
.addFakeDescriptor({uuid: blocklist_exclude_reads_descriptor_uuid}))
.then(_ => fake_blocklist_exclude_reads_descriptor = _)
.then(() => fake_blocklist_exclude_writes_characteristic
.addFakeDescriptor({
uuid: 'gatt.client_characteristic_configuration'
}))
.then(_ => fake_blocklist_exclude_writes_descriptor = _)
.then(() => fake_peripheral.setNextGATTDiscoveryResponse({
code: HCI_SUCCESS,
}))
.then(() => ({
device,
fake_peripheral,
fake_blocklist_test_service,
fake_blocklist_exclude_reads_characteristic,
fake_blocklist_exclude_writes_characteristic,
fake_blocklist_descriptor,
fake_blocklist_exclude_reads_descriptor,
fake_blocklist_exclude_writes_descriptor,
}));
}
// Returns an object containing a Blocklist Test BluetoothRemoveGattService and
// its corresponding FakeRemoteGATTService.
function getBlocklistTestService() {
let result;
return getBlocklistDevice()
.then(_ => result = _)
.then(() =>
result.device.gatt.getPrimaryService(blocklist_test_service_uuid))
.then(service => Object.assign(result, {
service,
fake_service: result.fake_blocklist_test_service,
}));
}
// Returns an object containing a blocklisted BluetoothRemoteGATTCharacteristic
// that excludes reads and its corresponding FakeRemoteGATTCharacteristic.
function getBlocklistExcludeReadsCharacteristic() {
let result, fake_characteristic;
return getBlocklistTestService()
.then(_ => result = _)
.then(() => result.service.getCharacteristic(
blocklist_exclude_reads_characteristic_uuid))
.then(characteristic =>
Object.assign(
result, {
characteristic,
fake_characteristic:
result.fake_blocklist_exclude_reads_characteristic
}));
}
// Returns an object containing a blocklisted BluetoothRemoteGATTCharacteristic
// that excludes writes and its corresponding FakeRemoteGATTCharacteristic.
function getBlocklistExcludeWritesCharacteristic() {
let result, fake_characteristic;
return getBlocklistTestService()
.then(_ => result = _)
.then(() => result.service.getCharacteristic(
'gap.peripheral_privacy_flag'))
.then(characteristic =>
Object.assign(
result, {
characteristic,
fake_characteristic:
result.fake_blocklist_exclude_writes_characteristic
}));
}
// Returns an object containing a blocklisted BluetoothRemoteGATTDescriptor that
// excludes reads and its corresponding FakeRemoteGATTDescriptor.
function getBlocklistExcludeReadsDescriptor() {
let result;
return getBlocklistExcludeWritesCharacteristic()
.then(_ => result = _)
.then(() => result.characteristic.getDescriptor(
blocklist_exclude_reads_descriptor_uuid))
.then(descriptor => Object.assign(
result, {
descriptor,
fake_descriptor: result.fake_blocklist_exclude_reads_descriptor
}));
}
// Returns an object containing a blocklisted BluetoothRemoteGATTDescriptor that
// excludes writes and its corresponding FakeRemoteGATTDescriptor.
function getBlocklistExcludeWritesDescriptor() {
let result;
return getBlocklistExcludeWritesCharacteristic()
.then(_ => result = _)
.then(() => result.characteristic.getDescriptor(
'gatt.client_characteristic_configuration'))
.then(descriptor => Object.assign(
result, {
descriptor: descriptor,
fake_descriptor: result.fake_blocklist_exclude_writes_descriptor,
}));
}
// Returns the same device and fake peripheral as getHealthThermometerDevice()
// after another frame (an iframe we insert) discovered the device,
// connected to it and discovered its services.
@ -768,42 +937,53 @@ function getEmptyHealthThermometerService(options) {
// The primary service with 'device_information' UUID has a characteristics
// with UUID 'serial_number_string'. The device has been connected to and its
// attributes are ready to be discovered.
// TODO(crbug.com/719816): Add descriptors.
function getHIDDevice(options) {
let device, fake_peripheral;
return getConnectedHIDDevice(options)
.then(_ => ({device, fake_peripheral} = _))
.then(() => fake_peripheral.setNextGATTDiscoveryResponse({
code: HCI_SUCCESS,
}))
.then(() => ({device, fake_peripheral}));
}
// Similar to getHealthThermometerDevice except the GATT discovery
// response has not been set yet so more attributes can still be added.
// TODO(crbug.com/719816): Add descriptors.
function getConnectedHIDDevice(options) {
let device, fake_peripheral;
return setUpPreconnectedDevice({
address: '10:10:10:10:10:10',
name: 'HID Device',
knownServiceUUIDs: [
'generic_access',
'device_information',
'human_interface_device'
'human_interface_device',
],
})
.then(fake_peripheral => {
return requestDeviceWithTrustedClick(options)
.then(device => {
return fake_peripheral
.setNextGATTConnectionResponse({
code: HCI_SUCCESS})
.then(() => device.gatt.connect())
.then(() => fake_peripheral.addFakeService({
uuid: 'generic_access'}))
.then(() => fake_peripheral.addFakeService({
uuid: 'device_information'}))
// Blocklisted Characteristic:
// https://github.com/WebBluetoothCG/registries/blob/master/gatt_blocklist.txt
.then(dev_info => dev_info.addFakeCharacteristic({
uuid: 'serial_number_string', properties: ['read']}))
.then(() => fake_peripheral.addFakeService({
uuid: 'human_interface_device'}))
.then(() => fake_peripheral.setNextGATTDiscoveryResponse({
code: HCI_SUCCESS}))
.then(() => ({
device: device,
fake_peripheral: fake_peripheral
}));
});
});
.then(_ => (fake_peripheral = _))
.then(() => requestDeviceWithTrustedClick(options))
.then(_ => (device = _))
.then(() => fake_peripheral.setNextGATTConnectionResponse({
code: HCI_SUCCESS,
}))
.then(() => device.gatt.connect())
.then(() => fake_peripheral.addFakeService({
uuid: 'generic_access',
}))
.then(() => fake_peripheral.addFakeService({
uuid: 'device_information',
}))
// Blocklisted Characteristic:
// https://github.com/WebBluetoothCG/registries/blob/master/gatt_blocklist.txt
.then(dev_info => dev_info.addFakeCharacteristic({
uuid: 'serial_number_string',
properties: ['read'],
}))
.then(() => fake_peripheral.addFakeService({
uuid: 'human_interface_device',
}))
.then(() => ({device, fake_peripheral}));
}
// Similar to getHealthThermometerDevice() except the device

View file

@ -7,7 +7,7 @@ const expected = new DOMException(
'NetworkError');
let device;
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}],
optionalServices: ['generic_access']
})

View file

@ -11,7 +11,7 @@ const expected = new DOMException(
" e.g. 'alert_notification'.",
'TypeError');
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
.then(({device}) => assert_promise_rejects_with_message(
device.gatt.CALLS([
getPrimaryService('wrong_name')|

View file

@ -7,7 +7,7 @@ const expected = new DOMException(
'https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}]
})
.then(({device}) => Promise.all([

View file

@ -7,7 +7,7 @@ const expected = new DOMException(
'https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({acceptAllDevices: true})
bluetooth_test(() => getConnectedHealthThermometerDevice({acceptAllDevices: true})
.then(({device}) => assert_promise_rejects_with_message(
device.gatt.CALLS([
getPrimaryService('heart_rate')|

View file

@ -6,7 +6,7 @@ const expected = new DOMException(
'to \'optionalServices\' in requestDevice() options. https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}]
})
.then(({device}) => Promise.all([

View file

@ -15,7 +15,7 @@ const expected = new DOMException(
'NetworkError');
let device;
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}],
optionalServices: ['generic_access']
})

View file

@ -19,7 +19,7 @@ const expected = new DOMException(
" e.g. 'alert_notification'.",
'TypeError');
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
.then(({device}) => assert_promise_rejects_with_message(
device.gatt.getPrimaryService('wrong_name'),
expected,

View file

@ -15,7 +15,7 @@ const expected = new DOMException(
'https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}]
})
.then(({device}) => Promise.all([

View file

@ -15,7 +15,7 @@ const expected = new DOMException(
'https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({acceptAllDevices: true})
bluetooth_test(() => getConnectedHealthThermometerDevice({acceptAllDevices: true})
.then(({device}) => assert_promise_rejects_with_message(
device.gatt.getPrimaryService('heart_rate'),
expected)),

View file

@ -14,7 +14,7 @@ const expected = new DOMException(
'to \'optionalServices\' in requestDevice() options. https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}]
})
.then(({device}) => Promise.all([

View file

@ -12,7 +12,7 @@ const expected = new DOMException(
'UUID to \'optionalServices\' in requestDevice() options. ' +
'https://goo.gl/HxfxSQ', 'SecurityError');
bluetooth_test(() => getHIDDevice({
bluetooth_test(() => getConnectedHIDDevice({
filters: [{services: ['device_information']}],
optionalServices: ['human_interface_device']
})

View file

@ -15,7 +15,7 @@ const expected = new DOMException(
'NetworkError');
let device;
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}],
optionalServices: ['generic_access']
})

View file

@ -15,7 +15,7 @@ const expected = new DOMException(
'NetworkError');
let device;
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}],
optionalServices: ['generic_access']
})

View file

@ -19,7 +19,7 @@ const expected = new DOMException(
" e.g. 'alert_notification'.",
'TypeError');
bluetooth_test(() => getHealthThermometerDevice()
bluetooth_test(() => getConnectedHealthThermometerDevice()
.then(({device}) => assert_promise_rejects_with_message(
device.gatt.getPrimaryServices('wrong_name'),
expected,

View file

@ -15,7 +15,7 @@ const expected = new DOMException(
'https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}]
})
.then(({device}) => Promise.all([

View file

@ -15,7 +15,7 @@ const expected = new DOMException(
'https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({acceptAllDevices: true})
bluetooth_test(() => getConnectedHealthThermometerDevice({acceptAllDevices: true})
.then(({device}) => assert_promise_rejects_with_message(
device.gatt.getPrimaryServices('heart_rate'),
expected)),

View file

@ -15,7 +15,7 @@ const expected = new DOMException(
'https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({acceptAllDevices: true})
bluetooth_test(() => getConnectedHealthThermometerDevice({acceptAllDevices: true})
.then(({device}) => assert_promise_rejects_with_message(
device.gatt.getPrimaryServices(),
expected)),

View file

@ -14,7 +14,7 @@ const expected = new DOMException(
'to \'optionalServices\' in requestDevice() options. https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => getHealthThermometerDevice({
bluetooth_test(() => getConnectedHealthThermometerDevice({
filters: [{services: ['health_thermometer']}]
})
.then(({device}) => Promise.all([

View file

@ -0,0 +1,24 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// See https://wicg.github.io/budget-api/
promise_test(async () => {
const html = await fetch('/interfaces/html.idl').then(r => r.text());
const workers = await fetch('/interfaces/dedicated-workers.idl').then(r => r.text());
const idl = await fetch('/interfaces/budget-api.idl').then(r => r.text());
const idlArray = new IdlArray();
idlArray.add_untested_idls(html, { only: [
'Navigator',
'NavigatorContentUtils',
'NavigatorCookies',
'NavigatorPlugins',
] });
idlArray.add_untested_idls(workers);
idlArray.add_idls(idl);
idlArray.test();
done();
}, 'budget-api interfaces.');

View file

@ -7,25 +7,39 @@
// If the response for the HTML file contains "Accept-CH" in the response
// headers, then the browser should attach the specified client hints in the
// HTTP request headers. Test this functionality by fetching an
// XHR from this page. The response headers for this page include
// "Accept-CH: device-memory, dpr, viewport-width".
// HTTP request headers depending on whether the resource is being fetched from
// the same origin or a different origin. Test this functionality by fetching
// same-origin and cross-origin resources from this page. The response headers
// for this page include "Accept-CH: device-memory, dpr, viewport-width".
//
// echo_client_hints_received.py includes "device-memory-received",
// "dpr-received" and "viewport-width-received" in the response headers
// depending on the set of client hints it receives in the request headers.
promise_test(t => {
promise_test(t => {
return fetch("https://{{domains[]}}:{{ports[https][0]}}/client-hints/echo_client_hints_received.py", {"mode": "no-cors"}).then(r => {
assert_equals(r.status, 200)
// Verify that the browser includes client hints in the headers when
// fetching the XHR.
// Verify that the browser includes client hints in the headers for a
// same-origin fetch.
assert_true(r.headers.has("device-memory-received"), "device-memory-received");
assert_true(r.headers.has("dpr-received"), "dpr-received");
assert_true(r.headers.has("viewport-width-received"), "viewport-width-received");
});
}, "Accept-CH header test");
promise_test(t => {
return fetch("https://{{domains[www]}}:{{ports[https][0]}}/client-hints/echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser does not include client hints in the headers
// for a cross-origin fetch.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
assert_false(r.headers.has("dpr-received"), "dpr-received");
assert_false(r.headers.has("viewport-width-received"), "viewport-width-received");
});
}, "Cross-Origin Accept-CH header test");
</script>
</body>

View file

@ -4,6 +4,8 @@ def main(request, response):
request header was received or not.
"""
response.headers.append("Access-Control-Allow-Origin", "*")
if "device-memory" in request.headers:
response.headers.set("device-memory-received", "true")
if "dpr" in request.headers:

View file

@ -9,13 +9,13 @@
<script>
'use strict';
function doTest(idls) {
function doTest(idl, dom) {
var idl_array = new IdlArray();
idl_array.add_untested_idls('interface Navigator {};');
idl_array.add_untested_idls('interface EventTarget {};');
for (let idl of idls) {
idl_array.add_idls(idl);
}
idl_array.add_untested_idls('dictionary PermissionDescriptor {};');
idl_array.add_untested_idls(dom, { only: ['Event', 'EventInit'] });
idl_array.add_idls(idl);
idl_array.add_objects({
Navigator: ['navigator'],
Clipboard: ['navigator.clipboard'],
@ -29,7 +29,11 @@ function fetchText(url) {
}
promise_test(() => {
return Promise.all(["/interfaces/clipboard-apis.idl"].map(fetchText))
.then(doTest);
return Promise.all(
[
"/interfaces/clipboard-apis.idl",
"/interfaces/dom.idl",
].map(fetchText))
.then(([idl, dom]) => doTest(idl, dom));
}, "Test driver");
</script>

View file

@ -0,0 +1,17 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://compat.spec.whatwg.org/
promise_test(async () => {
const idl = await fetch('/interfaces/compat.idl').then(r => r.text());
const idlArray = new IdlArray();
idlArray.add_untested_idls('interface Window {};');
idlArray.add_untested_idls('interface EventTarget{};');
idlArray.add_untested_idls('interface HTMLBodyElement{};');
idlArray.add_idls(idl);
idlArray.test();
done();
}, 'compat interfaces.');

View file

@ -0,0 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>webkit-background-origin should not accept text as value</title>
<link rel="author" title="Rob Buis" href="rob.buis@chromium.org">
<p>There should be a green square below and no red.</p>
<div style="width: 100px; height: 100px; background-color: green"></div>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>webkit-background-origin should not accept text as value</title>
<link rel="author" title="Rob Buis" href="rob.buis@chromium.org">
<link rel="match" href="webkit-background-origin-text-ref.html">
<style>
#target {
width: 0px;
background-image: linear-gradient(green, green 50%, red 50%, red);
background-size: 200px 200px;
background-origin: border-box;
-webkit-background-origin: text;
padding: 25px;
border: 25px solid transparent;
}
</style>
<p>There should be a green square below and no red.</p>
<div id="target"></div>

View file

@ -1,3 +1,9 @@
/**
* These tests assert the non-existence of certain
* legacy Console methods that are not included in
* the specification: http://console.spec.whatwg.org/
*/
"use strict";
test(() => {
@ -6,4 +12,8 @@ test(() => {
test(() => {
assert_equals(console.timelineEnd, undefined, "console.timelineEnd should be undefined");
}, "'timelineEnd' function should not exist on the console object");
}, "'timelineEnd' function should not exist on the console object");
test(() => {
assert_equals(console.markTimeline, undefined, "console.markTimeline should be undefined");
}, "'markTimeline' function should not exist on the console object");

View file

@ -118,7 +118,7 @@ function assert_iframe_with_csp(t, url, csp, shouldBlock, urlId, blockedURI) {
window.onmessage = function (e) {
if (e.source != i.contentWindow)
return;
t.unreached_func('No message should be sent from the frame.');
t.assert_unreached('No message should be sent from the frame.');
}
i.onload = t.step_func(function () {
// Delay the check until after the postMessage has a chance to execute.
@ -138,12 +138,18 @@ function assert_iframe_with_csp(t, url, csp, shouldBlock, urlId, blockedURI) {
t.done();
}));
} else {
// Assert iframe loads.
// Assert iframe loads. Wait for both the load event and the postMessage.
window.addEventListener('message', t.step_func(e => {
if (e.source != i.contentWindow)
return;
assert_true(loaded[urlId]);
if (i.onloadReceived)
t.done();
}));
i.onload = t.step_func(function () {
// Delay the check until after the postMessage has a chance to execute.
setTimeout(t.step_func_done(function () {
assert_true(loaded[urlId]);
}), 1);
if (loaded[urlId])
t.done();
i.onloadReceived = true;
});
}
document.body.appendChild(i);

View file

@ -19,10 +19,7 @@
var i = document.createElement('iframe');
i.src = "support/frame-ancestors-and-x-frame-options.sub.html?policy=other-origin.com&xfo=SAMEORIGIN";
i.onload = t.step_func_done(function () {
assert_throws(
"SecurityError",
function () { i.contentDocument.origin },
"The same-origin page was blocked and sandboxed.");
assert_equals(i.contentDocument, null);
});
document.body.appendChild(i);
}, "A 'frame-ancestors' CSP directive overrides an 'x-frame-options' header which would allow the page.");

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -15,4 +16,4 @@
<iframe srcdoc="<iframe src='support/navigate_parent.sub.html?csp=navigate-to%20%27self%27'>">
</body>
</body>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -16,4 +17,4 @@
<iframe srcdoc="<iframe src='support/navigate_parent.sub.html?csp=navigate-to%20%27none%27'>">
</body>
</body>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -13,4 +14,4 @@
});
</script>
<iframe src="support/link_click_navigation.sub.html?csp=navigate-to%20%27self%27&target=post_message_to_frame_owner.html">
</body>
</body>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -14,4 +15,4 @@
});
</script>
<iframe src="support/link_click_navigation.sub.html?csp=navigate-to%20%27none%27&target=post_message_to_frame_owner.html">
</body>
</body>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -13,4 +14,4 @@
});
</script>
<iframe src="support/link_click_navigation.sub.html?csp=navigate-to%20http%3A%2F%2F{{domains[www1]}}:{{ports[http][0]}}&target=http%3A%2F%2F{{domains[www1]}}:{{ports[http][0]}}%2Fcontent-security-policy%2Fnavigate-to%2Fsupport%2Fpost_message_to_frame_owner.html">
</body>
</body>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -14,4 +15,4 @@
});
</script>
<iframe src="support/link_click_navigation.sub.html?csp=navigate-to%20%27self%27&target=http%3A%2F%2F{{domains[www1]}}:{{ports[http][0]}}%2Fcontent-security-policy%2Fnavigate-to%2Fsupport%2Fpost_message_to_frame_owner.html">
</body>
</body>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -13,4 +14,4 @@
});
</script>
<iframe src="support/link_click_navigation.sub.html?csp=navigate-to%20%27self%27&target=redirect_to_post_message_to_frame_owner.py">
</body>
</body>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -14,4 +15,4 @@
});
</script>
<iframe src="support/link_click_navigation.sub.html?csp=navigate-to%20{{location[server]}}/content-security-policy/navigate-to/support/redirect_to_post_message_to_frame_owner.py&target=redirect_to_post_message_to_frame_owner.py">
</body>
</body>

View file

@ -1,20 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="prefetch-src 'self'">
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='/content-security-policy/support/testharness-helper.js'></script>
<script src='/content-security-policy/support/prefetch-helper.js'></script>
<script>
async_test(t => {
let url = window.origin + '/content-security-policy/support/pass.png';
var win = window.open('/content-security-policy/support/' +
'file-prefetch-allowed.html');
win.addEventListener('load', function () {
// Cache control headers are added,since they are needed
// to enable prefetching.
let url = '/content-security-policy/support/pass.png' +
'?pipe=header(Cache-Control, max-age=604800)';
let link = document.createElement('link');
link.rel = 'prefetch';
link.href = url;
assert_link_prefetches(t, link);
// Link element is created on the new opened window.
let link = win.document.createElement('link');
link.rel = 'prefetch';
link.href = url;
assert_link_prefetches(t, link);
win.close();
}, false);
}, 'Prefetch succeeds when allowed by prefetch-src');
</script>
</head>

View file

@ -21,9 +21,6 @@
long lineNumber;
long columnNumber;
};
interface Event {
};
</script>
<script type="text/plain" id="tested">
[Constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict)]
@ -42,11 +39,16 @@
};
</script>
<script>
var idl_array = new IdlArray();
promise_test(async function() {
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_untested_idls(document.querySelector('#untested').textContent);
idl_array.add_untested_idls(dom, { only: ['Event', 'EventInit'] });
idl_array.add_idls(document.querySelector('#tested').textContent);
idl_array.add_objects({
SecurityPolicyViolationEvent: ['new SecurityPolicyViolationEvent({})']
SecurityPolicyViolationEvent: ['new SecurityPolicyViolationEvent({})']
});
idl_array.test();
})
</script>

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<!-- CSP directive 'prefetch-src' is not supported via meta tag though -->
<meta http-equiv="Content-Security-Policy" content="prefetch-src 'self'">
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,59 @@
'use strict';
// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/w3c/web-platform-tests/issues/6075
async function async_cleanup(cleanup_function) {
try {
await cleanup_function();
} catch (e) {
// Errors in cleanup functions shouldn't result in test failures.
}
}
promise_test(async testCase => {
const inTwentyFourHours = new Date(Date.now() + 24 * 60 * 60 * 1000);
assert_equals(
await cookieStore.set(
'cookie-name', 'cookie-value', { expires: inTwentyFourHours }),
undefined);
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires option: Date object');
promise_test(async testCase => {
const inTwentyFourHours = Date.now() + 24 * 60 * 60 * 1000;
assert_equals(
await cookieStore.set(
'cookie-name', 'cookie-value', { expires: inTwentyFourHours }),
undefined);
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires option: milliseconds since epoch object');
promise_test(async testCase => {
const year = (new Date()).getUTCFullYear() + 1;
const date = new Date('07 Jun ' + year + ' 07:07:07 UTC');
const day = ('Sun Mon Tue Wed Thu Fri Sat'.split(' '))[date.getUTCDay()];
const nextJune = `${day}, 07 Jun ${year} + ' 07:07:07 GMT`;
assert_equals(
await cookieStore.set(
'cookie-name', 'cookie-value', { expires: nextJune }),
undefined);
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires option: HTTP date string');

View file

@ -1,6 +1,6 @@
<!doctype html>
<meta charset="utf-8">
<title>Async Cookies: cookieStore handles special cookie names correctly</title>
<title>Cookie Store: cookieStore handles special cookie names correctly</title>
<link rel="help" href="https://github.com/WICG/cookie-store">
<link rel="author" href="pwnall@chromium.org" title="Victor Costan">
<script src="/resources/testharness.js"></script>
@ -8,28 +8,64 @@
<script>
'use strict';
promise_test(async testCase => {
await promise_rejects(testCase, new TypeError(), cookieStore.set(
'__Secure-cookie-name', 'secure-cookie-value'));
['__Secure-', '__Host-'].forEach(prefix => {
promise_test(async testCase => {
await promise_rejects(
testCase, new TypeError(),
cookieStore.set(`${prefix}cookie-name`, `secure-cookie-value`),
`Setting ${prefix} cookies should fail in non-secure contexts`);
try { await cookieStore.delete('__Secure-cookie-name'); } catch (e) {}
}, 'cookieStore.set with __Secure- name on insecure origin');
try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}
}, `cookieStore.set with ${prefix} name on non-secure origin`);
promise_test(async testCase => {
await promise_rejects(testCase, new TypeError(), cookieStore.set(
'__Host-cookie-name', 'host-cookie-value'));
promise_test(async testCase => {
await promise_rejects(
testCase, new TypeError(),
cookieStore.set(
`${prefix}cookie-name`, `secure-cookie-value`, {
expires: Date.now() - (24 * 60 * 60 * 1000)
}),
`Setting expired ${prefix} cookies should fail in non-secure contexts`);
try { await cookieStore.delete('__Host-cookie-name'); } catch (e) {}
}, 'cookieStore.set with __Host- name on insecure origin');
try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}
}, `cookieStore.set of expired ${prefix} cookie on non-secure origin`);
promise_test(async testCase => {
await promise_rejects(testCase, new TypeError(), cookieStore.delete(
'__Secure-cookie-name', 'secure-cookie-value'));
}, 'cookieStore.delete with __Secure- name on insecure origin');
promise_test(async testCase => {
assert_equals(
await cookieStore.get(`${prefix}cookie-name`),
null,
'get with ${prefix} prefix should not reject');
assert_equals(
await cookieStore.get({name: `${prefix}cookie-name`}),
null,
'get with ${prefix} prefix name option should not reject');
assert_equals(
await cookieStore.get({name: prefix, matchType: 'startsWith'}),
null,
'get with ${prefix} name and startsWith options should not reject');
}, `cookieStore.get with ${prefix} name on non-secure origin`);
promise_test(async testCase => {
await promise_rejects(testCase, new TypeError(), cookieStore.delete(
'__Host-cookie-name', 'host-cookie-value'));
}, 'cookieStore.delete with __Host- name on insecure origin');
promise_test(async testCase => {
assert_array_equals(
await cookieStore.getAll(`${prefix}cookie-name`),
[],
'getAll with ${prefix} prefix should not reject');
assert_array_equals(
await cookieStore.getAll({name: `${prefix}cookie-name`}),
[],
'getAll with ${prefix} prefix name option should not reject');
assert_array_equals(
await cookieStore.getAll({name: prefix, matchType: 'startsWith'}),
[],
'getAll with ${prefix} name and startsWith options should not reject');
}, `cookieStore.getAll with ${prefix} name on non-secure origin`);
promise_test(async testCase => {
await promise_rejects(
testCase, new TypeError(),
cookieStore.delete(`${prefix}cookie-name`, `host-cookie-value`),
`Deleting ${prefix} cookies should fail in non-secure contexts`);
}, `cookieStore.delete with ${prefix} name on non-secure origin`);
});
</script>

View file

@ -0,0 +1,41 @@
<!doctype html>
<meta charset="utf-8">
<title>Cookie Store: cookieStore handles special cookie names correctly (secure context)</title>
<link rel="help" href="https://github.com/WICG/cookie-store">
<link rel="author" href="pwnall@chromium.org" title="Victor Costan">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
['__Secure-', '__Host-'].forEach(prefix => {
promise_test(async testCase => {
await cookieStore.set(`${prefix}cookie-name`, `secure-cookie-value`);
assert_equals(
(await cookieStore.get(`${prefix}cookie-name`)).value,
'secure-cookie-value',
`Setting ${prefix} cookies should not fail in secure context`);
try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}
}, `cookieStore.set with ${prefix} name on secure origin`);
promise_test(async testCase => {
// This test is for symmetry with the non-secure case. In non-secure
// contexts, the set() should fail even if the expiration date makes
// the operation a no-op.
await cookieStore.set(
`${prefix}cookie-name`, `secure-cookie-value`, {
expires: Date.now() - (24 * 60 * 60 * 1000)
});
assert_equals(await cookieStore.get(`${prefix}cookie-name`), null);
try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}
}, `cookieStore.set of expired ${prefix} cookie name on secure origin`);
promise_test(async testCase => {
assert_equals(
await cookieStore.delete(`${prefix}cookie-name`), undefined,
`Deleting ${prefix} cookies should not fail in secure context`);
}, `cookieStore.delete with ${prefix} name on secure origin`);
});
</script>

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: expiration</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/expiration.js"></script>

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: expiration (HTTPS)</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/expiration.js"></script>

View file

@ -10,21 +10,38 @@
'use strict';
promise_test(async t => {
const urls = ['/interfaces/html.idl', '/interfaces/cookie-store.idl'];
const [html, cookie_store] = await Promise.all(
urls.map(url => fetch(url).then(response => response.text())));
const urls = [
'/interfaces/uievents.idl',
'/interfaces/dom.idl',
'/interfaces/html.idl',
'/interfaces/cookie-store.idl'
];
const [uievents, dom, html, cookie_store] = await Promise.all(
urls.map(url => fetch(url).then(r => r.text())));
const idl_array = new IdlArray();
// Dependencies of HTML
idl_array.add_untested_idls(dom, { only: [
'Event',
'EventInit',
'EventTarget',
'HTMLCollection',
'NodeList',
] });
idl_array.add_untested_idls('interface Document {};');
idl_array.add_untested_idls('interface Element {};');
idl_array.add_untested_idls('interface LinkStyle {};');
idl_array.add_untested_idls('interface SVGElement {};');
idl_array.add_untested_idls(html);
idl_array.add_untested_idls(uievents, { only: [
'UIEvent',
'UIEventInit',
'MouseEvent',
'MouseEventInit',
'EventModifierInit',
] });
idl_array.add_untested_idls('interface Event {};');
idl_array.add_untested_idls('dictionary EventInit {};');
idl_array.add_untested_idls('interface EventTarget {};');
idl_array.add_untested_idls(
`[Global=ServiceWorker, Exposed=ServiceWorker]
interface ServiceWorkerGlobalScope {};`);

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: One simple origin cookie</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/one_simple_origin_cookie.js"></script>

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: One simple origin cookie (HTTPS)</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/one_simple_origin_cookie.js"></script>

View file

@ -1,89 +0,0 @@
'use strict';
// Set the secure example.org-domain cookie __Secure-COOKIENAME with
// value cookie-value on path /cgi-bin/ and 24 hour duration; domain
// and path will be rewritten below.
//
// This uses a Date object for expiration.
async function setOneDaySecureCookieWithDate() {
// one day ahead, ignoring a possible leap-second
let inTwentyFourHours = new Date(Date.now() + 24 * 60 * 60 * 1000);
await cookieStore.set('__Secure-COOKIENAME', 'cookie-value', {
path: kPath,
expires: inTwentyFourHours,
secure: true,
domain: location.hostname
});
}
// Set the secured example.org-domain cookie __Secure-COOKIENAME with
// value cookie-value on path /cgi-bin/ and expiration in June of next
// year; domain and path will be rewritten below.
//
// This uses an HTTP-style date string for expiration.
async function setSecureCookieWithHttpLikeExpirationString() {
const year = (new Date()).getUTCFullYear() + 1;
const date = new Date('07 Jun ' + year + ' 07:07:07 UTC');
const day = ('Sun Mon Tue Wed Thu Fri Sat'.split(' '))[date.getUTCDay()];
await cookieStore.set('__Secure-COOKIENAME', 'cookie-value', {
path: kPath,
expires: day + ', 07 Jun ' + year + ' 07:07:07 GMT',
secure: true,
domain: location.hostname
});
}
// Set the unsecured example.org-domain cookie LEGACYCOOKIENAME with
// value cookie-value on path /cgi-bin/ and 24 hour duration; domain
// and path will be rewritten below.
//
// This uses milliseconds since the start of the Unix epoch for
// expiration.
async function setOneDayUnsecuredCookieWithMillisecondsSinceEpoch() {
// one day ahead, ignoring a possible leap-second
let inTwentyFourHours = Date.now() + 24 * 60 * 60 * 1000;
await cookieStore.set('LEGACYCOOKIENAME', 'cookie-value', {
path: kPath,
expires: inTwentyFourHours,
secure: false,
domain: location.hostname
});
}
// Delete the cookie written by
// setOneDayUnsecuredCookieWithMillisecondsSinceEpoch.
async function deleteUnsecuredCookieWithDomainAndPath() {
await cookieStore.delete('LEGACYCOOKIENAME', {
path: kPath,
secure: false,
domain: location.hostname
});
}
cookie_test(async testCase => {
await promise_rejects_when_unsecured(
testCase,
new TypeError(),
setOneDaySecureCookieWithDate(),
'Secure cookies only writable from secure contexts');
const eventPromise = observeNextCookieChangeEvent();
await setOneDayUnsecuredCookieWithMillisecondsSinceEpoch();
assert_equals(
await getCookieString('LEGACYCOOKIENAME'),
'LEGACYCOOKIENAME=cookie-value',
'Ensure unsecured cookie we set is visible');
await verifyCookieChangeEvent(
eventPromise,
{changed: [{name: 'LEGACYCOOKIENAME', value: 'cookie-value'}]},
'Ensure unsecured cookie we set is visible to observer');
await deleteUnsecuredCookieWithDomainAndPath();
await promise_rejects_when_unsecured(
testCase,
new TypeError(),
setSecureCookieWithHttpLikeExpirationString(),
'Secure cookies only writable from secure contexts');
}, 'expiration');

View file

@ -3,10 +3,10 @@
cookie_test(async t => {
let eventPromise = observeNextCookieChangeEvent();
await cookieStore.set('', 'first-value');
const actual1 =
(await cookieStore.getAll('')).map(({ value }) => value).join(';');
const expected1 = 'first-value';
assert_equals(actual1, expected1);
assert_equals(
(await cookieStore.getAll('')).map(({ value }) => value).join(';'),
'first-value',
'Cookie with no name and normal value should have been set');
await verifyCookieChangeEvent(
eventPromise, {changed: [{name: '', value: 'first-value'}]},
'Observed no-name change');
@ -16,31 +16,26 @@ cookie_test(async t => {
new TypeError(),
cookieStore.set('', 'suspicious-value=resembles-name-and-value'),
'Expected promise rejection when setting a cookie with' +
' no name and "=" in value');
' no name and "=" in value (via arguments)');
await promise_rejects(
t,
new TypeError(),
cookieStore.set(
{name: '', value: 'suspicious-value=resembles-name-and-value'}),
'Expected promise rejection when setting a cookie with' +
' no name and "=" in value (via options)');
const actual2 =
(await cookieStore.getAll('')).map(({ value }) => value).join(';');
const expected2 = 'first-value';
assert_equals(actual2, expected2);
assert_equals(
await getCookieString(),
(await cookieStore.getAll('')).map(({ value }) => value).join(';'),
'first-value',
'Earlier cookie jar after rejected');
'Cookie with no name should still have previous value');
eventPromise = observeNextCookieChangeEvent();
await cookieStore.delete('');
await verifyCookieChangeEvent(
eventPromise, {deleted: [{name: '', value: ''}]},
eventPromise, {deleted: [{name: ''}]},
'Observed no-name deletion');
assert_equals(
await getCookieString(),
undefined,
'Empty cookie jar after cleanup');
assert_equals(
await getCookieStringHttp(),
undefined,
'Empty HTTP cookie jar after cleanup');
}, "Verify that attempting to set a cookie with no name and with '=' in" +
" the value does not work.");

View file

@ -1,57 +0,0 @@
'use strict';
// Helper to verify first-of-name get using async/await.
//
// Returns the first script-visible value of the __Host-COOKIENAME cookie or
// undefined if no matching cookies are script-visible.
async function getOneSimpleOriginCookie() {
let cookie = await cookieStore.get('__Host-COOKIENAME');
if (!cookie) return undefined;
return cookie.value;
}
// Returns the number of script-visible cookies whose names start with
// __Host-COOKIEN
async function countMatchingSimpleOriginCookies() {
let cookieList = await cookieStore.getAll({
name: '__Host-COOKIEN',
matchType: 'startsWith'
});
return cookieList.length;
}
// Set the secure implicit-domain cookie __Host-COOKIENAME with value
// cookie-value on path / and session duration.
async function setOneSimpleOriginSessionCookie() {
await cookieStore.set('__Host-COOKIENAME', 'cookie-value');
};
cookie_test(async testCase => {
await promise_rejects_when_unsecured(
testCase,
new TypeError(),
setOneSimpleOriginSessionCookie(),
'__Host- prefix only writable from secure contexts');
if (!kIsUnsecured) {
assert_equals(
await getOneSimpleOriginCookie(),
'cookie-value',
'__Host-COOKIENAME cookie should be found in a secure context');
} else {
assert_equals(
await getOneSimpleOriginCookie(),
undefined,
'__Host-COOKIENAME cookie should not be found in an unsecured context');
}
if (kIsUnsecured) {
assert_equals(
await countMatchingSimpleOriginCookies(),
0,
'No __Host-COOKIEN* cookies should be found in an unsecured context');
} else {
assert_equals(
await countMatchingSimpleOriginCookies(),
1,
'One __Host-COOKIEN* cookie should be found in a secure context');
}
}, 'One simple origin cookie');

View file

@ -1,46 +0,0 @@
cookie_test(async t => {
const theVeryRecentPast = Date.now();
const expiredCookieSentinelValue = 'EXPIRED';
await promise_rejects_when_unsecured(
t,
new TypeError(),
cookieStore.set('__Secure-COOKIENAME', expiredCookieSentinelValue, {
path: kPath,
expires: theVeryRecentPast,
secure: true,
domain: location.hostname
}),
'Secure cookies only writable from secure contexts');
}, 'Set an already-expired secure cookie');
['__Host-', '__Secure-'].forEach(prefix => {
cookie_test(async t => {
const name = prefix + 'COOKIENAME';
const value = 'cookie-value';
await promise_rejects_when_unsecured(
t,
new TypeError(),
cookieStore.set(name, value),
`Setting ${prefix} cookies should fail in non-secure contexts`);
// Getting does not produce an exception, even in non-secure contexts.
const pair = await cookieStore.get(name);
if (kIsUnsecured) {
assert_equals(pair, null);
} else {
assert_equals(pair.value, value);
}
await promise_rejects_when_unsecured(
t,
new TypeError(),
cookieStore.delete(name),
`Deleting ${prefix} cookies should fail in non-secure contexts`);
assert_equals(await cookieStore.get(name), null);
}, `${prefix} cookies only writable from secure context`);
});

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: __Secure- and __Host- cookies</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/secure_cookies.js"></script>

View file

@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Cookies: __Secure- and __Host- cookies (HTTPS)</title>
<meta name="help" href="https://github.com/WICG/cookie-store/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/cookie-test-helpers.js"></script>
<script src="resources/secure_cookies.js"></script>

View file

@ -4,7 +4,7 @@
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property">
<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html">
<p>Test passes if there is a filled green square.</p>
<div style="position:relative; z-index:-1; top:-50px; width:100px; background:green;">
<div style="border-top:1px solid white; position:relative; z-index:-1; top:-51px; width:100px; background:green;">
<div style="float:left; width:100px; height:50px; background:white;"></div>
<div style="clear:left; margin-top:25px;">
<div style="height:50px; margin-top:150px; background:white;"></div>

View file

@ -8,7 +8,7 @@
<script src="/css/css-align/resources/alignment-parsing-utils.js"></script>
<div id="log"></div>
<script>
let classes = Object.assign({"Normal":"normal"}, contentPositionClasses, distributionClasses);
let classes = Object.assign({"Normal":"normal"}, contentPositionClasses, distributionClasses, overflowClasses);
for (var key in classes) {
let value = classes[key];
test(function() {

View file

@ -8,10 +8,12 @@
<script src="/css/css-align/resources/alignment-parsing-utils.js"></script>
<div id="log"></div>
<script>
let classes = Object.assign({"Normal":"normal"}, contentPositionClasses, distributionClasses, baselineClasses);
let classes = Object.assign({"Normal":"normal"}, contentPositionClasses, distributionClasses, baselineClasses,
overflowClasses);
for (var key1 in classes) {
let alignValue = classes[key1];
let classes2 = Object.assign({"Normal":"normal", "Left":"left", "Right":"right"}, contentPositionClasses, distributionClasses);
let classes2 = Object.assign({"Normal":"normal", "Left":"left", "Right":"right"}, contentPositionClasses,
distributionClasses);
for (var key2 in classes2) {
let justifyValue = classes2[key2];
test(function() {

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