| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 4 | <script src="/resources/testharness.js"></script> |
| Hallvord Reiar M. Steen | 99eeb10 | 2013-05-24 09:16:01 | [diff] [blame] | 5 | <title>XMLHttpRequest: The send() method: Fire a progress event named loadend (no response entity body)</title> |
| Hallvord Reiar M. Steen | d728ca6 | 2013-05-24 11:52:26 | [diff] [blame] | 6 | <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#handler-xhr-onloadend" data-tested-assertations="/../.." /> |
| 7 | <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#event-xhr-loadend" data-tested-assertations="/../.." /> |
| Hallvord Reiar M. Steen | 5a80738 | 2013-05-24 12:42:17 | [diff] [blame] | 8 | <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[10] /following-sibling::ol/li[10]" /> |
| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 9 | </head> |
| 10 | |
| 11 | <body> |
| 12 | <div id="log"></div> |
| 13 | |
| 14 | <script type="text/javascript"> |
| 15 | var test = async_test(); |
| 16 | |
| Hallvord Reiar M. Steen | d728ca6 | 2013-05-24 11:52:26 | [diff] [blame] | 17 | test.step(function () |
| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 18 | { |
| 19 | var xhr = new XMLHttpRequest(); |
| 20 | |
| Hallvord Reiar M. Steen | d728ca6 | 2013-05-24 11:52:26 | [diff] [blame] | 21 | xhr.onreadystatechange = function() |
| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 22 | { |
| Hallvord Reiar M. Steen | d728ca6 | 2013-05-24 11:52:26 | [diff] [blame] | 23 | test.step(function() |
| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 24 | { |
| Hallvord Reiar M. Steen | d728ca6 | 2013-05-24 11:52:26 | [diff] [blame] | 25 | if (xhr.readyState == 4) |
| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 26 | { |
| 27 | assert_equals(xhr.response, ""); |
| 28 | } |
| 29 | }); |
| 30 | }; |
| 31 | |
| Hallvord Reiar M. Steen | d728ca6 | 2013-05-24 11:52:26 | [diff] [blame] | 32 | xhr.onloadend = function(e) |
| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 33 | { |
| Hallvord Reiar M. Steen | d728ca6 | 2013-05-24 11:52:26 | [diff] [blame] | 34 | test.step(function() |
| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 35 | { |
| 36 | assert_true(e instanceof ProgressEvent); |
| 37 | assert_equals(e.type, "loadend"); |
| 38 | test.step(function() { test.done(); }); |
| 39 | }); |
| 40 | }; |
| 41 | |
| Hallvord Reiar M. Steen | 563ff3b | 2013-05-23 12:11:14 | [diff] [blame] | 42 | xhr.open("POST", "./resources/content.php", true); |
| akuang@microsoft.com | 61b5a38 | 2012-10-26 14:19:05 | [diff] [blame] | 43 | xhr.send(); |
| 44 | }); |
| 45 | </script> |
| 46 | </body> |
| 47 | </html> |