Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: LayoutTests/inspector/console/console-eval-exception-report.html

Issue 369333002: DevTools: Added error message when the command is invoked from the console with exception (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add-evaluate-exception-details
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698