OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../inspector-test.js"></script> | 3 <script src="../inspector-test.js"></script> |
4 <script src="../network-test.js"></script> | 4 <script src="../network-test.js"></script> |
5 <script> | 5 <script> |
6 var image; | 6 var image; |
7 function loadFirstImage() { | 7 function loadFirstImage() { |
8 if (!window.internals) { | 8 if (!window.internals) { |
9 console.log("This test can not be run as window.internals is not availab
le."); | 9 console.log("This test can not be run as window.internals is not availab
le."); |
10 return; | 10 return; |
(...skipping 15 matching lines...) Expand all Loading... |
26 function loadSecondImage() { | 26 function loadSecondImage() { |
27 image.onload = secondImageLoaded; | 27 image.onload = secondImageLoaded; |
28 image.src = "resources/resource.php?type=image&random=1&size=200"; | 28 image.src = "resources/resource.php?type=image&random=1&size=200"; |
29 } | 29 } |
30 | 30 |
31 function secondImageLoaded() | 31 function secondImageLoaded() |
32 { | 32 { |
33 console.log("Done2."); | 33 console.log("Done2."); |
34 } | 34 } |
35 | 35 |
36 function forceCachedResourceLoaderGC() { | |
37 if (window.internals) | |
38 window.internals.garbageCollectDocumentResources(); | |
39 } | |
40 | |
41 function test() | 36 function test() |
42 { | 37 { |
43 var imageRequest; | 38 var imageRequest; |
44 InspectorTest.recordNetwork(); | 39 InspectorTest.recordNetwork(); |
45 InspectorTest.addConsoleSniffer(step2); | 40 InspectorTest.addConsoleSniffer(step2); |
46 InspectorTest.evaluateInPage("loadFirstImage()"); | 41 InspectorTest.evaluateInPage("loadFirstImage()"); |
47 | 42 |
48 function step2() | 43 function step2() |
49 { | 44 { |
50 imageRequest = WebInspector.panel("network").requests[WebInspector.panel
("network").requests.length - 1]; | 45 imageRequest = WebInspector.panel("network").requests[WebInspector.panel
("network").requests.length - 1]; |
(...skipping 19 matching lines...) Expand all Loading... |
70 NetworkAgent.setCacheDisabled(true, step5); | 65 NetworkAgent.setCacheDisabled(true, step5); |
71 } | 66 } |
72 | 67 |
73 function step5(msg) | 68 function step5(msg) |
74 { | 69 { |
75 NetworkAgent.setCacheDisabled(false, step6); | 70 NetworkAgent.setCacheDisabled(false, step6); |
76 } | 71 } |
77 | 72 |
78 function step6() | 73 function step6() |
79 { | 74 { |
80 // Force CachedResourceLoader garbage collector run. | |
81 InspectorTest.evaluateInPage("forceCachedResourceLoaderGC()"); | |
82 | |
83 // Re-request content now that CachedResource should have been destroyed
. | 75 // Re-request content now that CachedResource should have been destroyed
. |
84 delete imageRequest._content; | 76 delete imageRequest._content; |
85 imageRequest.requestContent(step7); | 77 imageRequest.requestContent(step7); |
86 } | 78 } |
87 | 79 |
88 function step7() | 80 function step7() |
89 { | 81 { |
90 InspectorTest.addResult("request.content after requesting content: " + i
mageRequest.content); | 82 InspectorTest.addResult("request.content after requesting content: " + i
mageRequest.content); |
91 InspectorTest.assertTrue(!imageRequest.content, "Content available after
CachedResource was destroyed."); | 83 InspectorTest.assertTrue(!imageRequest.content, "Content available after
CachedResource was destroyed."); |
92 InspectorTest.resetInspectorResourcesData(step8); | 84 InspectorTest.resetInspectorResourcesData(step8); |
93 } | 85 } |
94 | 86 |
95 function step8() | 87 function step8() |
96 { | 88 { |
97 InspectorTest.completeTest(); | 89 InspectorTest.completeTest(); |
98 } | 90 } |
99 } | 91 } |
100 </script> | 92 </script> |
101 </head> | 93 </head> |
102 <body onload="runTest()"> | 94 <body onload="runTest()"> |
103 <p>Tests cached resource content is discarded when cached resource is destroyed
if content size is too big for the resource agent's data storage.</p> | 95 <p>Tests cached resource content is discarded when cached resource is destroyed
if content size is too big for the resource agent's data storage.</p> |
104 <a href="https://bugs.webkit.org/show_bug.cgi?id=92108">Bug 92108</a> | 96 <a href="https://bugs.webkit.org/show_bug.cgi?id=92108">Bug 92108</a> |
105 </body> | 97 </body> |
106 </html> | 98 </html> |
107 | 99 |
OLD | NEW |