OLD | NEW |
---|---|
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 Loading... | |
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() { | |
yurys
2014/10/16 07:43:44
style: { should go on the next line.
aandrey
2014/10/16 09:01:38
This is a function argument, so it should not. I v
| |
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(); | |
yurys
2014/10/16 07:43:44
Why do we need to call done here?
aandrey
2014/10/16 09:01:38
It will report error to console, should the promis
| |
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> |
OLD | NEW |