Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/reload-memory-cache.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/reload-memory-cache.html b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/reload-memory-cache.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4569a7e31719c7ecb74694014570a935a133a1b2 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/reload-memory-cache.html |
| @@ -0,0 +1,69 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script src="inspector-protocol-test.js"></script> |
| +<script> |
| +(function () |
| +{ |
| + var xhr = new XMLHttpRequest(); |
| + xhr.open("GET", "resources/blank.js", true); |
| + xhr.send(null); |
| +})(); |
| + |
| +function test() |
| +{ |
| + InspectorTest.eventHandler["Network.requestWillBeSent"] = onRequestWillBeSent; |
| + InspectorTest.eventHandler["Network.responseReceived"] = onResponseReceived; |
| + InspectorTest.eventHandler["Network.requestServedFromCache"] = onServedFromCache; |
| + |
| + enableNetwork(); |
| + |
| + function enableNetwork() |
| + { |
| + InspectorTest.sendCommand("Network.enable", {}, prepareForReload); |
| + } |
| + |
| + function prepareForReload() |
| + { |
| + InspectorTest.evaluateInPage("prepareForReload()", reloadPage); |
| + } |
| + |
| + function reloadPage() |
| + { |
| + // It's worth noting that because the way the testrunner works nothing will be logged |
| + // until after this command executes and not log anything in the callback of this function. |
| + InspectorTest.sendCommand("Page.reload", { "ignoreCache": false }); |
| + } |
| + |
| + |
| + var blankRequestId = 0; |
| + function onRequestWillBeSent(request) |
| + { |
| + var url = request.params.request.url; |
| + if (/blank\.js$/.test(url)) { |
| + InspectorTest.log("Request Will be Sent for " + url.substr(url.lastIndexOf("blank.js"))); |
| + blankRequestId = request.params.requestId; |
| + } |
| + } |
| + |
| + function onResponseReceived(request) |
| + { |
| + var url = request.params.response.url; |
| + if (/blank.js$/.test(url)) |
| + 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.
|
| + } |
| + |
| + function onServedFromCache(request) |
| + { |
| + if (request.params.requestId === blankRequestId) { |
| + InspectorTest.log("Served From Cache for blank.js"); |
| + InspectorTest.completeTest(); |
| + } |
| + } |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest();"> |
| +<p>Tests that reloads when choming from protocol still use memory cache for reloads.</p> |
| +</body> |
| +</html> |