chromium/third_party/blink/web_tests/fast/forms/autocomplete.html

<html>
<head>
    <script src="../../resources/js-test.js"></script>
    <script>
    window.jsTestIsAsync = true;
    function test() {
        var form = document.getElementById('form');
        var field = document.getElementById('field');

        shouldBeTrue("('autocomplete' in form)");
        shouldBeTrue("('autocomplete' in field)");

        shouldBeNull("form.getAttribute('autocomplete')");
        shouldBeNull("field.getAttribute('autocomplete')");

        shouldBeEqualToString("form.autocomplete", "on");
        shouldBeEqualToString("field.autocomplete", "");

        shouldBeEqualToString("form.autocomplete = 'off'; form.getAttribute('autocomplete')", "off");
        shouldBeEqualToString("field.autocomplete = 'off'; field.getAttribute('autocomplete')", "off");
        shouldBeEqualToString("form.setAttribute('autocomplete', 'on'); form.autocomplete", "on");
        shouldBeEqualToString("field.setAttribute('autocomplete', 'on'); field.autocomplete", "on");
        shouldBeEqualToString("form.setAttribute('autocomplete', 'indeterminate'); form.autocomplete", "on");
        shouldBeEqualToString("field.setAttribute('autocomplete', 'indeterminate'); field.autocomplete", "");
        finishJSTest();
    }
    </script>
</head>
<body onload="test()">
    This tests that the 'autocomplete' attribute of form and input elements is bound to a JavaScript property.
    <form id="form">
        <input type="text" id="field" />
    </form>
    <div id="console"></div>
</body>
</html>