<pre id="console"></pre>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    function log(message)
    {
        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
    }

    function test(declaration, expectedColor, expectedPosition, expectedStyle, expectedTextEmphasis)
    {
        if (!expectedTextEmphasis)
            expectedTextEmphasis = "";

        var element = document.createElement("div");
        element.style.cssText = declaration;
        var color = element.style.webkitTextEmphasisColor;
        var position = element.style.webkitTextEmphasisPosition;
        var style = element.style.webkitTextEmphasisStyle;
        var textEmphasis = element.style.webkitTextEmphasis;
        if (color === expectedColor && position === expectedPosition && style === expectedStyle && textEmphasis === expectedTextEmphasis)
            log("PASS: '" + declaration + "' parsed as ['" + color + "', '" + position + "', '" + style + "', '" + textEmphasis + "']");
        else
            log("FAIL: '" + declaration + "' parsed as ['" + color + "', '" + position + "', '" + style + "', '" + textEmphasis + "'] rather than ['" + expectedColor + "', '" + expectedPosition + "', '" + expectedStyle + "', '" + expectedTextEmphasis + "']");
    }

    test('-webkit-text-emphasis-color: initial;', 'initial', '', '');
    test('-webkit-text-emphasis-color: inherit;', 'inherit', '', '');
    test('-webkit-text-emphasis-color: currentcolor;', 'currentcolor', '', '');
    test('-webkit-text-emphasis-color: cyan;', 'cyan', '', '');
    test('-webkit-text-emphasis-color: bold;', '', '', '');
    test('-webkit-text-emphasis-color: 1px;', '', '', '');
    test('-webkit-text-emphasis-color: "cyan";', '', '', '');

    log("");
    test('-webkit-text-emphasis-position: initial;', '', 'initial', '');
    test('-webkit-text-emphasis-position: inherit;', '', 'inherit', '');
    test('-webkit-text-emphasis-position: over;', '', 'over', '');
    test('-webkit-text-emphasis-position: under;', '', 'under', '');
    test('-webkit-text-emphasis-position: right;', '', '', '');
    test('-webkit-text-emphasis-position: left;', '', '', '');
    test('-webkit-text-emphasis-position: right over;', '', 'over right', '');
    test('-webkit-text-emphasis-position: right under;', '', 'under right', '');
    test('-webkit-text-emphasis-position: left over;', '', 'over left', '');
    test('-webkit-text-emphasis-position: left under;', '', 'under left', '');
    test('-webkit-text-emphasis-position: left right under;', '', '', '');
    test('-webkit-text-emphasis-position: left right left;', '', '', '');
    test('-webkit-text-emphasis-position: left under left;', '', '', '');
    test('-webkit-text-emphasis-position: over inherit;', '', '', '');
    test('-webkit-text-emphasis-position: bold;', '', '', '');
    test('-webkit-text-emphasis-position: 1px;', '', '', '');
    test('-webkit-text-emphasis-position: "over";', '', '', '');

    log("");
    test('-webkit-text-emphasis-style: initial;', '', '', 'initial');
    test('-webkit-text-emphasis-style: inherit;', '', '', 'inherit');
    test('-webkit-text-emphasis-style: none;', '', '', 'none');
    test('-webkit-text-emphasis-style: filled;', '', '', 'filled');
    test('-webkit-text-emphasis-style: open;', '', '', 'open');
    test('-webkit-text-emphasis-style: dot;', '', '', 'dot');
    test('-webkit-text-emphasis-style: circle;', '', '', 'circle');
    test('-webkit-text-emphasis-style: double-circle;', '', '', 'double-circle');
    test('-webkit-text-emphasis-style: triangle;', '', '', 'triangle');
    test('-webkit-text-emphasis-style: sesame;', '', '', 'sesame');
    test('-webkit-text-emphasis-style: "cheese";', '', '', '"cheese"');
    test('-webkit-text-emphasis-style: 1px;', '', '', '');
    test('-webkit-text-emphasis-style: red;', '', '', '');

    test('-webkit-text-emphasis-style: open dot;', '', '', 'open dot');
    test('-webkit-text-emphasis-style: dot open;', '', '', 'open dot');
    test('-webkit-text-emphasis-style: dot dot;', '', '', '');
    test('-webkit-text-emphasis-style: open open;', '', '', '');
    test('-webkit-text-emphasis-style: none open;', '', '', '');
    test('-webkit-text-emphasis-style: none none;', '', '', '');
    test('-webkit-text-emphasis-style: "cheese" open;', '', '', '');
    test('-webkit-text-emphasis-style: open "cheese";', '', '', '');

    log("");
    test('-webkit-text-emphasis: initial', 'initial', '', 'initial', 'initial');
    test('-webkit-text-emphasis: inherit', 'inherit', '', 'inherit', 'inherit');
    test('-webkit-text-emphasis: red', 'red', '', 'none', 'red');
    test('-webkit-text-emphasis: "cheese"', 'currentcolor', '', '"cheese"', '"cheese"');
    test('-webkit-text-emphasis: red "cheese"', 'red', '', '"cheese"', '"cheese" red');
    test('-webkit-text-emphasis: "cheese" red', 'red', '', '"cheese"', '"cheese" red');
    test('-webkit-text-emphasis: filled sesame red', 'red', '', 'filled sesame', 'filled sesame red');
    test('-webkit-text-emphasis: red filled sesame', 'red', '', 'filled sesame', 'filled sesame red');
    test('-webkit-text-emphasis: filled red sesame', '', '', '');
    test('-webkit-text-emphasis: red sesame filled', 'red', '', 'filled sesame', 'filled sesame red');
    test('-webkit-text-emphasis: sesame filled red', 'red', '', 'filled sesame', 'filled sesame red');
</script>
