Commit 10b09986 authored by Chromium WPT Sync's avatar Chromium WPT Sync Committed by Commit Bot

Import wpt@bd72596a728176e5c00b21c2ca3193bc45516cf8

Using wpt-import in Chromium 3ab2bcb8.

Note to sheriffs: This CL imports external tests and adds
expectations for those tests; if this CL is large and causes
a few new failures, please fix the failures by adding new
lines to TestExpectations rather than reverting. See:
https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_platform_tests.md

Directory owners for changes in this CL:
rouslan@chromium.org, mathp@chromium.org:
  external/wpt/payment-request

NOAUTOREVERT=true
TBR=robertma

No-Export: true
Change-Id: I765e541eef5251da1cfbc1898b2135086bb608fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2001159Reviewed-by: default avatarWPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: WPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#731802}
parent f09a7af5
This is a testharness.js-based test.
PASS Test preflight
PASS preflight for x-print should be cached
FAIL age = blank, should be cached assert_equals: did preflight expected "0" but got "1"
PASS age = 0, should not be cached
PASS age = -1, should not be cached
PASS preflight first request, second from cache, wait, third should preflight again
Harness: the test ran to completion.
...@@ -60,6 +60,15 @@ test(function() { ...@@ -60,6 +60,15 @@ test(function() {
}, },
'preflight for x-print should be cached') 'preflight for x-print should be cached')
test(function() {
var time = new Date().getTime()
var client = new XMLHttpRequest()
var id = did_preflight(true, client, {extra:'max_age='})
did_preflight(false, client, {extra:'max_age=', token: id})
},
'age = blank, should be cached')
test(function() { test(function() {
var time = new Date().getTime() var time = new Date().getTime()
var client = new XMLHttpRequest() var client = new XMLHttpRequest()
......
<!DOCTYPE HTML>
<html>
<head>
<title>location_reload_javascript_url</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<iframe></iframe>
<script>
async_test(function(t) {
const URL = "/common/blank.html";
const URL2 = "/common/blank.html#foo";
const JS_URL_TEXT = "javascript generated page";
const JS_URL = "javascript:'<html>" + JS_URL_TEXT + "</html>'";
var iframe = document.querySelector("iframe");
var count = 0;
iframe.onload = t.step_func(function() {
// The URL should initially be "blank.html", and then "blank.html#foo";
// The textContent of the iframe's document should initially be blank,
// then become js generated text, and then be blank again after reload.
switch (count) {
case 0:
assert_equals(iframe.contentWindow.document.URL,
location.href.replace(location.pathname, URL),
"iframe url (" + count + ")");
assert_equals(iframe.contentDocument.body.textContent, "",
"text of blank page");
iframe.contentWindow.location = JS_URL;
iframe.contentWindow.location = URL2;
break;
case 1:
assert_equals(iframe.contentWindow.document.URL,
location.href.replace(location.pathname, URL2),
"iframe url (" + count + ")");
assert_equals(iframe.contentDocument.body.textContent,
JS_URL_TEXT, "text of js generated page");
iframe.contentWindow.location.reload();
break;
case 2:
assert_equals(iframe.contentWindow.document.URL,
location.href.replace(location.pathname, URL2),
"iframe url (" + count + ")");
assert_equals(iframe.contentDocument.body.textContent, "",
"text of blank page");
t.done();
break;
}
count++;
});
iframe.src = URL;
});
</script>
</body>
</html>
...@@ -27,6 +27,9 @@ async_test((t) => { ...@@ -27,6 +27,9 @@ async_test((t) => {
}); });
window.onmessage = t.step_func((e) => { window.onmessage = t.step_func((e) => {
// Ignore messages that are not part of the test.
if (e.source != iframe.contentWindow) return;
i++; i++;
if (i === 1) { if (i === 1) {
// 5. This is the first message we receive, from the first load. // 5. This is the first message we receive, from the first load.
......
...@@ -22,11 +22,15 @@ async_test((t) => { ...@@ -22,11 +22,15 @@ async_test((t) => {
iframe.contentWindow.postMessage('What is the result of new PaymentRequest(...)?', '*'); iframe.contentWindow.postMessage('What is the result of new PaymentRequest(...)?', '*');
}); });
window.onmessage = t.step_func_done((e) => { window.onmessage = t.step_func((e) => {
// Ignore messages that are not part of the test.
if (e.source != iframe.contentWindow) return;
assert_equals(e.data.message, 'Exception'); assert_equals(e.data.message, 'Exception');
assert_equals(4, e.data.details.length); assert_equals(4, e.data.details.length);
// The last entry is the error stacktrace. Ignore it in comparison. // The last entry is the error stacktrace. Ignore it in comparison.
assert_array_equals(e.data.details.slice(0, 3), [true /* ex instanceof DOMException */, DOMException.SECURITY_ERR, 'SecurityError']); assert_array_equals(e.data.details.slice(0, 3), [true /* ex instanceof DOMException */, DOMException.SECURITY_ERR, 'SecurityError']);
t.done();
}); });
document.body.appendChild(iframe); document.body.appendChild(iframe);
......
...@@ -20,6 +20,9 @@ async_test((t) => { ...@@ -20,6 +20,9 @@ async_test((t) => {
}); });
window.onmessage = t.step_func((e) => { window.onmessage = t.step_func((e) => {
// Ignore messages that are not part of the test.
if (e.source != iframe.contentWindow) return;
i++; i++;
if (i === 1) { if (i === 1) {
assert_equals(e.data.message, 'Exception', 'before navigation'); assert_equals(e.data.message, 'Exception', 'before navigation');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment