blob: 25ba51541f7f8d14108dfdd21a1b9e8c9de364a7 [file] [log] [blame]
<!DOCTYPE html>
<html>
<script>
if (window.internals)
internals.settings.setResourceTimingEnabled(true);
if (window.testRunner) {
testRunner.dumpAsText()
testRunner.waitUntilDone();
}
if (window.performance)
console.log("current entries: " + performance.getEntriesByType('resource').length);
</script>
<script src="../../resources/js-test-pre.js"></script>
<img src="../../resources/square100.png">
<script>
var foundResource = 0;
var runTest = function() {
var resources = performance.getEntriesByType('resource');
for (var i = 0; i < resources.length; ++i) {
console.log("entry: " + resources[i].name);
if (resources[i].name.indexOf("square") != -1)
++foundResource;
};
shouldBe("foundResource", "2");
if (window.internals)
window.internals.settings.setResourceTimingEnabled(false);
if (window.testRunner)
testRunner.notifyDone();
};
var windowLoaded = false;
var xhrLoaded = false;
var xhr = new XMLHttpRequest();
xhr.addEventListener("load", function() {
if (windowLoaded)
setTimeout(runTest, 0);
xhrLoaded = true;
});
xhr.open("GET", "../../resources/square100.png");
xhr.send();
window.addEventListener("load", function() {
if (xhrLoaded)
runTest();
windowLoaded = true;
});
</script>
</body>
</html>