<!DOCTYPE html>
<html>
<body>
    <script>
var cache;
async function doTest()
{
    if (window.location.hash === "#check") {
        let keys = await self.caches.keys();
        window.parent.postMessage(keys.length === 1 && keys[0] === "testCacheName", "*");
        return;
    }

    if (window.location.hash === "#remove") {
        let cache = await self.caches.open("testCacheName");
        await self.caches.delete("testCacheName");
        window.parent.postMessage("removed", "*");
        return;
    }

    var cacheName = "testCacheName";
    if (window.location.hash.indexOf("#name=") === 0)
        cacheName = window.location.hash.substring(6);
    let cache = await self.caches.open(cacheName);
    await cache.put(new Request('testurl'), new Response('test body'));
    window.parent.postMessage("ready", "*");
}
doTest();
    </script>
</body>
</html>

