1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_output_04.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,120 @@ 1.4 +/* 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.7 + */ 1.8 + 1.9 +// Test the webconsole output for various types of objects. 1.10 + 1.11 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-04.html"; 1.12 + 1.13 +let inputTests = [ 1.14 + // 0 1.15 + { 1.16 + input: "testTextNode()", 1.17 + output: '#text "hello world!"', 1.18 + printOutput: "[object Text]", 1.19 + inspectable: true, 1.20 + noClick: true, 1.21 + }, 1.22 + 1.23 + // 1 1.24 + { 1.25 + input: "testCommentNode()", 1.26 + output: /<!--\s+- Any copyright /, 1.27 + printOutput: "[object Comment]", 1.28 + inspectable: true, 1.29 + noClick: true, 1.30 + }, 1.31 + 1.32 + // 2 1.33 + { 1.34 + input: "testDocumentFragment()", 1.35 + output: 'DocumentFragment [ <div#foo1.bar>, <div#foo3> ]', 1.36 + printOutput: "[object DocumentFragment]", 1.37 + inspectable: true, 1.38 + variablesViewLabel: "DocumentFragment[2]", 1.39 + }, 1.40 + 1.41 + // 3 1.42 + { 1.43 + input: "testError()", 1.44 + output: "TypeError: window.foobar is not a function\n" + 1.45 + "Stack trace:\n" + 1.46 + "testError@" + TEST_URI + ":44", 1.47 + printOutput: '"TypeError: window.foobar is not a function"', 1.48 + inspectable: true, 1.49 + variablesViewLabel: "TypeError", 1.50 + }, 1.51 + 1.52 + // 4 1.53 + { 1.54 + input: "testDOMException()", 1.55 + output: 'DOMException [SyntaxError: "An invalid or illegal string was specified"', 1.56 + printOutput: '[Exception... "An invalid or illegal string was specified"', 1.57 + inspectable: true, 1.58 + variablesViewLabel: "SyntaxError", 1.59 + }, 1.60 + 1.61 + // 5 1.62 + { 1.63 + input: "testCSSStyleDeclaration()", 1.64 + output: 'CSS2Properties { color: "green", font-size: "2em" }', 1.65 + printOutput: "[object CSS2Properties]", 1.66 + inspectable: true, 1.67 + noClick: true, 1.68 + }, 1.69 + 1.70 + // 6 1.71 + { 1.72 + input: "testStyleSheetList()", 1.73 + output: "StyleSheetList [ CSSStyleSheet ]", 1.74 + printOutput: "[object StyleSheetList", 1.75 + inspectable: true, 1.76 + variablesViewLabel: "StyleSheetList[1]", 1.77 + }, 1.78 + 1.79 + // 7 1.80 + { 1.81 + input: "document.styleSheets[0]", 1.82 + output: "CSSStyleSheet", 1.83 + printOutput: "[object CSSStyleSheet]", 1.84 + inspectable: true, 1.85 + }, 1.86 + 1.87 + // 8 1.88 + { 1.89 + input: "document.styleSheets[0].cssRules", 1.90 + output: "CSSRuleList [ CSSStyleRule, CSSMediaRule ]", 1.91 + printOutput: "[object CSSRuleList", 1.92 + inspectable: true, 1.93 + variablesViewLabel: "CSSRuleList[2]", 1.94 + }, 1.95 + 1.96 + // 9 1.97 + { 1.98 + input: "document.styleSheets[0].cssRules[0]", 1.99 + output: 'CSSStyleRule "p, div"', 1.100 + printOutput: "[object CSSStyleRule", 1.101 + inspectable: true, 1.102 + variablesViewLabel: "CSSStyleRule", 1.103 + }, 1.104 + 1.105 + // 10 1.106 + { 1.107 + input: "document.styleSheets[0].cssRules[1]", 1.108 + output: 'CSSMediaRule "print"', 1.109 + printOutput: "[object CSSMediaRule", 1.110 + inspectable: true, 1.111 + variablesViewLabel: "CSSMediaRule", 1.112 + }, 1.113 +]; 1.114 + 1.115 +function test() { 1.116 + addTab(TEST_URI); 1.117 + browser.addEventListener("load", function onLoad() { 1.118 + browser.removeEventListener("load", onLoad, true); 1.119 + openConsole().then((hud) => { 1.120 + return checkOutputForInputs(hud, inputTests); 1.121 + }).then(finishTest); 1.122 + }, true); 1.123 +}