chromium/third_party/blink/web_tests/http/tests/cache/loaded-from-cache-after-reload-within-iframe.html

<body>
<h1></h1>
<script>
// Test that a subresource fetched after onload, following a reload, is still
// loaded from the cache.

if (!sessionStorage.lastRandom) {
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }
}

function done(result)
{
    delete sessionStorage.lastRandom;

    document.body.innerText = result;

    if (window.testRunner)
        testRunner.notifyDone();
}

function iframeLoaded()
{
    setTimeout(function() {
        if (!window.randomNumber)
            done('FAIL: window.randomNumber not defined!');
        else if (sessionStorage.lastRandom) {
            if ((sessionStorage.lastRandom - 0) == (randomNumber - 0))
                done('PASS');
            else
                done('FAIL');
        } else {
            sessionStorage.lastRandom = randomNumber;
            location.reload();
        }
    }, 0);
}

onload = function()
{
    // After onload, add a script tag that should always load from the cache.
    setTimeout(function()
    {
        var f = document.createElement('iframe');
        f.src = 'resources/loaded-from-cache-after-reload-within-iframe-subframe.html';
        f.onload = iframeLoaded;
        document.body.appendChild(f);
    }, 1000);
};
</script>
</body>