blob: f06a3c0e2d12644ad5f96ea6d6ad56508a6c8914 [file] [log] [blame]
<html>
<head>
<script src="../http/tests/inspector/inspector-test.js"></script>
<script src="../http/tests/inspector/console-tests.js"></script>
<script>
// Global Values
var globals = [];
function doit()
{
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.foo = "bar";
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.body;
var func = function() { return 1; };
var multilinefunc = function() {
return 2;
};
var num = 1.2e-1;
var linkify = "http://webkit.org/";
globals = [regex1, regex2, str, str2, error, node, func, multilinefunc, num, linkify, null, undefined];
loopOverGlobals(0);
}
function loopOverGlobals(current)
{
function advance()
{
var next = current + 1;
if (next == globals.length)
dumpConsoleMessages();
else
loopOverGlobals(next);
}
console.log(globals[current]);
console.log([globals[current]]);
evaluateInWebInspector("frontend_evaluateGlobal", advance);
}
// Frontend functions.
function frontend_evaluateGlobal()
{
window.__next = window.__next || 0;
var current = window.__next++;
var expression = "globals[" + current + "]";
frontend_evalExpression(expression);
}
function frontend_evalExpression(expression)
{
var self = WebInspector.console;
function printResult(result)
{
self.addMessage(new WebInspector.ConsoleCommandResult(result, expression));
}
self.evalInInspectedWindow(expression, "console", printResult);
}
</script>
</head>
<body onload="onload()">
<p>
Tests that console logging dumps proper messages.
</p>
</body>
</html>