Update web-platform-tests and CSS tests.

- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180.
- Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
This commit is contained in:
Ms2ger 2017-02-06 11:06:12 +01:00
parent fb4f421c8b
commit 296fa2512b
21852 changed files with 2080936 additions and 892894 deletions

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>PaymentRequest allowpaymentrequest attribute cross-origin browsing context containers</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
const expectSuccess = {'iframe': true, 'frame': false, 'object': false, 'embed': false};
const setAllowPaymentRequest = true;
const testCrossOrigin = true;
</script>
<script src=common.sub.js></script>

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>PaymentRequest allowpaymentrequest attribute same origin browsing context containers</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
const expectSuccess = {'iframe': true, 'frame': true, 'object': true, 'embed': true};
const setAllowPaymentRequest = true;
const testCrossOrigin = false;
</script>
<script src=common.sub.js></script>

View file

@ -0,0 +1,45 @@
// Test should set these:
// const expectSuccess = {'iframe': bool, 'frame': bool, 'object': bool, 'embed': bool};
// const setAllowPaymentRequest = bool;
// const testCrossOrigin = bool;
const tests = {};
window.onmessage = (e) => {
const result = e.data;
const tagName = result.urlQuery;
const t = tests[tagName];
t.step(() => {
if (expectSuccess[tagName]) {
assert_equals(result.message, 'Success');
} else {
assert_equals(result.message, 'Exception');
assert_array_equals(result.details, [true /*ex instanceof DOMException*/,
DOMException.SECURITY_ERR /*ex.code*/,
'SecurityError' /*ex.name*/]);
}
t.done();
});
};
['iframe', 'frame', 'object', 'embed'].forEach((tagName, i) => {
tests[tagName] = async_test((t) => {
const elm = document.createElement(tagName);
if (setAllowPaymentRequest) {
elm.setAttribute('allowpaymentrequest', '');
}
const path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
const url = (testCrossOrigin ? "https://{{domains[www1]}}:{{ports[https][0]}}" : "") +
path + "echo-PaymentRequest.html?" + tagName;
if (tagName === 'object') {
elm.data = url;
} else {
elm.src = url;
}
elm.onload = t.step_func(() => {
window[i].postMessage('What is the result of new PaymentRequest(...)?', '*');
});
elm.onerror = t.unreached_func('elm.onerror');
document.body.appendChild(elm);
}, tagName);
});

View file

@ -0,0 +1,23 @@
<!doctype html>
<script>
window.onmessage = (e) => {
const paymentArgs = [[{supportedMethods: ['foo']}], {total: {label: 'label', amount: {currency: 'USD', value: '5.00'}}}];
if (e.data === 'What is the result of new PaymentRequest(...)?') {
const result = {urlQuery: location.search.substring(1)}; // Used to distinguish subtests
try {
new PaymentRequest(...paymentArgs);
result.message = 'Success';
e.source.postMessage(result, '*');
} catch(ex) {
result.message = 'Exception';
result.details = [ex instanceof DOMException, ex.code, ex.name];
e.source.postMessage(result, '*');
}
} else {
result.message = 'Incorrect message';
e.source.postMessage(result, '*');
}
}
</script>
<p>This page echos the result of new PaymentRequest(...).</p>

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>PaymentRequest no attribute cross-origin browsing context containers</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
const expectSuccess = {'iframe': false, 'frame': false, 'object': false, 'embed': false};
const setAllowPaymentRequest = false;
const testCrossOrigin = true;
</script>
<script src=common.sub.js></script>

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>PaymentRequest no attribute same origin browsing context containers</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
const expectSuccess = {'iframe': true, 'frame': true, 'object': true, 'embed': true};
const setAllowPaymentRequest = false;
const testCrossOrigin = false;
</script>
<script src=common.sub.js></script>

View file

@ -0,0 +1,38 @@
<!doctype html>
<title>PaymentRequest removing allowpaymentrequest after load and then navigating</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id="log"></div>
<script>
async_test((t) => {
const iframe = document.createElement('iframe');
iframe.allowPaymentRequest = true;
let i = 0;
const path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
iframe.src = "https://{{domains[www1]}}:{{ports[https][0]}}" + path + "echo-PaymentRequest.html";
iframe.onload = t.step_func(() => {
if (i === 0) {
iframe.allowPaymentRequest = false;
}
iframe.contentWindow.postMessage('What is the result of new PaymentRequest(...)?', '*');
});
window.onmessage = t.step_func((e) => {
i++;
if (i === 1) {
assert_equals(e.data.message, 'Success', 'before navigation');
// Navigate the iframe. This will fire a second 'load' event on the iframe.
iframe.contentWindow.location.href = iframe.src + '?2';
} else {
assert_equals(e.data.message, 'Exception', 'after navigation');
assert_array_equals(e.data.details, [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'after navigation');
t.done();
}
});
document.body.appendChild(iframe);
});
</script>

View file

@ -0,0 +1,31 @@
<!doctype html>
<title>PaymentRequest setting allowpaymentrequest after document creation, before response</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id="log"></div>
<script>
// Set allowpaymentrequest attribute in a timeout after <iframe> has been inserted to the document.
// The iframe's response is delayed so it happens after the attribute is set.
async_test((t) => {
const iframe = document.createElement('iframe');
// no allowpaymentrequest attribute
const path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
iframe.src = "https://{{domains[www1]}}:{{ports[https][0]}}" + path + "echo-PaymentRequest.html?pipe=trickle(d3)";
iframe.onload = t.step_func(() => {
iframe.contentWindow.postMessage('What is the result of new PaymentRequest(...)?', '*');
});
window.onmessage = t.step_func_done((e) => {
assert_equals(e.data.message, 'Exception');
assert_array_equals(e.data.details, [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */]);
});
document.body.appendChild(iframe);
setTimeout(() => {
iframe.allowPaymentRequest = true;
}, 10);
});
</script>

View file

@ -0,0 +1,38 @@
<!doctype html>
<title>PaymentRequest setting allowpaymentrequest after load and then navigating</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id="log"></div>
<script>
async_test((t) => {
const iframe = document.createElement('iframe');
// no allowpaymentrequest attribute
let i = 0;
const path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
iframe.src = "https://{{domains[www1]}}:{{ports[https][0]}}" + path + "echo-PaymentRequest.html";
iframe.onload = t.step_func(() => {
if (i === 0) {
iframe.allowPaymentRequest = true;
}
iframe.contentWindow.postMessage('What is the result of new PaymentRequest(...)?', '*');
});
window.onmessage = t.step_func((e) => {
i++;
if (i === 1) {
assert_equals(e.data.message, 'Exception', 'before navigation');
assert_array_equals(e.data.details, [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'before navigation');
// Navigate the iframe. This will fire a second 'load' event on the iframe.
iframe.contentWindow.location.href = iframe.src + '?2';
} else {
assert_equals(e.data.message, 'Success', 'after navigation');
t.done();
}
});
document.body.appendChild(iframe);
});
</script>