Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/reload-memory-cache.html

Issue 2274233002: [Devtools] Fix reload behavior when devtools is open (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new methods Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698