| Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-put.js b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js
|
| similarity index 89%
|
| copy from third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-put.js
|
| copy to third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js
|
| index 1517f945a088da7ef2f045bb97e8a8171d8f4a75..8dbaf9789d5a8b881c9395d7d6e3685f381145c5 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-put.js
|
| +++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js
|
| @@ -1,5 +1,6 @@
|
| if (self.importScripts) {
|
| importScripts('/resources/testharness.js');
|
| + importScripts('../resources/testharness-helpers.js');
|
| importScripts('../resources/test-helpers.js');
|
| }
|
|
|
| @@ -103,7 +104,7 @@ cache_test(function(cache) {
|
| }, 'Cache.put with an empty response body');
|
|
|
| cache_test(function(cache) {
|
| - var test_url = new URL('../resources/fetch-status.php?status=500', location.href).href;
|
| + var test_url = new URL('../resources/fetch-status.py?status=500', location.href).href;
|
| var request = new Request(test_url);
|
| var response;
|
| return fetch(test_url)
|
| @@ -128,19 +129,6 @@ cache_test(function(cache) {
|
| });
|
| }, 'Cache.put with HTTP 500 response');
|
|
|
| -cache_test(function(cache, test) {
|
| - var test_url = new URL('../resources/fetch-status.php?status=206', location.href).href;
|
| - var request = new Request(test_url);
|
| - var response;
|
| - return fetch(test_url)
|
| - .then(function(fetch_result) {
|
| - assert_equals(fetch_result.status, 206,
|
| - 'Test framework error: The status code should be 206.');
|
| - response = fetch_result.clone();
|
| - return promise_rejects(test, new TypeError, cache.put(request, fetch_result));
|
| - });
|
| - }, 'Cache.put with HTTP 206 response');
|
| -
|
| cache_test(function(cache) {
|
| var alternate_response_body = 'New body';
|
| var alternate_response = new Response(alternate_response_body,
|
| @@ -202,20 +190,18 @@ cache_test(function(cache) {
|
| });
|
| }, 'Cache.put with a string request');
|
|
|
| -cache_test(function(cache, test) {
|
| - return promise_rejects(
|
| - test,
|
| - new TypeError(),
|
| +cache_test(function(cache) {
|
| + return assert_promise_rejects(
|
| cache.put(new Request(test_url), 'Hello world!'),
|
| + new TypeError(),
|
| 'Cache.put should only accept a Response object as the response.');
|
| }, 'Cache.put with an invalid response');
|
|
|
| -cache_test(function(cache, test) {
|
| - return promise_rejects(
|
| - test,
|
| - new TypeError(),
|
| +cache_test(function(cache) {
|
| + return assert_promise_rejects(
|
| 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');
|
|
|
| @@ -232,29 +218,26 @@ cache_test(function(cache) {
|
| });
|
| }, 'Cache.put with a relative URL');
|
|
|
| -cache_test(function(cache, test) {
|
| +cache_test(function(cache) {
|
| var request = new Request('http://example.com/foo', { method: 'HEAD' });
|
| - return promise_rejects(
|
| - test,
|
| - new TypeError(),
|
| + return assert_promise_rejects(
|
| cache.put(request, new Response(test_body)),
|
| + new TypeError(),
|
| 'Cache.put should throw a TypeError for non-GET requests.');
|
| }, 'Cache.put with a non-GET request');
|
|
|
| -cache_test(function(cache, test) {
|
| - return promise_rejects(
|
| - test,
|
| - new TypeError(),
|
| +cache_test(function(cache) {
|
| + return assert_promise_rejects(
|
| cache.put(new Request(test_url), null),
|
| + new TypeError(),
|
| 'Cache.put should throw a TypeError for a null response.');
|
| }, 'Cache.put with a null response');
|
|
|
| -cache_test(function(cache, test) {
|
| +cache_test(function(cache) {
|
| var request = new Request(test_url, {method: 'POST', body: test_body});
|
| - return promise_rejects(
|
| - test,
|
| - new TypeError(),
|
| + return assert_promise_rejects(
|
| cache.put(request, new Response(test_body)),
|
| + new TypeError(),
|
| 'Cache.put should throw a TypeError for a POST request.');
|
| }, 'Cache.put with a POST request');
|
|
|
| @@ -283,22 +266,20 @@ cache_test(function(cache) {
|
| });
|
| }, 'getReader() after Cache.put');
|
|
|
| -cache_test(function(cache, test) {
|
| - return promise_rejects(
|
| - test,
|
| - new TypeError(),
|
| +cache_test(function(cache) {
|
| + return assert_promise_rejects(
|
| 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, test) {
|
| - return promise_rejects(
|
| - test,
|
| - new TypeError(),
|
| +cache_test(function(cache) {
|
| + return assert_promise_rejects(
|
| 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');
|
|
|