mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision 000905d008db2538360020335bc2dbba16d322b5.
This commit is contained in:
parent
53d2432c90
commit
2d49203b9c
100 changed files with 3807 additions and 201 deletions
|
@ -2,14 +2,14 @@ if (this.document === undefined)
|
|||
importScripts("xmlhttprequest-timeout.js");
|
||||
/*
|
||||
This sets up three requests:
|
||||
The first request will only be open()ed, not aborted, timeout will be 400 but will never triggered because send() isn't called.
|
||||
After a 1 second delay, the test asserts that no load/error/timeout/abort events fired
|
||||
The first request will only be open()ed, not aborted, timeout will be TIME_REGULAR_TIMEOUT but will never triggered because send() isn't called.
|
||||
After TIME_NORMAL_LOAD, the test asserts that no load/error/timeout/abort events fired
|
||||
|
||||
Second request will be aborted immediately after send(), test asserts that abort fired
|
||||
|
||||
Third request is set up to call abort() after a 1 second delay, but it also has a 400ms timeout. Asserts that timeout fired.
|
||||
(abort() is called 600ms later and should not fire an abort event per spec. This is untested!)
|
||||
Third request is set up to call abort() after TIME_NORMAL_LOAD, but it also has a TIME_REGULAR_TIMEOUT timeout. Asserts that timeout fired.
|
||||
(abort() is called later and should not fire an abort event per spec. This is untested!)
|
||||
*/
|
||||
runTestRequests([ new AbortedRequest(false),
|
||||
new AbortedRequest(true, -1),
|
||||
new AbortedRequest(true, TIME_NORMAL_LOAD) ]);
|
||||
new AbortedRequest(true, -1),
|
||||
new AbortedRequest(true, TIME_NORMAL_LOAD) ]);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
This test sets up two requests:
|
||||
This test sets up two requests:
|
||||
one that gets abort()ed from a 0ms timeout (0ms will obviously be clamped to whatever the implementation's minimal value is), asserts abort event fires
|
||||
one that will be aborted after 200ms (TIME_DELAY), (with a timeout at 400ms) asserts abort event fires. Does not assert that the timeout event does *not* fire.
|
||||
one that will be aborted after TIME_DELAY, (with a timeout at TIME_REGULAR_TIMEOUT) asserts abort event fires. Does not assert that the timeout event does *not* fire.
|
||||
*/
|
||||
|
||||
runTestRequests([ new AbortedRequest(true, 0),
|
||||
new AbortedRequest(true, TIME_DELAY) ]);
|
||||
new AbortedRequest(true, TIME_DELAY) ]);
|
||||
|
|
|
@ -2,10 +2,10 @@ if (this.document === undefined)
|
|||
importScripts("xmlhttprequest-timeout.js");
|
||||
/*
|
||||
Sets up three requests to a resource that will take 0.6 seconds to load:
|
||||
1) timeout first set to 1000ms, after 400ms timeout is set to 0, asserts load fires
|
||||
2) timeout first set to 1000ms, after 200ms timeout is set to 400, asserts load fires (race condition..?!?)
|
||||
3) timeout first set to 0, after 400ms it is set to 1000, asserts load fires
|
||||
1) timeout first set to TIME_NORMAL_LOAD, after TIME_REGULAR_TIMEOUT timeout is set to 0, asserts load fires
|
||||
2) timeout first set to TIME_NORMAL_LOAD, after TIME_DELAY timeout is set to TIME_REGULAR_TIMEOUT, asserts load fires (race condition..?!?)
|
||||
3) timeout first set to 0, after TIME_REGULAR_TIMEOUT it is set to TIME_REGULAR_TIMEOUT * 10, asserts load fires
|
||||
*/
|
||||
runTestRequests([ new RequestTracker(true, "timeout disabled after initially set", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, 0),
|
||||
new RequestTracker(true, "timeout overrides load after a delay", TIME_NORMAL_LOAD, TIME_DELAY, TIME_REGULAR_TIMEOUT),
|
||||
new RequestTracker(true, "timeout enabled after initially disabled", 0, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD * 10) ]);
|
||||
new RequestTracker(true, "timeout overrides load after a delay", TIME_NORMAL_LOAD, TIME_DELAY, TIME_REGULAR_TIMEOUT),
|
||||
new RequestTracker(true, "timeout enabled after initially disabled", 0, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD * 10) ]);
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
if (this.document === undefined)
|
||||
importScripts("xmlhttprequest-timeout.js");
|
||||
/*
|
||||
Starts three requests:
|
||||
1) XHR to resource which will take a least 600ms with timeout initially set to 1000ms. After 800ms timeout is supposedly reset to 200ms,
|
||||
but the resource should have finished loading already. Asserts "load" fires.
|
||||
2) XHR with initial timeout set to 1000, after 400ms sets timeout to 300ms. Asserts "timeout" fires.
|
||||
(Originally new value was 200ms. Race condition-y. Setting the new timeout to 300ms would be a better test of the "measured from start of fetching" requirement.)
|
||||
3) XHR with initial timeout set to 200, after 400ms sets timeout to 500ms. Asserts "timeout" fires (the change happens when timeout already fired and the request is done).
|
||||
Starts three requests:
|
||||
1) XHR to resource which will take a least TIME_XHR_LOAD ms with timeout initially set to TIME_NORMAL_LOAD ms. After TIME_LATE_TIMEOUT ms timeout is supposedly reset to TIME_DELAY ms,
|
||||
but the resource should have finished loading already. Asserts "load" fires.
|
||||
2) XHR with initial timeout set to TIME_NORMAL_LOAD, after TIME_REGULAR_TIMEOUT sets timeout to TIME_DELAY+100. Asserts "timeout" fires.
|
||||
3) XHR with initial timeout set to TIME_DELAY, after TIME_REGULAR_TIMEOUT sets timeout to 500ms. Asserts "timeout" fires (the change happens when timeout already fired and the request is done).
|
||||
*/
|
||||
runTestRequests([ new RequestTracker(true, "timeout set to expiring value after load fires", TIME_NORMAL_LOAD, TIME_LATE_TIMEOUT, TIME_DELAY),
|
||||
new RequestTracker(true, "timeout set to expired value before load fires", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_DELAY+100),
|
||||
new RequestTracker(true, "timeout set to non-expiring value after timeout fires", TIME_DELAY, TIME_REGULAR_TIMEOUT, 500) ]);
|
||||
new RequestTracker(true, "timeout set to expired value before load fires", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_DELAY+100),
|
||||
new RequestTracker(true, "timeout set to non-expiring value after timeout fires", TIME_DELAY, TIME_REGULAR_TIMEOUT, 500) ]);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
function testResultCallbackHandler(event) {
|
||||
if (event.data == "done") {
|
||||
done();
|
||||
|
@ -16,5 +17,5 @@ function testResultCallbackHandler(event) {
|
|||
window.addEventListener("message", testResultCallbackHandler);
|
||||
|
||||
// Setting up testharness.js
|
||||
setup({ explicit_done: true, timeout: 30 * 1000 });
|
||||
setup({ explicit_done: true });
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
request handlers.
|
||||
*/
|
||||
|
||||
var TIME_NORMAL_LOAD = 1000;
|
||||
var TIME_LATE_TIMEOUT = 800;
|
||||
var TIME_XHR_LOAD = 600;
|
||||
var TIME_REGULAR_TIMEOUT = 400;
|
||||
var TIME_SYNC_TIMEOUT = 200;
|
||||
var TIME_DELAY = 200;
|
||||
var TIME_NORMAL_LOAD = 5000;
|
||||
var TIME_LATE_TIMEOUT = 4000;
|
||||
var TIME_XHR_LOAD = 3000;
|
||||
var TIME_REGULAR_TIMEOUT = 2000;
|
||||
var TIME_SYNC_TIMEOUT = 1000;
|
||||
var TIME_DELAY = 1000;
|
||||
|
||||
/*
|
||||
* This should point to a resource that responds with a text/plain resource after a delay of TIME_XHR_LOAD milliseconds.
|
||||
|
|
10
tests/wpt/web-platform-tests/XMLHttpRequest/send-usp.html
Normal file
10
tests/wpt/web-platform-tests/XMLHttpRequest/send-usp.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>XMLHttpRequest.send(URLSearchParams)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="send-usp.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
run_test();
|
||||
</script>
|
39
tests/wpt/web-platform-tests/XMLHttpRequest/send-usp.js
Normal file
39
tests/wpt/web-platform-tests/XMLHttpRequest/send-usp.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
function encode(n) {
|
||||
if (n === 0x20) {
|
||||
return "\x2B";
|
||||
}
|
||||
|
||||
if (n === 0x2A || n === 0x2D || n === 0x2E ||
|
||||
(0x30 <= n && n <= 0x39) || (0x41 <= n && n <= 0x5A) ||
|
||||
n === 0x5F || (0x61 <= n && n <= 0x7A)) {
|
||||
return String.fromCharCode(n);
|
||||
}
|
||||
|
||||
var s = n.toString(16).toUpperCase();
|
||||
return "%" + (s.length === 2 ? s : '0' + s);
|
||||
}
|
||||
|
||||
function do_test(n) {
|
||||
async_test(function() {
|
||||
var x = new XMLHttpRequest();
|
||||
x.onload = this.step_func_done(function(e) {
|
||||
assert_equals(x.response, "a=" + encode(n))
|
||||
});
|
||||
x.onerror = this.unreached_func();
|
||||
x.open("POST", "resources/content.py");
|
||||
var usp = new URLSearchParams();
|
||||
usp.append("a", String.fromCharCode(n));
|
||||
x.send(usp)
|
||||
}, "XMLHttpRequest.send(URLSearchParams) (" + n + ")");
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
var i = 0;
|
||||
add_result_callback(function() {
|
||||
if (++i === 128) {
|
||||
return;
|
||||
}
|
||||
do_test(i);
|
||||
});
|
||||
do_test(i);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
importScripts("/resources/testharnessreport.js");
|
||||
importScripts("send-usp.js");
|
||||
run_test();
|
||||
done();
|
|
@ -12,6 +12,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol/li[9]"/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout.js"></script>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-abort" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol/li[9]"/>
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout.js"></script>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#timeout-error" data-tested-assertations=".."/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout.js"></script>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout.js"></script>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout.js"></script>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-timeout-attribute" data-tested-assertations="following::ol[1]/li[1]" />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[10]" />
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout.js"></script>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#timeout-error" data-tested-assertations=".."/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout.js"></script>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol/li[9]"/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout-runner.js"></script>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#timeout-error" data-tested-assertations=".."/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout-runner.js"></script>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout-runner.js"></script>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout-runner.js"></script>
|
||||
|
@ -19,7 +20,7 @@
|
|||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
var worker = new Worker("resources/xmlhttprequest-timeout-simple.js");
|
||||
worker.onmessage = testResultCallbackHandler;
|
||||
worker.onmessage = testResultCallbackHandler;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout-runner.js"></script>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[9]"/>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/.. following-sibling::dl//code[contains(@title,'dom-XMLHttpRequest-timeout')]/../following-sibling::dd following::dt[1] following::dd[1]" />
|
||||
<link rel="stylesheet" href="/resources/testharness.css" />
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/xmlhttprequest-timeout-runner.js"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue