| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="inspector-protocol-test.js"></script> |
| 5 <script> |
| 6 (function () |
| 7 { |
| 8 var xhr = new XMLHttpRequest(); |
| 9 xhr.open("GET", "resources/blank.js", true); |
| 10 xhr.send(null); |
| 11 })(); |
| 12 |
| 13 function test() |
| 14 { |
| 15 InspectorTest.eventHandler["Network.requestWillBeSent"] = onRequestWillBeSen
t; |
| 16 InspectorTest.eventHandler["Network.responseReceived"] = onResponseReceived; |
| 17 InspectorTest.eventHandler["Network.requestServedFromCache"] = onServedFromC
ache; |
| 18 |
| 19 enableNetwork(); |
| 20 |
| 21 function enableNetwork() |
| 22 { |
| 23 InspectorTest.sendCommand("Network.enable", {}, prepareForReload); |
| 24 } |
| 25 |
| 26 function prepareForReload() |
| 27 { |
| 28 InspectorTest.evaluateInPage("prepareForReload()", reloadPage); |
| 29 } |
| 30 |
| 31 function reloadPage() |
| 32 { |
| 33 // It's worth noting that because the way the testrunner works nothing w
ill be logged |
| 34 // until after this command executes and not log anything in the callbac
k of this function. |
| 35 InspectorTest.sendCommand("Page.reload", { "ignoreCache": false }); |
| 36 } |
| 37 |
| 38 |
| 39 var blankRequestId = 0; |
| 40 function onRequestWillBeSent(request) |
| 41 { |
| 42 var url = request.params.request.url; |
| 43 if (/blank\.js$/.test(url)) { |
| 44 InspectorTest.log("Request Will be Sent for " + url.substr(url.lastI
ndexOf("blank.js"))); |
| 45 blankRequestId = request.params.requestId; |
| 46 } |
| 47 } |
| 48 |
| 49 function onResponseReceived(request) |
| 50 { |
| 51 var url = request.params.response.url; |
| 52 if (/blank.js$/.test(url)) { |
| 53 InspectorTest.log("This should never be reached."); |
| 54 InspectorTest.completeTest(); |
| 55 } |
| 56 } |
| 57 |
| 58 function onServedFromCache(request) |
| 59 { |
| 60 if (request.params.requestId === blankRequestId) { |
| 61 InspectorTest.log("Served From Cache for blank.js"); |
| 62 InspectorTest.completeTest(); |
| 63 } |
| 64 } |
| 65 } |
| 66 </script> |
| 67 </head> |
| 68 <body onload="runTest();"> |
| 69 <p>Tests that reloads when coming from protocol still use memory cache.</p> |
| 70 </body> |
| 71 </html> |
| OLD | NEW |