chromium/third_party/blink/web_tests/http/tests/xmlhttprequest/xmlhttprequest-addEventListener-onProgress.html

<!doctype html>
<html>
<head>
    <title> Test case for bug 18655 </title>
</head>
<body>
<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>
<p> This test verify that addEventListener("progress", XXX, XXX) works as expected. </p>
<p> You should see PASSED 2 times. </p>
<script type="text/javascript">
var count = 1;

function log(msg)
{
    document.body.appendChild(document.createTextNode(msg));
    document.body.appendChild(document.createElement("br"));
}

function onProgress(e) {
    if (this.seenProgress)
        return;

    this.seenProgress = true;
    log("PASSED (" + count + ")");
    if (++count > 2 && window.testRunner)
        testRunner.notifyDone();
}

if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}

// Test for capture phase 
var req3 = new XMLHttpRequest();
req3.addEventListener("progress", onProgress, true);
req3.seenProgress = false;
req3.open("GET", "resources/1251.html", true);
req3.send(null);

// Test for bubble phase 
var req4 = new XMLHttpRequest();
req4.addEventListener("progress", onProgress, false);
req4.seenProgress = false;
req4.open("GET", "resources/1251.html", true);
req4.send(null);

</script>
</body>
</html>