mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Update web-platform-tests to revision 3137d1d2d7757366a69f8a449b458b5057e0e81e
This commit is contained in:
parent
81ca858678
commit
d6ba94ca28
2339 changed files with 89274 additions and 9328 deletions
|
@ -4,7 +4,6 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script>
|
||||
|
||||
function wait_for_message(worker) {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
function cache_test(test_function, description) {
|
||||
promise_test(function(test) {
|
||||
return create_temporary_cache(test)
|
||||
.then(test_function);
|
||||
.then(function(cache) { return test_function(cache, test); });
|
||||
}, description);
|
||||
}
|
||||
|
||||
|
@ -235,3 +235,11 @@ function assert_response_in_array(actual, expected_array, description) {
|
|||
}
|
||||
}), description);
|
||||
}
|
||||
|
||||
// Deletes all caches, returning a promise indicating success.
|
||||
function delete_all_caches() {
|
||||
return self.caches.keys()
|
||||
.then(function(keys) {
|
||||
return Promise.all(keys.map(self.caches.delete.bind(self.caches)));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* testharness-helpers contains various useful extensions to testharness.js to
|
||||
* allow them to be used across multiple tests before they have been
|
||||
* upstreamed. This file is intended to be usable from both document and worker
|
||||
* environments, so code should for example not rely on the DOM.
|
||||
*/
|
||||
|
||||
// Returns a promise that fulfills after the provided |promise| is fulfilled.
|
||||
// The |test| succeeds only if |promise| rejects with an exception matching
|
||||
// |code|. Accepted values for |code| follow those accepted for assert_throws().
|
||||
// The optional |description| describes the test being performed.
|
||||
//
|
||||
// E.g.:
|
||||
// assert_promise_rejects(
|
||||
// new Promise(...), // something that should throw an exception.
|
||||
// 'NotFoundError',
|
||||
// 'Should throw NotFoundError.');
|
||||
//
|
||||
// assert_promise_rejects(
|
||||
// new Promise(...),
|
||||
// new TypeError(),
|
||||
// 'Should throw TypeError');
|
||||
function assert_promise_rejects(promise, code, description) {
|
||||
return promise.then(
|
||||
function() {
|
||||
throw 'assert_promise_rejects: ' + description + ' Promise did not reject.';
|
||||
},
|
||||
function(e) {
|
||||
if (code !== undefined) {
|
||||
assert_throws(code, function() { throw e; }, description);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
if (self.importScripts) {
|
||||
importScripts('/resources/testharness.js');
|
||||
importScripts('../resources/testharness-helpers.js');
|
||||
importScripts('../resources/test-helpers.js');
|
||||
}
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache.add(),
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.add(),
|
||||
'Cache.add should throw a TypeError when no arguments are given.');
|
||||
}, 'Cache.add called with no arguments');
|
||||
|
||||
|
@ -29,10 +29,11 @@ cache_test(function(cache) {
|
|||
});
|
||||
}, 'Cache.add called with relative URL specified as a string');
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache.add('javascript://this-is-not-http-mmkay'),
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.add('javascript://this-is-not-http-mmkay'),
|
||||
'Cache.add should throw a TypeError for non-HTTP/HTTPS URLs.');
|
||||
}, 'Cache.add called with non-HTTP/HTTPS URL');
|
||||
|
||||
|
@ -45,12 +46,13 @@ cache_test(function(cache) {
|
|||
});
|
||||
}, 'Cache.add called with Request object');
|
||||
|
||||
cache_test(function(cache) {
|
||||
cache_test(function(cache, test) {
|
||||
var request = new Request('../resources/simple.txt',
|
||||
{method: 'POST', body: 'This is a body.'});
|
||||
return assert_promise_rejects(
|
||||
cache.add(request),
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.add(request),
|
||||
'Cache.add should throw a TypeError for non-GET requests.');
|
||||
}, 'Cache.add called with POST request');
|
||||
|
||||
|
@ -81,33 +83,37 @@ cache_test(function(cache) {
|
|||
});
|
||||
}, 'Cache.add with request with null body (not consumed)');
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache.add('this-does-not-exist-please-dont-create-it'),
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.add('this-does-not-exist-please-dont-create-it'),
|
||||
'Cache.add should reject if response is !ok');
|
||||
}, 'Cache.add with request that results in a status of 404');
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache.add('../resources/fetch-status.php?status=500'),
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.add('../resources/fetch-status.php?status=500'),
|
||||
'Cache.add should reject if response is !ok');
|
||||
}, 'Cache.add with request that results in a status of 500');
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache.addAll(),
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.addAll(),
|
||||
'Cache.addAll with no arguments should throw TypeError.');
|
||||
}, 'Cache.addAll with no arguments');
|
||||
|
||||
cache_test(function(cache) {
|
||||
cache_test(function(cache, test) {
|
||||
// Assumes the existence of ../resources/simple.txt and ../resources/blank.html
|
||||
var urls = ['../resources/simple.txt', undefined, '../resources/blank.html'];
|
||||
return assert_promise_rejects(
|
||||
cache.addAll(),
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.addAll(),
|
||||
'Cache.addAll should throw TypeError for an undefined argument.');
|
||||
}, 'Cache.addAll with a mix of valid and undefined arguments');
|
||||
|
||||
|
@ -202,7 +208,7 @@ cache_test(function(cache) {
|
|||
});
|
||||
}, 'Cache.addAll with Request arguments');
|
||||
|
||||
cache_test(function(cache) {
|
||||
cache_test(function(cache, test) {
|
||||
// Assumes that ../resources/simple.txt and ../resources/blank.html exist.
|
||||
// The second resource does not.
|
||||
var urls = ['../resources/simple.txt',
|
||||
|
@ -211,12 +217,15 @@ cache_test(function(cache) {
|
|||
var requests = urls.map(function(url) {
|
||||
return new Request(url);
|
||||
});
|
||||
return assert_promise_rejects(
|
||||
cache.addAll(requests),
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.addAll(requests),
|
||||
'Cache.addAll should reject with TypeError if any request fails')
|
||||
.then(function() {
|
||||
return Promise.all(urls.map(function(url) { return cache.match(url); }));
|
||||
return Promise.all(urls.map(function(url) {
|
||||
return cache.match(url);
|
||||
}));
|
||||
})
|
||||
.then(function(matches) {
|
||||
assert_array_equals(
|
||||
|
@ -226,11 +235,12 @@ cache_test(function(cache) {
|
|||
});
|
||||
}, 'Cache.addAll with a mix of succeeding and failing requests');
|
||||
|
||||
cache_test(function(cache) {
|
||||
cache_test(function(cache, test) {
|
||||
var request = new Request('../resources/simple.txt');
|
||||
return assert_promise_rejects(
|
||||
cache.addAll([request, request]),
|
||||
return promise_rejects(
|
||||
test,
|
||||
'InvalidStateError',
|
||||
cache.addAll([request, request]),
|
||||
'Cache.addAll should throw InvalidStateError if the same request is added ' +
|
||||
'twice.');
|
||||
}, 'Cache.addAll called with the same Request object specified twice');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
if (self.importScripts) {
|
||||
importScripts('/resources/testharness.js');
|
||||
importScripts('../resources/testharness-helpers.js');
|
||||
importScripts('../resources/test-helpers.js');
|
||||
}
|
||||
|
||||
|
@ -17,10 +16,11 @@ function new_test_response() {
|
|||
return new Response('Hello world!', { status: 200 });
|
||||
}
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache.delete(),
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.delete(),
|
||||
'Cache.delete should reject with a TypeError when called with no ' +
|
||||
'arguments.');
|
||||
}, 'Cache.delete with no arguments');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
if (self.importScripts) {
|
||||
importScripts('/resources/testharness.js');
|
||||
importScripts('../resources/testharness-helpers.js');
|
||||
importScripts('../resources/test-helpers.js');
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
if (self.importScripts) {
|
||||
importScripts('/resources/testharness.js');
|
||||
importScripts('../resources/testharness-helpers.js');
|
||||
importScripts('../resources/test-helpers.js');
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
if (self.importScripts) {
|
||||
importScripts('/resources/testharness.js');
|
||||
importScripts('../resources/testharness-helpers.js');
|
||||
importScripts('../resources/test-helpers.js');
|
||||
}
|
||||
|
||||
|
@ -190,18 +189,20 @@ cache_test(function(cache) {
|
|||
});
|
||||
}, 'Cache.put with a string request');
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache.put(new Request(test_url), 'Hello world!'),
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.put(new Request(test_url), 'Hello world!'),
|
||||
'Cache.put should only accept a Response object as the response.');
|
||||
}, 'Cache.put with an invalid response');
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.put(new Request('file:///etc/passwd'),
|
||||
new Response(test_body)),
|
||||
new TypeError(),
|
||||
'Cache.put should reject non-HTTP/HTTPS requests with a TypeError.');
|
||||
}, 'Cache.put with a non-HTTP/HTTPS request');
|
||||
|
||||
|
@ -218,26 +219,29 @@ cache_test(function(cache) {
|
|||
});
|
||||
}, 'Cache.put with a relative URL');
|
||||
|
||||
cache_test(function(cache) {
|
||||
cache_test(function(cache, test) {
|
||||
var request = new Request('http://example.com/foo', { method: 'HEAD' });
|
||||
return assert_promise_rejects(
|
||||
cache.put(request, new Response(test_body)),
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.put(request, new Response(test_body)),
|
||||
'Cache.put should throw a TypeError for non-GET requests.');
|
||||
}, 'Cache.put with a non-GET request');
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache.put(new Request(test_url), null),
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.put(new Request(test_url), null),
|
||||
'Cache.put should throw a TypeError for a null response.');
|
||||
}, 'Cache.put with a null response');
|
||||
|
||||
cache_test(function(cache) {
|
||||
cache_test(function(cache, test) {
|
||||
var request = new Request(test_url, {method: 'POST', body: test_body});
|
||||
return assert_promise_rejects(
|
||||
cache.put(request, new Response(test_body)),
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.put(request, new Response(test_body)),
|
||||
'Cache.put should throw a TypeError for a POST request.');
|
||||
}, 'Cache.put with a POST request');
|
||||
|
||||
|
@ -266,20 +270,22 @@ cache_test(function(cache) {
|
|||
});
|
||||
}, 'getReader() after Cache.put');
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.put(new Request(test_url),
|
||||
new Response(test_body, { headers: { VARY: '*' }})),
|
||||
new TypeError(),
|
||||
'Cache.put should reject VARY:* Responses with a TypeError.');
|
||||
}, 'Cache.put with a VARY:* Response');
|
||||
|
||||
cache_test(function(cache) {
|
||||
return assert_promise_rejects(
|
||||
cache_test(function(cache, test) {
|
||||
return promise_rejects(
|
||||
test,
|
||||
new TypeError(),
|
||||
cache.put(new Request(test_url),
|
||||
new Response(test_body,
|
||||
{ headers: { VARY: 'Accept-Language,*' }})),
|
||||
new TypeError(),
|
||||
'Cache.put should reject Responses with an embedded VARY:* with a ' +
|
||||
'TypeError.');
|
||||
}, 'Cache.put with an embedded VARY:* Response');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
if (self.importScripts) {
|
||||
importScripts('/resources/testharness.js');
|
||||
importScripts('../resources/testharness-helpers.js');
|
||||
importScripts('../resources/test-helpers.js');
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
if (self.importScripts) {
|
||||
importScripts('/resources/testharness.js');
|
||||
importScripts('../resources/testharness-helpers.js');
|
||||
importScripts('../resources/test-helpers.js');
|
||||
}
|
||||
|
||||
|
@ -61,7 +60,7 @@ promise_test(function(test) {
|
|||
return Promise.all(test_cache_list.map(function(key) {
|
||||
return self.caches.open(key);
|
||||
}))
|
||||
.then(function() { return caches.open('x'); })
|
||||
.then(function() { return self.caches.open('x'); })
|
||||
.then(function(cache) {
|
||||
return cache.put(transaction.request.clone(),
|
||||
transaction.response.clone());
|
||||
|
@ -100,7 +99,7 @@ promise_test(function(test) {
|
|||
.then(function(response) {
|
||||
assert_equals(response, undefined,
|
||||
'The response should not be found.');
|
||||
})
|
||||
});
|
||||
}, 'CacheStorageMatch with no cached entry');
|
||||
|
||||
promise_test(function(test) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
if (self.importScripts) {
|
||||
importScripts('/resources/testharness.js');
|
||||
importScripts('../resources/testharness-helpers.js');
|
||||
importScripts('../resources/test-helpers.js');
|
||||
}
|
||||
|
||||
|
@ -31,9 +30,10 @@ promise_test(function(t) {
|
|||
}, 'CacheStorage.open with an empty name');
|
||||
|
||||
promise_test(function(t) {
|
||||
return assert_promise_rejects(
|
||||
self.caches.open(),
|
||||
return promise_rejects(
|
||||
t,
|
||||
new TypeError(),
|
||||
self.caches.open(),
|
||||
'CacheStorage.open should throw TypeError if called with no arguments.');
|
||||
}, 'CacheStorage.open with no arguments');
|
||||
|
||||
|
@ -169,20 +169,28 @@ promise_test(function(t) {
|
|||
}, 'CacheStorage.delete with nonexistent cache');
|
||||
|
||||
promise_test(function(t) {
|
||||
var bad_name = 'unpaired\uD800';
|
||||
var converted_name = 'unpaired\uFFFD'; // Don't create cache with this name.
|
||||
return self.caches.has(converted_name)
|
||||
var unpaired_name = 'unpaired\uD800';
|
||||
var converted_name = 'unpaired\uFFFD';
|
||||
|
||||
// The test assumes that a cache with converted_name does not
|
||||
// exist, but if the implementation fails the test then such
|
||||
// a cache will be created. Start off in a fresh state by
|
||||
// deleting all caches.
|
||||
return delete_all_caches()
|
||||
.then(function() {
|
||||
return self.caches.has(converted_name);
|
||||
})
|
||||
.then(function(cache_exists) {
|
||||
assert_false(cache_exists,
|
||||
'Test setup failure: cache should not exist');
|
||||
})
|
||||
.then(function() { return self.caches.open(bad_name); })
|
||||
.then(function() { return self.caches.open(unpaired_name); })
|
||||
.then(function() { return self.caches.keys(); })
|
||||
.then(function(keys) {
|
||||
assert_true(keys.indexOf(bad_name) !== -1,
|
||||
assert_true(keys.indexOf(unpaired_name) !== -1,
|
||||
'keys should include cache with bad name');
|
||||
})
|
||||
.then(function() { return self.caches.has(bad_name); })
|
||||
.then(function() { return self.caches.has(unpaired_name); })
|
||||
.then(function(cache_exists) {
|
||||
assert_true(cache_exists,
|
||||
'CacheStorage names should be not be converted.');
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script src="../resources/test-helpers.js"></script>
|
||||
<script src="../script-tests/cache-add.js"></script>
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script src="../resources/test-helpers.js"></script>
|
||||
<script src="../script-tests/cache-delete.js"></script>
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script src="../resources/test-helpers.js"></script>
|
||||
<script src="../script-tests/cache-match.js"></script>
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script src="../resources/test-helpers.js"></script>
|
||||
<script src="../script-tests/cache-matchAll.js"></script>
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script src="../resources/test-helpers.js"></script>
|
||||
<script src="../script-tests/cache-put.js"></script>
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script src="../resources/test-helpers.js"></script>
|
||||
<script src="../script-tests/cache-storage-keys.js"></script>
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script src="../resources/test-helpers.js"></script>
|
||||
<script src="../script-tests/cache-storage-match.js"></script>
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script src="../resources/test-helpers.js"></script>
|
||||
<script src="../script-tests/cache-storage.js"></script>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testharness-helpers.js"></script>
|
||||
<script>
|
||||
|
||||
function load_iframe(src, sandbox) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue