OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../inspector-test.js"></script> |
| 4 <script src="cache-storage-test.js"></script> |
| 5 <script> |
| 6 function test() |
| 7 { |
| 8 var cacheStorageModel = WebInspector.ServiceWorkerCacheModel.fromTarget(WebI
nspector.targetManager.mainTarget()); |
| 9 cacheStorageModel.enable(); |
| 10 var mainFrameId = InspectorTest.resourceTreeModel.mainFrame.id; |
| 11 |
| 12 InspectorTest.addSniffer(WebInspector.ServiceWorkerCacheModel.prototype, "_u
pdateCacheNames", main, false); |
| 13 |
| 14 function errorAndExit(error) |
| 15 { |
| 16 console.error(error); |
| 17 InspectorTest.completeTest(); |
| 18 } |
| 19 |
| 20 function before() |
| 21 { |
| 22 return caches.keys().then(function(keys) { |
| 23 return Promise.all(keys.map(function(key) { |
| 24 return caches.delete(key); |
| 25 })); |
| 26 }); |
| 27 } |
| 28 |
| 29 function main() |
| 30 { |
| 31 before() |
| 32 .then(InspectorTest.dumpCacheTree) |
| 33 .then(InspectorTest.createCache.bind(this, mainFrameId, "testCache1"
)) |
| 34 .then(InspectorTest.dumpCacheTree) |
| 35 .then(InspectorTest.createCache.bind(this, mainFrameId, "testCache2"
)) |
| 36 .then(InspectorTest.createCache.bind(this, mainFrameId, "testCache3"
)) |
| 37 .then(InspectorTest.createCache.bind(this, mainFrameId, "testCache4"
)) |
| 38 .then(InspectorTest.dumpCacheTree) |
| 39 .then(InspectorTest.completeTest) |
| 40 .catch(errorAndExit); |
| 41 } |
| 42 } |
| 43 </script> |
| 44 </head> |
| 45 <body onload="runTest()"> |
| 46 <p>Tests that cache names are correctly loaded and displayed in the inspector.</
p> |
| 47 </body> |
| 48 </html> |
OLD | NEW |