| <html> | |
| <head> | |
| <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| <script src="../../http/tests/inspector/console-test.js"></script> | |
| <script> | |
| // Global Values | |
| var globals = []; | |
| function onload() | |
| { | |
| console.log('Message format number %i, %d and %f', 1, 2, 3.5); | |
| console.log('Message %s for %s', 'format', 'string'); | |
| console.log('Object %o', {'foo' : 'bar' }); | |
| var array = ["test", "test2"]; array.length = 10; | |
| array.foo = {}; | |
| array[4] = "test4"; | |
| console.log(array); | |
| console.log("%o", array); | |
| console.log("%O", array); | |
| // Populate Globals | |
| var regex1 = /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i; | |
| var regex2 = new RegExp("foo\\\\bar\\sbaz", "i"); | |
| var str = "test"; | |
| var str2 = "test named \"test\""; | |
| var error = new Error; | |
| var node = document.getElementById("p"); | |
| var func = function() { return 1; }; | |
| var multilinefunc = function() { | |
| return 2; | |
| }; | |
| var num = 1.2e-1; | |
| var linkify = "http://webkit.org/"; | |
| var valuelessAttribute = document.createAttribute("attr"); | |
| var valuedAttribute = document.createAttribute("attr"); | |
| valuedAttribute.value = "value"; | |
| var existingAttribute = document.getElementById("x").attributes[0]; | |
| var throwingLengthGetter = {get length() { throw "Length called"; }}; | |
| globals = [ | |
| regex1, regex2, str, str2, error, node, func, multilinefunc, num, linkify, | |
| null, undefined, valuelessAttribute, valuedAttribute, existingAttribute, throwingLengthGetter, | |
| NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, array | |
| ]; | |
| runTest(); | |
| } | |
| function log(current) | |
| { | |
| console.log(globals[current]); | |
| console.log([globals[current]]); | |
| } | |
| function test() | |
| { | |
| InspectorTest.evaluateInPage("globals.length", loopOverGlobals.bind(this, 0)); | |
| function loopOverGlobals(current, total) | |
| { | |
| function advance() | |
| { | |
| var next = current + 1; | |
| if (next == total.description) { | |
| InspectorTest.expandConsoleMessages(); | |
| InspectorTest.dumpConsoleMessages(); | |
| InspectorTest.completeTest(); | |
| } else | |
| loopOverGlobals(next, total); | |
| } | |
| InspectorTest.evaluateInPage("log(" + current + ")"); | |
| InspectorTest.runAfterPendingDispatches(evalInConsole); | |
| function evalInConsole() | |
| { | |
| InspectorTest.evaluateInConsole("globals[" + current + "]"); | |
| InspectorTest.runAfterPendingDispatches(advance); | |
| } | |
| } | |
| } | |
| </script> | |
| </head> | |
| <body onload="onload()"> | |
| <div id="x"></div> | |
| <p id="p">Tests that console logging dumps proper messages.</p> | |
| </body> | |
| </html> |