OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
4 <script src="../../http/tests/inspector/console-test.js"></script> | |
5 <script> | |
6 function test() | |
7 { | |
8 InspectorTest.evaluateInConsole("\ | |
9 function foo()\n\ | |
10 {\n\ | |
11 throw 1;\n\ | |
12 }\n\ | |
13 function boo()\n\ | |
14 {\n\ | |
15 foo();\n\ | |
16 }\n\ | |
17 boo();", afterEvaluate); | |
18 | |
19 function afterEvaluate() | |
20 { | |
21 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
| |
22 | |
23 var viewMessages = WebInspector.ConsolePanel._view()._visibleViewMessage s; | |
24 var uiMessage = viewMessages[viewMessages.length - 1]; | |
25 var message = uiMessage.consoleMessage(); | |
26 var stackTrace = message.stackTrace; | |
27 | |
28 InspectorTest.assertGreaterOrEqual(stackTrace.length, 3, 'Not complete s tack trace'); | |
29 assertStackFrame(stackTrace[0], {functionName: "foo", lineNumber: 4, url : ""}); | |
30 assertStackFrame(stackTrace[1], {functionName: "boo", lineNumber: 8, url : ""}); | |
31 assertStackFrame(stackTrace[2], {functionName: "", lineNumber: 10, url: ""}); | |
32 | |
33 InspectorTest.completeTest(); | |
34 } | |
35 | |
36 function assertStackFrame(actual, expected) | |
37 { | |
38 InspectorTest.assertEquals(expected.functionName, actual.functionName, ' bad frame function name'); | |
39 InspectorTest.assertEquals(expected.lineNumber, actual.lineNumber, 'bad frame line number'); | |
40 InspectorTest.assertEquals(expected.url, actual.url, 'bad frame url'); | |
41 } | |
42 } | |
43 | |
44 </script> | |
45 </head> | |
46 <body onload="runTest()"> | |
47 <p> | |
48 Tests that evaluating an expression with an exception in the console provide cor rect exception information. | |
49 </p> | |
50 </body> | |
51 </html> | |
OLD | NEW |