chromium/third_party/blink/web_tests/http/tests/multipart/stop-loading-after-onload1.html

<html>
<head>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>
var t = async_test("window.stop() can stop loading of multipart images " +
                   "after <img>'s onload and " +
                   "before the next part loaded after onload.");

function callStop()
{
    const url = "resources/multipart.php?interval=1&loop=1&img1=2x2-green.png&img2=abe.png&label=1";
    if (window.internals) {
        assert_true(internals.isLoading(url), "The image should be loading before window.stop().");
    }
    window.stop();
    window.setTimeout(t.step_func(function() {
        if (window.internals) {
            assert_false(internals.isLoading(url), "The image should not be loading after window.stop().");
        }
        t.done();
    }), 100);
}

function firstPartLoaded()
{
    setTimeout(t.step_func(callStop), 0);
}
</script>
</head>
<body>
<!-- |label| is added to avoid interaction between stop-loading* tests -->
<img id=testingImage src="resources/multipart.php?interval=1&loop=1&img1=2x2-green.png&img2=abe.png&label=1" onload="firstPartLoaded()">
</body>
</html>