chromium/third_party/blink/web_tests/fast/dom/shadow/form-in-shadow.html

<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<div id="container"></div>

<script>
if (window.testRunner)
    testRunner.waitUntilDone();

function createShadowForm() {
    var container = document.getElementById('container');
    var shadowRoot = container.attachShadow({mode: 'open'});

    shadowRoot.innerHTML =
        '<form>' +
        '    <input type="hidden" name="hidden" value="hidden">' +
        '    <input type="text" name="text" value="text">' +
        '    <input type="checkbox" name="checkbox1" checked>' +
        '    <input type="checkbox" name="checkbox2">' +
        '    <input type="range" name="range" min="0" max="100" value="50">' +
        '    <textarea name="textarea">textarea</textarea>' +
        '    <input id="submit" type="submit">' +
        '</form>';

    return shadowRoot.getElementById('submit');
}

function parseQuery(query) {
    var result = {};
    var nameValues = query.split('&');

    for (var i = 0; i < nameValues.length; ++i) {
        var idx = nameValues[i].indexOf('=');
        var name = nameValues[i].substr(0, idx);
        var value = nameValues[i].substr(idx + 1);

        result[name] = value;
    }

    return result;
}

var obj;
function checkQuery(query) {
    obj = parseQuery(query);

    shouldBe("obj.hidden", "'hidden'");
    shouldBe("obj.text", "'text'");
    shouldBe("obj.checkbox1", "'on'");
    shouldBeUndefined("obj.checkbox2");
    shouldBe("obj.range", "'50'");
    shouldBe("obj.textarea", "'textarea'");
}

var submitButton = createShadowForm();
if (location.href.indexOf('?') > 0) {
    var query = location.href.substr(location.href.indexOf('?') + 1);
    checkQuery(query);

    if (window.testRunner)
        testRunner.notifyDone();
} else {
    submitButton.click();
}

var successfullyParsed = true;
</script>

</body>
</html>