Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / xmlhttprequest-no-content-length-onProgress.html
blob13267385e1c399934d5add542c9645dfb8f8bbd9
1 <html>
2 <head>
3 <title> Test case for bug 18655 </title>
4 </head>
5 <body>
6 <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>
7 <p> This test verify that file with content type does trigger onProgress event. </p>
8 <p> You should see PASSED twice. </p>
9 <body>
10 <p id="shouldBeCalled"> FAILED </p>
11 <p id="shouldNotBeCalled"> PASSED </p>
12 <script type="text/javascript">
13 if (window.testRunner) {
14 testRunner.dumpAsText();
15 testRunner.waitUntilDone();
18 var count = 0;
19 function checkDone() {
20 if (++count == 2 && window.testRunner)
21 testRunner.notifyDone();
24 function onProgressPassed(e) {
25 document.getElementById("shouldBeCalled").innerHTML = "PASSED";
28 function onProgressFailed(e) {
29 document.getElementById("shouldNotBeCalled").innerHTML = "FAILED";
32 var req = new XMLHttpRequest();
33 req.onprogress = onProgressPassed;
34 req.onload = checkDone;
35 // Test that onProgress is called on a normal file
36 req.open("GET", "resources/1251.html", true);
37 req.send(null);
39 // If content length is not given, it should not be called
40 var req2 = new XMLHttpRequest();
41 req2.onprogress = onProgressFailed;
42 req2.onload = checkDone;
43 req2.open("GET", "resources/noContentLength.asis", true);
44 req2.send(null);
46 </script>
47 </body>
48 </html>