<!DOCTYPE html><!-- webkit-test-runner [ isAppInitiated=false ] -->
<html>
<head>
    <script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
    description("Test media files loaded via redirect are marked non app initiated");

    function log(message)
    {
        document.getElementById('console').appendChild(document.createTextNode(message + '\n'));
    }

    function test()
    {
        var didLoadAppBoundRequest = testRunner.didLoadAppInitiatedRequest();
        var didLoadNonAppBoundRequest = testRunner.didLoadNonAppInitiatedRequest();

        if (didLoadAppBoundRequest) {
            log("FAIL did load app initiated request");
            finishJSTest();
            return;
        }

        if (!didLoadNonAppBoundRequest) {
            log("FAIL did not load non app initiated request");
            finishJSTest();
            return;
        }

        log("PASS successfully loaded only non app initiated requests");
        
        finishJSTest();
    }

    var video = document.createElement("video");
    video.addEventListener("loadeddata", test);
    video.src = `/resources/redirect.py?url=http://localhost:8000/resources/test.mp4`;

    window.jsTestIsAsync = true;
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
