chromium/third_party/blink/web_tests/http/tests/xmlhttprequest/upload-onload-event.html

<!doctype html>
<html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script type="text/javascript">

var xhr;
var payload = "data";
var expectedLength = payload.length;

function verifyProgressEvent(eventName, e, expected)
{
    assert_true(e.lengthComputable);
    assert_equals(e.loaded, expected, "Expected 'loaded' value of '" + eventName + "' event.");
    assert_equals(e.total, expected, "Expected 'total' value of '" + eventName + "' event.");
}

function loadHandler(e)
{
    assert_true(e instanceof ProgressEvent);
    verifyProgressEvent("onload", e, expectedLength);
    testUploadLoadEvent.done();
}

var testUploadLoadEvent = async_test("Check that upload 'load' events are delivered and have expected values.");
testUploadLoadEvent.step(function () {
    xhr = new XMLHttpRequest();
    xhr.upload.onload = testUploadLoadEvent.step_func(loadHandler);
    xhr.open("POST", "resources/post-echo.php", true);
    xhr.send(payload);
});
</script>
</body>
</html>