Chromium Code Reviews| 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 NOT BE REACHED!!!!"); | |
|
dgozman
2016/08/24 23:09:42
completeTest in this case as well, or it will time
dgozman
2016/08/24 23:09:42
nit: I don't like the shouty case :-)
allada
2016/09/07 21:15:36
Done.
allada
2016/09/07 21:15:36
Done.
| |
| 54 } | |
| 55 | |
| 56 function onServedFromCache(request) | |
| 57 { | |
| 58 if (request.params.requestId === blankRequestId) { | |
| 59 InspectorTest.log("Served From Cache for blank.js"); | |
| 60 InspectorTest.completeTest(); | |
| 61 } | |
| 62 } | |
| 63 } | |
| 64 </script> | |
| 65 </head> | |
| 66 <body onload="runTest();"> | |
| 67 <p>Tests that reloads when choming from protocol still use memory cache for relo ads.</p> | |
| 68 </body> | |
| 69 </html> | |
| OLD | NEW |