chromium/third_party/blink/web_tests/fast/loader/inherit-charset-to-empty-frame.html

<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
</head>
<body onload="test()">
<p>Test that a programmatically created empty iframe inherits charset from the parent.
<p id=result>
<script type="text/javascript">
if (window.testRunner)
    testRunner.dumpAsText();

function createEmptyIframe() {
   if (!document.getElementById('containerName')) {
        var iframe = document.createElement('IFRAME');
        iframe.setAttribute("id", 'containerName');
        iframe.setAttribute("name", 'containerName');
        iframe.setAttribute("src", "");
        iframe.style.width = '500px';
        iframe.style.height = '100px';
        document.body.appendChild( iframe );
    }
}

function test() {
    createEmptyIframe();
    var iframeCharset = document.getElementById('containerName').contentDocument.characterSet;
    document.getElementById("result").innerHTML =
        iframeCharset == "UTF-8" ? "<p>SUCCESS</p>" : "<p>FAILURE: " + iframeCharset + "</p>";
}
</script>
</body>
</html>