<!DOCTYPE html><!-- webkit-test-runner [ isAppInitiated=false ] -->
<head>
    <script src="../resources/js-test-pre.js"></script>
</head>
<body onload="runTest()">
<script>
    description('Ensure web socket loads are attributed correctly.');

    window.jsTestIsAsync = true;

    if (window.testRunner)
        testRunner.setAllowsAnySSLCertificate(true);

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

    function askForAttribution() {
        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();
    }

    function runTest() {
        new WebSocket('ws://localhost:8880/websocket/tests/hybi/simple');
        setTimeout(askForAttribution, 0);
    }
</script>
<script src="..//resources/js-test-post.js"></script>
</body>