Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / upload-request-error-event-order.html
blobde3bb500a60e958be987f601e191b8cd905f286e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="help" href="http://www.w3.org/TR/2012/WD-XMLHttpRequest-20121206/#request-error"/>
5 <script src="/js-test-resources/js-test.js"></script>
6 </head>
7 <body>
8 <script>
9 description("Test to validate the order in which the events are fired in case of a request error.");
10 window.jsTestIsAsync = true;
12 expectedOrder = "rsdone,upload.onerror,upload.onloadend,onerror,onloadend,";
13 actualOrder = "";
15 var xhr = new XMLHttpRequest();
16 xhr.open("POST", "http://localhost:8000/xmlhttprequest/resources/cross-site-progress-events.cgi", true);
17 xhr.setRequestHeader("Content-Type", "text/plain");
19 xhr.onreadystatechange = function () {
20 if (xhr.readyState == XMLHttpRequest.DONE) {
21 actualOrder += "rsdone,";
24 xhr.upload.onerror = function (evt) {
25 actualOrder += "upload.onerror,";
27 xhr.upload.onloadend = function () {
28 actualOrder += "upload.onloadend,";
30 xhr.onerror = function (evt) {
31 actualOrder += "onerror,";
33 xhr.onloadend = function () {
34 actualOrder += "onloadend,";
35 shouldBeEqualToString('actualOrder', '' + expectedOrder);
36 finishJSTest();
39 xhr.send("test");
41 </script>
42 </body>
43 </html>