chromium/third_party/blink/web_tests/fast/media/media-query-list-syntax.html

<!DOCTYPE html>
<html>
<head>
    <title>Media Query List syntax</title>
    <link rel="author" title="Rune Lillesveen" href="mailto:[email protected]">
    <link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#syntax">
    <script type="text/javascript" src="../../resources/testharness.js"></script>
    <script type="text/javascript" src="../../resources/testharnessreport.js"></script>
    <style id="sheet">/**/</style>
    <script>

        var tests = [
            [ "@media all, not,{}", "all, not all, not all" , "Media query error #1" ],
            [ "@media not and (color), #screen, screen {}", "not all, not all, screen", "Media query error #2" ],
            [ "@media all; @media tv {}", "tv", "Media query error #3" ],
            [ "@media screen and(color), tv {}", "not all, tv", "Media query error #4" ],
            [ "@media tv, all or (nothing) {}", "tv, not all", "Media query error #5" ],
            [ "@media tv, all and (color) tv {}", "tv, not all", "Media query error #6" ]
        ];
        var cdataNode = document.getElementById("sheet").firstChild;
        for (var i=0; i < tests.length; i++) {
            cdataNode.data = tests[i][0];
            if (document.styleSheets[0].cssRules.length > 0 &&
                document.styleSheets[0].cssRules[0].type == 4) {
                result = document.styleSheets[0].cssRules[0].media.mediaText;
            }
            else {
                result = "MEDIA RULE DROPPED!";
            }
            test(function() {
                assert_equals(result, tests[i][1]);
            }, tests[i][2]);
        }
    </script>
</head>
<body>
    <div id="log"></div>
</body>
</html>