Chromium Code Reviews| Index: LayoutTests/inspector/console/console-eval-exception-report.html |
| diff --git a/LayoutTests/inspector/console/console-eval-exception-report.html b/LayoutTests/inspector/console/console-eval-exception-report.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9bd11d2e8089f3b14412aad4d6526ea89d506fb3 |
| --- /dev/null |
| +++ b/LayoutTests/inspector/console/console-eval-exception-report.html |
| @@ -0,0 +1,51 @@ |
| +<html> |
| +<head> |
| +<script src="../../http/tests/inspector/inspector-test.js"></script> |
| +<script src="../../http/tests/inspector/console-test.js"></script> |
| +<script> |
| +function test() |
| +{ |
| + InspectorTest.evaluateInConsole("\ |
| + function foo()\n\ |
| + {\n\ |
| + throw 1;\n\ |
| + }\n\ |
| + function boo()\n\ |
| + {\n\ |
| + foo();\n\ |
| + }\n\ |
| + boo();", afterEvaluate); |
| + |
| + function afterEvaluate() |
| + { |
| + InspectorTest.dumpConsoleMessages(); |
|
aandrey
2014/07/17 10:10:05
you could expand console messages first, and then
kozyatinskiy1
2014/07/17 12:27:23
I don't want dump all stack trace, because stack c
aandrey
2014/07/17 12:31:58
Yes, to avoid you can use InspectorTest.evaluateIn
|
| + |
| + var viewMessages = WebInspector.ConsolePanel._view()._visibleViewMessages; |
| + var uiMessage = viewMessages[viewMessages.length - 1]; |
| + var message = uiMessage.consoleMessage(); |
| + var stackTrace = message.stackTrace; |
| + |
| + InspectorTest.assertGreaterOrEqual(stackTrace.length, 3, 'Not complete stack trace'); |
| + assertStackFrame(stackTrace[0], {functionName: "foo", lineNumber: 4, url: ""}); |
| + assertStackFrame(stackTrace[1], {functionName: "boo", lineNumber: 8, url: ""}); |
| + assertStackFrame(stackTrace[2], {functionName: "", lineNumber: 10, url: ""}); |
| + |
| + InspectorTest.completeTest(); |
| + } |
| + |
| + function assertStackFrame(actual, expected) |
| + { |
| + InspectorTest.assertEquals(expected.functionName, actual.functionName, 'bad frame function name'); |
| + InspectorTest.assertEquals(expected.lineNumber, actual.lineNumber, 'bad frame line number'); |
| + InspectorTest.assertEquals(expected.url, actual.url, 'bad frame url'); |
| + } |
| +} |
| + |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p> |
| +Tests that evaluating an expression with an exception in the console provide correct exception information. |
| +</p> |
| +</body> |
| +</html> |