| OLD | NEW |
| 1 if (self.importScripts) { | 1 if (self.importScripts) { |
| 2 importScripts('/resources/testharness.js'); | 2 importScripts('/resources/testharness.js'); |
| 3 importScripts('/resources/testharness-helpers.js'); | 3 importScripts('/resources/testharness-helpers.js'); |
| 4 importScripts('../resources/test-helpers.js'); | 4 importScripts('../resources/test-helpers.js'); |
| 5 } | 5 } |
| 6 | 6 |
| 7 cache_test(function(cache) { | 7 cache_test(function(cache) { |
| 8 return assert_promise_rejects( | 8 return assert_promise_rejects( |
| 9 cache.add(), | 9 cache.add(), |
| 10 new TypeError(), | 10 new TypeError(), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 .then(function(result) { | 32 .then(function(result) { |
| 33 assert_equals(result, undefined, | 33 assert_equals(result, undefined, |
| 34 'Cache.add should resolve with undefined on success.'); | 34 'Cache.add should resolve with undefined on success.'); |
| 35 }); | 35 }); |
| 36 }, 'Cache.add called with Request object'); | 36 }, 'Cache.add called with Request object'); |
| 37 | 37 |
| 38 cache_test(function(cache) { | 38 cache_test(function(cache) { |
| 39 var request = new Request('../resources/simple.txt', {method: 'POST', body:
'Hello'}); | 39 var request = new Request('../resources/simple.txt', {method: 'POST', body:
'Hello'}); |
| 40 return request.text() | 40 return request.text() |
| 41 .then(function() { | 41 .then(function() { |
| 42 assert_true(request.bodyUsed); | 42 assert_false(request.bodyUsed); |
| 43 }) | 43 }) |
| 44 .then(function() { | 44 .then(function() { |
| 45 return assert_promise_rejects( | 45 return cache.add(request); |
| 46 cache.add(request), | |
| 47 new TypeError(), | |
| 48 'Cache.add with a Request object with a used body should reject ' + | |
| 49 'with a TypeError.'); | |
| 50 }); | 46 }); |
| 51 }, 'Cache.add called with Request object with a used body'); | 47 }, 'Cache.add called with Request object with a used body'); |
| 52 | 48 |
| 53 cache_test(function(cache) { | 49 cache_test(function(cache) { |
| 54 var request = new Request('../resources/simple.txt', {method: 'POST', body:
'Hello'}); | 50 var request = new Request('../resources/simple.txt', {method: 'POST', body:
'Hello'}); |
| 55 return cache.add(request) | 51 return cache.add(request) |
| 56 .then(function(result) { | 52 .then(function(result) { |
| 57 assert_equals(result, undefined, | 53 assert_equals(result, undefined, |
| 58 'Cache.add should resolve with undefined on success.'); | 54 'Cache.add should resolve with undefined on success.'); |
| 59 }) | 55 }) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 cache_test(function(cache) { | 136 cache_test(function(cache) { |
| 141 var request = new Request('../resources/simple.txt'); | 137 var request = new Request('../resources/simple.txt'); |
| 142 return assert_promise_rejects( | 138 return assert_promise_rejects( |
| 143 cache.addAll([request, request]), | 139 cache.addAll([request, request]), |
| 144 new TypeError(), | 140 new TypeError(), |
| 145 'Cache.addAll should throw TypeError if the same request is added ' + | 141 'Cache.addAll should throw TypeError if the same request is added ' + |
| 146 'twice.'); | 142 'twice.'); |
| 147 }, 'Cache.addAll called with the same Request object specified twice'); | 143 }, 'Cache.addAll called with the same Request object specified twice'); |
| 148 | 144 |
| 149 done(); | 145 done(); |
| OLD | NEW |