Chromium Code Reviews| 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 var origin = document.origin; | |
| 12 InspectorTest.addSniffer(WebInspector.ServiceWorkerCacheModel.prototype, "_u pdateCacheNames", main, false); | |
|
pfeldman
2015/04/10 12:35:33
Since used more than once, it could be a part of c
dmurph
2015/04/13 18:23:03
Done.
| |
| 13 | |
| 14 function errorAndExit(error) | |
| 15 { | |
| 16 if (error) | |
| 17 console.error(error); | |
| 18 InspectorTest.completeTest(); | |
| 19 } | |
| 20 | |
| 21 function before() | |
| 22 { | |
| 23 return caches.keys().then(function(keys) { | |
|
pfeldman
2015/04/10 12:35:33
Since used more than once, it could be a part of c
dmurph
2015/04/13 18:23:03
Done.
| |
| 24 return Promise.all(keys.map(function(key) { | |
| 25 return caches.delete(key); | |
| 26 })); | |
| 27 }); | |
| 28 } | |
| 29 | |
| 30 function main() | |
| 31 { | |
| 32 before() | |
| 33 .then(InspectorTest.dumpCacheTree) | |
| 34 .then(InspectorTest.createCache.bind(this, mainFrameId, "testCache1" )) | |
| 35 .then(InspectorTest.createCache.bind(this, mainFrameId, "testCache2" )) | |
| 36 .then(InspectorTest.dumpCacheTree) | |
| 37 .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache 1", "http://fake.request.com/1", "OK")) | |
| 38 .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache 1", "http://fake.request.com/2", "Not Found")) | |
| 39 .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache 2", "http://fake.request2.com/1", "OK")) | |
| 40 .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache 2", "http://fake.request2.com/2", "Not Found")) | |
| 41 .then(InspectorTest.dumpCacheTree) | |
| 42 .then(InspectorTest.deleteCache.bind(this, mainFrameId, "testCache1" )) | |
| 43 .then(InspectorTest.deleteCacheFromInspector.bind(this, "testCache2" )) | |
| 44 .then(InspectorTest.dumpCacheTree) | |
| 45 .then(InspectorTest.completeTest) | |
| 46 .catch(errorAndExit); | |
| 47 } | |
| 48 } | |
| 49 </script> | |
| 50 </head> | |
| 51 <body onload="runTest()"> | |
| 52 <p>Tests that cache data is correctly deleted by the inspector.</p> | |
| 53 </body> | |
| 54 </html> | |
| OLD | NEW |