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

Side by Side Diff: LayoutTests/inspector/console/console-uncaught-promise.html

Issue 657063002: Show stack traces in console for unhandled promise rejection messages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed debugger-pause-on-promise-rejection.html test Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script> 4 <script src="../../http/tests/inspector/console-test.js"></script>
5 <script> 5 <script>
6 6
7 function runPromises(source) 7 function runPromises(source)
8 { 8 {
9 Promise.reject(new Error(source + ".err1")) 9 Promise.reject(new Error(source + ".err1"))
10 .then() 10 .then()
(...skipping 15 matching lines...) Expand all
26 }); 26 });
27 reject(new Error(source + ".err2")); 27 reject(new Error(source + ".err2"));
28 } 28 }
29 29
30 function onload() 30 function onload()
31 { 31 {
32 runPromises("onload"); 32 runPromises("onload");
33 runTest(); 33 runTest();
34 } 34 }
35 35
36 function runPromisesFromInspector()
37 {
38 // setTimeout to cut off VM call frames from the stack trace.
39 setTimeout(function timeout() {
40 runPromises("inspector")
41 }, 0);
42 }
43
36 function test() 44 function test()
37 { 45 {
38 InspectorTest.addConsoleViewSniffer(addMessage, true); 46 InspectorTest.addConsoleViewSniffer(checkConsoleMessages, true);
47 WebInspector.console.showPromise().done();
39 48
40 WebInspector.console.showPromise().then(function() { 49 checkConsoleMessages();
41 InspectorTest.evaluateInPage("runPromises('inspector')");
42 });
43 50
44 var count = 0; 51 function checkConsoleMessages()
45 function addMessage(uiMessage)
46 { 52 {
47 if (uiMessage.toString().indexOf("inspector.err") !== -1) 53 var count = InspectorTest.consoleMessagesCount();
48 ++count;
49 if (count === 2) 54 if (count === 2)
55 InspectorTest.evaluateInPage("runPromisesFromInspector()");
56 else if (count === 4)
50 InspectorTest.expandConsoleMessages(dump); 57 InspectorTest.expandConsoleMessages(dump);
51 } 58 }
52 59
53 function dump() 60 function dump()
54 { 61 {
55 // Sort console messages from async Promises to avoid flakiness. 62 InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textConten tWithLineBreaks);
56 var results = InspectorTest.dumpConsoleMessagesIntoArray(false, false, I nspectorTest.textContentWithLineBreaks);
57 results.sort();
58 InspectorTest.addResults(results);
59 InspectorTest.completeTest(); 63 InspectorTest.completeTest();
60 } 64 }
61 } 65 }
62 66
63 </script> 67 </script>
64 </head> 68 </head>
65 69
66 <body onload="onload()"> 70 <body onload="onload()">
67 <p> 71 <p>
68 Tests that uncaught promise rejections are logged into console. 72 Tests that uncaught promise rejections are logged into console.
69 </p> 73 </p>
70 74
71 </body> 75 </body>
72 </html> 76 </html>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/inspector/console-test.js ('k') | LayoutTests/inspector/console/console-uncaught-promise-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698