blob: 801cfade0ea13bcdcb19759ef4146169c706ce93 [file] [log] [blame]
<html>
<head>
</head>
<body>
<p> This test verifies that file with content type does trigger onProgress event when response type "blob" is specified. </p>
<p> You should see PASSED twice. </p>
<body>
<p id="shouldBeCalled"> FAILED </p>
<p id="shouldNotBeCalled"> PASSED </p>
<script type="text/javascript">
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var count = 0;
function checkDone() {
if (++count == 2 && window.testRunner)
testRunner.notifyDone();
}
function onProgressPassed(e) {
document.getElementById("shouldBeCalled").innerHTML = "PASSED";
}
function onProgressFailed(e) {
document.getElementById("shouldNotBeCalled").innerHTML = "FAILED";
}
var req = new XMLHttpRequest();
req.responseType = "blob";
req.onprogress = onProgressPassed;
req.onload = checkDone;
// Test that onProgress is called on a normal file
req.open("GET", "resources/1251.html", true);
req.send(null);
// If content length is not given, it should not be called
var req2 = new XMLHttpRequest();
req2.responseType = "blob";
req2.onprogress = onProgressFailed;
req2.onload = checkDone;
req2.open("GET", "resources/noContentLength.asis", true);
req2.send(null);
</script>
</body>
</html>