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

Unified Diff: LayoutTests/http/tests/inspector/network/network-disable-cache-memory.html

Issue 7563005: Merge 91858 - Web Inspector: Disable cache option should only clear memory cache, not disable it. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 5 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 | LayoutTests/http/tests/inspector/network/network-disable-cache-memory-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/inspector/network/network-disable-cache-memory.html
===================================================================
--- LayoutTests/http/tests/inspector/network/network-disable-cache-memory.html (revision 92267)
+++ LayoutTests/http/tests/inspector/network/network-disable-cache-memory.html (working copy)
@@ -3,83 +3,82 @@
<script src="../inspector-test.js"></script>
<script src="../network-test.js"></script>
<script>
-function loadImage(callback)
-{
- var image = new Image();
- image.onload = callback;
- image.src = "resources/resource.php?type=image&random=1&cached=1";
- document.body.appendChild(image);
+function scheduleScriptLoad() {
+ window.setTimeout(loadScript, 0);
}
-function loadData()
-{
- loadImage(imageLoaded1);
+function loadScript() {
+ var script = document.createElement("script");
+ script.type = "text/javascript";
+ script.src = "resources/random-script.php";
+ document.head.appendChild(script);
}
-function imageLoaded1()
+function test()
{
- loadImage(imageLoaded2);
-}
+ var content1;
+ var content2;
+ var content3;
-function imageLoaded2()
-{
- console.log("First two images loaded.");
-}
+ function loadScriptAndGetContent(callback)
+ {
+ InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", scriptLoaded);
+ InspectorTest.evaluateInPage("scheduleScriptLoad()");
-function cacheDisabled()
-{
- loadImage(allImagesLoaded);
-}
+ function scriptLoaded()
+ {
+ var resourcesCount = WebInspector.panels.network.resources.length;
+ var resource = WebInspector.panels.network.resources[resourcesCount - 1];
+ resource.requestContent(contentLoaded);
+ }
-function allImagesLoaded()
-{
- console.log("Done.");
-}
+ function contentLoaded()
+ {
+ var resourcesCount = WebInspector.panels.network.resources.length;
+ var resource = WebInspector.panels.network.resources[resourcesCount - 1];
+ callback(resource.content);
+ }
+ }
-function test()
-{
- InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
- InspectorTest.evaluateInPage("loadData()");
+ loadScriptAndGetContent(step1);
+ function step1(content)
+ {
+ content1 = content;
+ InspectorTest.reloadPage(step2);
+ }
+
function step2(msg)
{
- NetworkAgent.setCacheDisabled(true, step3);
+ loadScriptAndGetContent(step3);
}
- function step3(msg)
+ function step3(content)
{
- InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step4);
- InspectorTest.evaluateInPage("cacheDisabled()");
+ content2 = content;
+ NetworkAgent.setCacheDisabled(true, step4);
}
function step4(msg)
{
- // inspector-test.js appears in network panel occasionally in Safari on
- // Mac, so checking two last resources.
- var resourcesCount = WebInspector.panels.network.resources.length;
- var resource1 = WebInspector.panels.network.resources[resourcesCount - 2];
- var resource2 = WebInspector.panels.network.resources[resourcesCount - 1];
- resource1.requestContent(contentLoaded);
- resource2.requestContent(contentLoaded);
+ InspectorTest.reloadPage(step5);
}
- var contentLoadedCount = 0;
- function contentLoaded()
+ function step5(msg)
{
- if (++contentLoadedCount !== 2)
- return;
+ loadScriptAndGetContent(step6);
+ }
- var resourcesCount = WebInspector.panels.network.resources.length;
- var resource1 = WebInspector.panels.network.resources[resourcesCount - 2];
- var resource2 = WebInspector.panels.network.resources[resourcesCount - 1];
+ function step6(content)
+ {
+ content3 = content;
- InspectorTest.addResult(resource1.url);
- InspectorTest.addResult(resource2.url);
- InspectorTest.assertTrue(resource1.content !== resource2.content, "Second and third resources differ");
- NetworkAgent.setCacheDisabled(false, step5);
+ InspectorTest.assertTrue(content1 === content2, "First and second scripts should be equal.");
+ InspectorTest.assertTrue(content2 !== content3, "Second and third scripts should differ.");
+ NetworkAgent.setCacheDisabled(false, step7);
}
- function step5(msg)
+ function step7(msg)
{
InspectorTest.completeTest();
}
« no previous file with comments | « no previous file | LayoutTests/http/tests/inspector/network/network-disable-cache-memory-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698