<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="/js-test-resources/js-test.js"></script>
    <script src="resources/util.js"></script>
</head>
<body>
<script>
    description("Test for enabling debug mode and that it permanently treats 3rdpartytestwebkit.org as a prevalent resource.");
    jsTestIsAsync = true;

    const thirdPartyOrigin = "http://3rdpartytestwebkit.org";

    if (window.testRunner && window.internals) {
        setEnableFeature(true, function() {
            if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
                testFailed(thirdPartyOrigin + " already set as prevalent resource.");

            testRunner.setStatisticsDebugMode(true, function() {
                if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
                    testFailed(thirdPartyOrigin + " didn't get set as prevalent resource.");
                else
                    testPassed(thirdPartyOrigin + " got set as prevalent resource in debug mode.");
                testRunner.setStatisticsDebugMode(false, function() {
                    setEnableFeature(false, finishJSTest);
                });
            });
        });
    }
</script>
</body>
</html>
