OLD | NEW |
1 importScripts('worker-testharness.js'); | 1 importScripts('worker-testharness.js'); |
2 importScripts('/resources/testharness-helpers.js'); | 2 importScripts('/resources/testharness-helpers.js'); |
3 | 3 |
4 cache_test(function(cache) { | 4 cache_test(function(cache) { |
5 return assert_promise_rejects( | 5 return assert_promise_rejects( |
6 cache.add(), | 6 cache.add(), |
7 new TypeError(), | 7 new TypeError(), |
8 'Cache.add should throw a TypeError when no arguments are given.'); | 8 'Cache.add should throw a TypeError when no arguments are given.'); |
9 }, 'Cache.add called with no arguments'); | 9 }, 'Cache.add called with no arguments'); |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 'Cache.addAll should throw TypeError for an undefined argument.'); | 95 'Cache.addAll should throw TypeError for an undefined argument.'); |
96 }, 'Cache.addAll with a mix of valid and undefined arguments'); | 96 }, 'Cache.addAll with a mix of valid and undefined arguments'); |
97 | 97 |
98 cache_test(function(cache) { | 98 cache_test(function(cache) { |
99 // Assumes the existence of simple.txt and blank.html in the same directory | 99 // Assumes the existence of simple.txt and blank.html in the same directory |
100 // as this test script. | 100 // as this test script. |
101 var urls = ['simple.txt', self.location.href, 'blank.html']; | 101 var urls = ['simple.txt', self.location.href, 'blank.html']; |
102 return cache.addAll(urls) | 102 return cache.addAll(urls) |
103 .then(function(result) { | 103 .then(function(result) { |
104 assert_equals(result, undefined, | 104 assert_equals(result, undefined, |
105 'Cache.addAll should resolve with undefined on success.'
); | 105 'Cache.addAll should resolve with undefined on ' + |
| 106 'success.'); |
106 }); | 107 }); |
107 }, 'Cache.addAll with string URL arguments'); | 108 }, 'Cache.addAll with string URL arguments'); |
108 | 109 |
109 cache_test(function(cache) { | 110 cache_test(function(cache) { |
110 // Assumes the existence of simple.txt and blank.html in the same directory | 111 // Assumes the existence of simple.txt and blank.html in the same directory |
111 // as this test script. | 112 // as this test script. |
112 var urls = ['simple.txt', self.location.href, 'blank.html']; | 113 var urls = ['simple.txt', self.location.href, 'blank.html']; |
113 var requests = urls.map(function(url) { | 114 var requests = urls.map(function(url) { |
114 return new Request(url); | 115 return new Request(url); |
115 }); | 116 }); |
(...skipping 21 matching lines...) Expand all Loading... |
137 }, 'Cache.addAll with a mix of succeeding and failing requests'); | 138 }, 'Cache.addAll with a mix of succeeding and failing requests'); |
138 | 139 |
139 cache_test(function(cache) { | 140 cache_test(function(cache) { |
140 var request = new Request('simple.txt'); | 141 var request = new Request('simple.txt'); |
141 return assert_promise_rejects( | 142 return assert_promise_rejects( |
142 cache.addAll([request, request]), | 143 cache.addAll([request, request]), |
143 new TypeError(), | 144 new TypeError(), |
144 'Cache.addAll should throw TypeError if the same request is added ' + | 145 'Cache.addAll should throw TypeError if the same request is added ' + |
145 'twice.'); | 146 'twice.'); |
146 }, 'Cache.addAll called with the same Request object specified twice'); | 147 }, 'Cache.addAll called with the same Request object specified twice'); |
OLD | NEW |