Index: LayoutTests/http/tests/inspector/cache-storage/cache-data.html |
diff --git a/LayoutTests/http/tests/inspector/cache-storage/cache-data.html b/LayoutTests/http/tests/inspector/cache-storage/cache-data.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f1d5327662a4db9ff33d71577484c6346ebd884e |
--- /dev/null |
+++ b/LayoutTests/http/tests/inspector/cache-storage/cache-data.html |
@@ -0,0 +1,50 @@ |
+<html> |
+<head> |
+<script src="../inspector-test.js"></script> |
+<script src="cache-storage-test.js"></script> |
+<script> |
+function test() |
+{ |
+ var cacheStorageModel = WebInspector.ServiceWorkerCacheModel.fromTarget(WebInspector.targetManager.mainTarget()); |
+ cacheStorageModel.enable(); |
+ var mainFrameId = InspectorTest.resourceTreeModel.mainFrame.id; |
+ |
+ InspectorTest.addSniffer(WebInspector.ServiceWorkerCacheModel.prototype, "_updateCacheNames", main, false); |
+ |
+ function errorAndExit(error) |
+ { |
+ console.error(error); |
pfeldman
2015/04/10 12:35:33
4 space indent.
dmurph
2015/04/13 18:23:03
Done.
|
+ InspectorTest.completeTest(); |
+ } |
+ |
+ function before() |
+ { |
+ 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.
|
+ 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.
|
+ return caches.delete(key); |
+ })); |
+ }); |
+ } |
+ |
+ function main() |
+ { |
+ before() |
+ .then(InspectorTest.dumpCacheTree) |
+ .then(InspectorTest.createCache.bind(this, mainFrameId, "testCache1")) |
+ .then(InspectorTest.createCache.bind(this, mainFrameId, "testCache2")) |
+ .then(InspectorTest.dumpCacheTree) |
+ .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache1", "http://fake.request.com/1", "OK")) |
+ .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache1", "http://fake.request.com/2", "Not Found")) |
+ .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache2", "http://fake.request2.com/1", "OK")) |
+ .then(InspectorTest.addCacheEntry.bind(this, mainFrameId, "testCache2", "http://fake.request2.com/2", "Not Found")) |
+ .then(InspectorTest.dumpCacheTree) |
+ .then(InspectorTest.completeTest) |
+ .catch(errorAndExit); |
+ } |
+} |
+</script> |
+</head> |
+<body onload="runTest()"> |
+<p>Tests that cache data is correctly populated in the Inspector.</p> |
+</body> |
+</html> |