chromium/third_party/blink/web_tests/fast/preloader/image.html

<body>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

window.addEventListener('DOMContentLoaded', function() {
    if (window.internals)
        console.log(internals.isPreloaded("resources/image1.png") ? "PASS" : "FAIL");
}, false);
</script>
This test requires DumpRenderTree to see the log of what resources are loaded.
<script src=resources/non-existant.js></script>
<script>document.write("<plaintext>");</script>
<img src=resources/image1.png>