Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: LayoutTests/fast/media/mq-parsing.html

Issue 14578010: Fixing inconsistency with the media query spec and other browsers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/media/mq-parsing.html
diff --git a/LayoutTests/fast/media/mq-parsing.html b/LayoutTests/fast/media/mq-parsing.html
new file mode 100644
index 0000000000000000000000000000000000000000..4dda62ad94b452f01ae6062cef3fe545d93957f7
--- /dev/null
+++ b/LayoutTests/fast/media/mq-parsing.html
@@ -0,0 +1,81 @@
+<html>
+<head>
+ <style type="text/css">
+ @media screen {
+ #console { color: black; }
+ }
+ </style>
+ <script>
+ function resultStringifier(result)
+ {
+ if (result === "")
+ return "<b>\"\"</b>";
+ else if (result === undefined)
+ return "<b>undefined</b>";
+ else if (result === null)
+ return "<b>null</b>";
+ return "\"" + result + "\"";
+ }
+
+ function printOut(expect, res) {
+ var console = document.getElementById("console");
+ var span = document.createElement('span');
+
+ var a = resultStringifier(expect);
+ var b = resultStringifier(res);
+ if (a === b)
+ span.innerHTML += "PASS: Got " + b + " as expected.<br>";
+ else
+ span.innerHTML += "FAIL: Got " + b + " but was expecting " + a + "<br>";
+ console.appendChild(span);
+ }
+
+ function runTests() {
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var rules = document.styleSheets[0].cssRules;
+ var mediaList = rules.item(0).media;
+
+ printOut("screen", mediaList.mediaText);
+
+ mediaList.mediaText = null;
+ printOut("", mediaList.mediaText);
+
+ mediaList.mediaText = "screen"
+ mediaList.mediaText = ",,all,,";
+ printOut("not all, not all, all, not all, not all", mediaList.mediaText);
+
+ mediaList.mediaText = ",,all,, ";
+ printOut("not all, not all, all, not all, not all", mediaList.mediaText);
+
+ output = "all";
+ try {
+ mediaList.mediaText = ",screen,,&invalid,,";
+ } catch(e) {
+ output = null;
+ }
+ printOut("not all, screen, not all, not all, not all, not all", mediaList.mediaText);
+
+ output = "all";
+ try {
+ mediaList.mediaText = ",screen,,(invalid,),,";
+ } catch(e) {
+ output = null;
+ }
+ printOut("not all, screen, not all, not all, not all, not all", mediaList.mediaText);
+
+ output = "all";
+ try {
+ mediaList.mediaText = ",(all,),,";
+ } catch(e) {
+ output = null;
+ }
+ printOut("not all, not all, not all, not all", mediaList.mediaText);
+ }
+ </script>
+</head>
+<body onload="runTests()">
+ <div id="console"></div>
+</body>
+</html>
« no previous file with comments | « LayoutTests/fast/media/mq-js-stylesheet-media-02.html ('k') | LayoutTests/fast/media/mq-parsing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698