Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: LayoutTests/http/tests/cachestorage/resources/test-helpers.js

Issue 1032623008: Expose Cache Storage API in global window/worker scope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update webexposed expectations Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /*
2 * worker-test-harness should be considered a temporary polyfill around
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.
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
7 * reference worker-test-harness should be updated to directly import
8 * testharness.js.
9 */
10
11 importScripts('/resources/testharness.js');
12
13 (function() { 1 (function() {
14 var next_cache_index = 1; 2 var next_cache_index = 1;
15 3
16 // Returns a promise that resolves to a newly created Cache object. The 4 // Returns a promise that resolves to a newly created Cache object. The
17 // returned Cache will be destroyed when |test| completes. 5 // returned Cache will be destroyed when |test| completes.
18 function create_temporary_cache(test) { 6 function create_temporary_cache(test) {
19 var uniquifier = String(++next_cache_index); 7 var uniquifier = String(++next_cache_index);
20 var cache_name = self.location.pathname + '/' + uniquifier; 8 var cache_name = self.location.pathname + '/' + uniquifier;
21 9
22 test.add_cleanup(function() { 10 test.add_cleanup(function() {
(...skipping 17 matching lines...) Expand all
40 // E.g.: 28 // E.g.:
41 // cache_test(function(cache) { 29 // cache_test(function(cache) {
42 // // Do something with |cache|, which is a Cache object. 30 // // Do something with |cache|, which is a Cache object.
43 // }, "Some Cache test"); 31 // }, "Some Cache test");
44 function cache_test(test_function, description) { 32 function cache_test(test_function, description) {
45 promise_test(function(test) { 33 promise_test(function(test) {
46 return create_temporary_cache(test) 34 return create_temporary_cache(test)
47 .then(test_function); 35 .then(test_function);
48 }, description); 36 }, description);
49 } 37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698