Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * worker-test-harness should be considered a temporary polyfill around | 2 * worker-test-harness should be considered a temporary polyfill around |
| 3 * testharness.js for supporting Service Worker based tests. It should not be | 3 * testharness.js for supporting Service Worker based tests. It should not be |
| 4 * necessary once the test harness is able to drive worker based tests natively. | 4 * necessary once the test harness is able to drive worker based tests natively. |
| 5 * See https://github.com/w3c/testharness.js/pull/82 for status of effort to | 5 * See https://github.com/w3c/testharness.js/pull/82 for status of effort to |
| 6 * update upstream testharness.js. Once the upstreaming is complete, tests that | 6 * update upstream testharness.js. Once the upstreaming is complete, tests that |
| 7 * reference worker-test-harness should be updated to directly import | 7 * reference worker-test-harness should be updated to directly import |
| 8 * testharness.js. | 8 * testharness.js. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 var message = { | 65 var message = { |
| 66 type: 'complete', | 66 type: 'complete', |
| 67 tests: results.tests, | 67 tests: results.tests, |
| 68 status: results.status | 68 status: results.status |
| 69 }; | 69 }; |
| 70 port.postMessage(message); | 70 port.postMessage(message); |
| 71 }); | 71 }); |
| 72 } | 72 } |
| 73 }); | 73 }); |
| 74 })(); | 74 })(); |
| 75 | |
| 76 (function() { | |
| 77 var next_cache_index = 1; | |
| 78 | |
| 79 // Returns a promise that resolves to a newly created Cache object. The | |
| 80 // returned Cache will be destroyed when |test| completes. | |
| 81 function create_temporary_cache(test, base_name) { | |
|
jsbell
2014/10/20 18:20:41
Is it worth having the `base_name` param now, sinc
asanka
2014/10/22 22:35:32
Removed.
| |
| 82 var uniquifier = base_name || String(++next_cache_index); | |
| 83 var cache_name = self.location.pathname + '/' + uniquifier; | |
| 84 | |
| 85 test.add_cleanup(function() { | |
| 86 self.caches.delete(cache_name); | |
| 87 }); | |
| 88 | |
| 89 return self.caches.delete(cache_name) | |
| 90 .then(function() { | |
| 91 return self.caches.open(cache_name); | |
| 92 }); | |
| 93 } | |
| 94 | |
| 95 self.create_temporary_cache = create_temporary_cache; | |
| 96 })(); | |
| OLD | NEW |