Files
tubestation/dom/cache/test/xpcshell/test_migration.js
Phil Ringnalda 20263ea42c Back out 3 changesets (bug 1204596) for b2g test_fetch_cors.html failures
Backed out changeset 2662a1ad4cad (bug 1204596)
Backed out changeset cfc4c4ecbbf5 (bug 1204596)
Backed out changeset d10c6f32ce46 (bug 1204596)
2015-09-16 20:51:17 -07:00

39 lines
1.3 KiB
JavaScript

/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*
* All images in schema_15_profile.zip are from https://github.com/mdn/sw-test/
* and are CC licensed by https://www.flickr.com/photos/legofenris/.
*/
function run_test() {
do_test_pending();
create_test_profile('schema_15_profile.zip');
var cache;
caches.open('xpcshell-test').then(function(c) {
cache = c;
ok(cache, 'cache exists');
return cache.keys();
}).then(function(requestList) {
ok(requestList.length > 0, 'should have at least one request in cache');
requestList.forEach(function(request) {
ok(request, 'each request in list should be non-null');
ok(request.redirect === 'follow', 'request.redirect should default to "follow"');
});
return Promise.all(requestList.map(function(request) {
return cache.match(request);
}));
}).then(function(responseList) {
ok(responseList.length > 0, 'should have at least one response in cache');
responseList.forEach(function(response) {
ok(response, 'each request in list should be non-null');
});
}).then(function() {
do_test_finished();
}).catch(function(e) {
ok(false, 'caught exception ' + e);
do_test_finished();
});
}