blob: 13267385e1c399934d5add542c9645dfb8f8bbd9 [file] [log] [blame]
<html>
<head>
<title> Test case for bug 18655 </title>
</head>
<body>
<p> Test case for Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=18655">18655</a>: [XHR] OnProgress needs more test case </p>
<p> This test verify that file with content type does trigger onProgress event. </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.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.onprogress = onProgressFailed;
req2.onload = checkDone;
req2.open("GET", "resources/noContentLength.asis", true);
req2.send(null);
</script>
</body>
</html>