chromium/third_party/blink/web_tests/fast/dom/Window/element-constructors-to-string.html

<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>
    test(function() {
        assert_equals(HTMLElement.toString(), "function HTMLElement() { [native code] }");
        assert_equals(HTMLElement.toString, Function.prototype.toString);
    }, "HTMLElement.toString should be Function.prototype.toString");

    test(function() {
        assert_equals(HTMLElement.toString.toString(), "function toString() { [native code] }");
        assert_equals(HTMLElement.toString.toString, Function.prototype.toString);
    }, "HTMLElement.toString.toString should be Function.prototype.toString");

    HTMLElement.toString.toString = function() { return "foobar"; }

    test(function() {
        assert_equals(HTMLElement.toString.toString(), "foobar");
        assert_equals(HTMLElement.toString(), "function HTMLElement() { [native code] }");
        assert_equals(HTMLElement.toString, Function.prototype.toString);
    }, "After changing HTMLElement.toString.toString, HTMLElement.toString should still be Function.prototype.toString");

    test(function() {
        assert_equals(HTMLDivElement.toString.toString(), "foobar");
        assert_equals(HTMLDivElement.toString(), "function HTMLDivElement() { [native code] }");
        assert_equals(HTMLDivElement.toString, Function.prototype.toString);
    }, "After changing HTMLElement.toString.toString, HTMLDivElement.toString should still be Function.prototype.toString");
</script>