<html>
<head>
<script src="../inspector-test.js"></script>
<script src="../resources-test.js"></script>
<script src="resource-tree-test.js"></script>
<link rel="stylesheet" href="resources/styles-initial.css">
<script>
function createScriptTag()
{
    var scriptElement = document.createElement("script");
    scriptElement.src = "resources/dynamic-script.js";
    document.head.appendChild(scriptElement);
}

function test()
{
    InspectorTest.addResult("Adding dynamic script: ");
    InspectorTest.evaluateInPage("createScriptTag()", step2);

    function step2()
    {
        InspectorTest.addResult("Waiting for script request to finish: ");
        InspectorTest.runAfterResourcesAreFinished(["dynamic-script.js"], step3)
    }

    function step3()
    {
        InspectorTest.addResult("Clearing memory cache: ");
        NetworkAgent.setCacheDisabled(true, step4);
    }

    function step4()
    {
        NetworkAgent.setCacheDisabled(false, step5);
    }

    var resource;
    function step5()
    {
        InspectorTest.addResult("Requesting content: ");
        resource = InspectorTest.resourceMatchingURL("dynamic-script.js");
        resource.requestContent(step6);
    }

    function step6(content)
    {
        InspectorTest.assertTrue(!!content, "No content available.");
        InspectorTest.addResult("Resource url: " + resource.url);
        InspectorTest.addResult("Resource content: " + content);
        InspectorTest.completeTest();
    }
}
</script>
</head>
<body onload="runTest()">
<p>Tests resource content is correctly loaded if Resource.requestContent was called before network request was finished.</p>
<a href="https://bugs.webkit.org/show_bug.cgi?id=90153">Bug 90153</a>
</body>
</html>
