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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads.php

Issue 2385313002: Avoid MemoryCache eviction of preloaded resources with devtools open (Closed)
Patch Set: review comment Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads.php b/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads.php
new file mode 100644
index 0000000000000000000000000000000000000000..ce9334986f2fe9a15b6113e75f4854b51d7981b3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads.php
@@ -0,0 +1,64 @@
+<?php
+ header("Link: <http://127.0.0.1:8000/resources/dummy.js>;rel=preload;as=script", false);
+?>
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="../network-test.js"></script>
+<script>
+function scheduleScriptLoad() {
+ window.setTimeout(loadScript, 0);
+}
+
+function loadScript() {
+ var script = document.createElement("script");
+ script.type = "text/javascript";
+ script.src = "http://127.0.0.1:8000/resources/dummy.js";
+ script.onload = function() {
+ setTimeout(scriptLoaded, 0);
+ };
+ document.head.appendChild(script);
+}
+
+function scriptLoaded() {
+ var resources = performance.getEntriesByType("resource");
+ var dummies = 0;
+ for (var i = 0; i < resources.length; ++i) {
+ if (resources[i].name.indexOf("dummy.js") != -1)
+ ++dummies;
+ }
+
+ if (dummies == 1)
+ console.log("PASS - 1 resource loaded");
+ else
+ console.log("FAIL - " + dummies + " resources loaded");
+}
+
+function test()
+{
+ InspectorTest.NetworkAgent.setCacheDisabled(true, step1);
+
+ function step1()
+ {
+ InspectorTest.reloadPage(step2);
+ }
+
+ function step2(msg)
+ {
+ InspectorTest.addConsoleSniffer(done);
+ InspectorTest.evaluateInPage("scheduleScriptLoad()");
+
+ }
+
+ function done(msg)
+ {
+ InspectorTest.completeTest();
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+ <p>Tests disabling cache from inspector and seeing that preloads are not evicted from memory cache.</p>
+</body>
+</html>
+
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698