chromium/third_party/blink/web_tests/http/tests/security/subresourceIntegrity/integrity-attribute.html

<!DOCTYPE html>
<html>
<head>
    <script src="/js-test-resources/js-test.js"></script>
</head>
<body>
    <script>
        description("Some elements should have `integrity` attributes. Others shouldn't.");

        var ASSERT_INTEGRITY = 1;
        var ASSERT_NO_INTEGRITY = 0;

        function checkElement(elementName, integrityDisposition) {
            var el = document.createElement(elementName);
            if (integrityDisposition == ASSERT_INTEGRITY) {
                if ("integrity" in el)
                    testPassed("<" + elementName + "> has an 'integrity' attribute.");
                else
                    testFailed("<" + elementName + "> does not have an 'integrity' attribute.");
            } else {
                if ("integrity" in el)
                    testFailed("<" + elementName + "> has an 'integrity' attribute.");
                else
                    testPassed("<" + elementName + "> does not have an 'integrity' attribute.");
            }
        }

        var shouldHaveIntegrity = [
            'link',
            'script',
        ];

        var shouldNotHaveIntegrity = [
            'a',
            'audio',
            'embed',
            'iframe',
            'img',
            'object',
            'source',
            'track',
            'video',
            'body',
            'div',
            'html',
            'meta',
            'span',
        ];

        for (var i = 0; i < shouldHaveIntegrity.length; i++)
            checkElement(shouldHaveIntegrity[i], ASSERT_INTEGRITY);

        for (var i = 0; i < shouldNotHaveIntegrity.length; i++)
            checkElement(shouldNotHaveIntegrity[i], ASSERT_NO_INTEGRITY);
    </script>
</body>
</html>