chromium/third_party/blink/web_tests/http/tests/xmlhttprequest/upload-progress-events.html

<!DOCTYPE html>
<script src="/js-test-resources/testharness.js"></script>
<script src="/js-test-resources/testharnessreport.js"></script>
<p></p>
<script type="text/javascript">
var log = "";

function recordEvent(eventName, evt)
{
    log += eventName + ": " + evt + "\n";
}

var test = async_test("progress events are fired for XMLHttpRequestUpload objects in the correct order, loadstart, progress, load, and then loadend.");
test.step(function() {
    var xhr = new XMLHttpRequest;

    xhr.upload.onprogress = function(evt)
    {
        log += "progress: " + evt + " (loaded=" + evt.loaded + ", total=" + evt.total + ")\n";
    };
    xhr.upload.onloadstart = recordEvent.bind(undefined, "loadstart");
    xhr.upload.onload = recordEvent.bind(undefined, "load");
    xhr.upload.onloadend = recordEvent.bind(undefined, "loadend");
    xhr.onreadystatechange = function(evt)
    {
        if (xhr.readyState == xhr.DONE) {
            var expectedLog =
                "loadstart: [object ProgressEvent]\n" +
                "progress: [object ProgressEvent] (loaded=4, total=4)\n" +
                "load: [object ProgressEvent]\n" +
                "loadend: [object ProgressEvent]\n"
            assert_equals(log, expectedLog);
            test.done();
        }
    };

    xhr.open("POST", "resources/post-echo.cgi", true);
    xhr.send("data");
});
</script>