Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js |
| index e9bbb025cebbc5182ad40e5ebb7e28182cb18fee..4f51be18573bc0c2fc06e7b590534baa7c6d365b 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js |
| +++ b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js |
| @@ -4,10 +4,11 @@ if (self.importScripts) { |
| importScripts('../resources/test-helpers.js'); |
| } |
| -cache_test(function(cache) { |
| - return assert_promise_rejects( |
| - cache.add(), |
| +cache_test(function(cache, test) { |
| + return promise_rejects( |
|
jsbell
2016/04/29 17:39:07
I don't suppose you want to make the same changes
|
| + test, |
| new TypeError(), |
| + cache.add(), |
| 'Cache.add should throw a TypeError when no arguments are given.'); |
| }, 'Cache.add called with no arguments'); |
| @@ -29,10 +30,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 +47,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 +84,37 @@ cache_test(function(cache) { |
| }); |
| }, 'Cache.add called with Request object with a used body'); |
| -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 +209,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,9 +218,10 @@ 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) { |
| @@ -228,11 +236,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'); |