| 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..d8954a214483fbba5d91f4cf9280d8abbc17119c
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/reload-memory-cache.html
|
| @@ -0,0 +1,71 @@
|
| +<!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 never be reached.");
|
| + InspectorTest.completeTest();
|
| + }
|
| + }
|
| +
|
| + 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 coming from protocol still use memory cache.</p>
|
| +</body>
|
| +</html>
|
|
|