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); | |
pfeldman
2015/04/10 12:35:33
4 space indent.
dmurph
2015/04/13 18:23:03
Done.
| |
17 InspectorTest.completeTest(); | |
18 } | |
19 | |
20 function before() | |
21 { | |
22 return caches.keys().then(function(keys) { | |
pfeldman
2015/04/10 12:35:33
These are the caches of the inspector front-end, n
dmurph
2015/04/13 18:23:03
Fixed.
| |
23 return Promise.all(keys.map(function(key) { | |
pfeldman
2015/04/10 12:35:33
4 space indent.
dmurph
2015/04/13 18:23:03
Done.
| |
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.createCache.bind(this, mainFrameId, "testCache2" )) | |
35 .then(InspectorTest.dumpCacheTree) | |
36 .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache 1", "http://fake.request.com/1", "OK")) | |
37 .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache 1", "http://fake.request.com/2", "Not Found")) | |
38 .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache 2", "http://fake.request2.com/1", "OK")) | |
39 .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache 2", "http://fake.request2.com/2", "Not Found")) | |
40 .then(InspectorTest.dumpCacheTree) | |
41 .then(InspectorTest.completeTest) | |
42 .catch(errorAndExit); | |
43 } | |
44 } | |
45 </script> | |
46 </head> | |
47 <body onload="runTest()"> | |
48 <p>Tests that cache data is correctly populated in the Inspector.</p> | |
49 </body> | |
50 </html> | |
OLD | NEW |