blob: 84d6734b1ee8ca63df5690c867314f276a8ac9b7 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Cache Storage: testing Cache persistency</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
promise_test(test => {
return self.caches.keys().then(keys => {
var pending = [];
for (key of keys)
pending.push(self.caches.delete(keys[0]));
return Promise.all(pending);
});
}, "Cleaning existing caches");
promise_test(async (test) => {
var cache = await self.caches.open("test-cache-records-persistency");
await cache.put("https://example.com/foo", new Response("body", { statusText: "status" }));
if (!window.testRunner)
return Promise.reject("test runner needed");
testRunner.clearDOMCaches();
var keys = await self.caches.keys();
assert_equals(keys.length, 0, "keys should be empty");
cache = await self.caches.open("test-cache-records-persistency");
keys = await cache.keys();
assert_equals(keys.length, 0, "records should be empty");
}, 'Clearing all disk cache');
</script>
</body>
</html>