blob: c43d81ac39dd1ca7ad5ddacb16c653d8f15dbb91 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script>
function multipartUrl() {
var relativePath = "../../../../fast/images/resources/";
return "resources/multipart.php"
+ "?interval=0.1"
+ "&img1=" + relativePath + "red-100x100.png"
+ "&img2=" + relativePath + "green-400x400.png"
+ "&img3=" + relativePath + "green-400x400.png";
}
var intervalID = null;
function finishTest() {
if (intervalID !== null)
clearInterval(intervalID);
finishJSTest();
}
(function() {
description("Make sure no async decoding is done for multipart images");
jsTestIsAsync = true;
if (window.internals && window.testRunner) {
internals.clearMemoryCache();
internals.settings.setWebkitImageReadyEventEnabled(true);
internals.settings.setLargeImageAsyncDecodingEnabled(true);
}
var image = new Image;
document.body.appendChild(image);
image.addEventListener("webkitImageFrameReady", function() {
// The first image is small (100x100) red image which does not
// require async image decoding. But drawing it should prevent
// any subsequent async image decoding for large images.
testFailed("Async image decoding was mistakenly requested.");
finishTest();
}, false);
image.onload = function() {
var count = 0;
intervalID = setInterval(function() {
// Force layout and display.
document.body.offsetHeight;
testRunner.display();
++count;
if (image.offsetWidth == 400 && count == 100) {
testPassed("The second frame of the multipart image was drawn without async image decoding.");
finishTest();
}
if (count > 200) {
testFailed("Timeout: the second frame of the multipart image was not loaded.");
finishTest();
}
}, 10);
}
image.src = multipartUrl();
})();
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>