| 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 var worker; | 7 var worker; |
| 8 | 8 |
| 9 function createPromise() | 9 function createPromise() |
| 10 { | 10 { |
| 11 worker = new Worker("resources/worker-with-defer-handled-promise.js"); | 11 worker = new Worker("resources/worker-with-defer-handled-promise.js"); |
| 12 } | 12 } |
| 13 | 13 |
| 14 function handlePromiseRejection() | 14 function handlePromiseRejection() |
| 15 { | 15 { |
| 16 worker.postMessage(""); | 16 worker.postMessage(""); |
| 17 } | 17 } |
| 18 | 18 |
| 19 function test() | 19 function test() |
| 20 { | 20 { |
| 21 SDK.consoleModel.addEventListener(SDK.ConsoleModel.Events.MessageAdded, Insp
ectorTest.wrapListener(messageAdded)); | 21 ConsoleModel.consoleModel.addEventListener(ConsoleModel.ConsoleModel.Events.
MessageAdded, InspectorTest.wrapListener(messageAdded)); |
| 22 SDK.consoleModel.addEventListener(SDK.ConsoleModel.Events.MessageUpdated, In
spectorTest.wrapListener(messageUpdated)); | 22 ConsoleModel.consoleModel.addEventListener(ConsoleModel.ConsoleModel.Events.
MessageUpdated, InspectorTest.wrapListener(messageUpdated)); |
| 23 | 23 |
| 24 InspectorTest.addResult("Creating worker with promise"); | 24 InspectorTest.addResult("Creating worker with promise"); |
| 25 InspectorTest.evaluateInPageWithTimeout("createPromise()"); | 25 InspectorTest.evaluateInPageWithTimeout("createPromise()"); |
| 26 | 26 |
| 27 function messageAdded(event) | 27 function messageAdded(event) |
| 28 { | 28 { |
| 29 InspectorTest.addResult(""); | 29 InspectorTest.addResult(""); |
| 30 InspectorTest.addResult("Message added: " + event.data.level + " " + eve
nt.data.type); | 30 InspectorTest.addResult("Message added: " + event.data.level + " " + eve
nt.data.type); |
| 31 | 31 |
| 32 if (event.data.level === SDK.ConsoleMessage.MessageLevel.Error) { | 32 if (event.data.level === ConsoleModel.ConsoleMessage.MessageLevel.Error)
{ |
| 33 InspectorTest.dumpConsoleCounters(); | 33 InspectorTest.dumpConsoleCounters(); |
| 34 InspectorTest.addResult(""); | 34 InspectorTest.addResult(""); |
| 35 InspectorTest.addResult("Handling promise"); | 35 InspectorTest.addResult("Handling promise"); |
| 36 InspectorTest.evaluateInPageWithTimeout("handlePromiseRejection()"); | 36 InspectorTest.evaluateInPageWithTimeout("handlePromiseRejection()"); |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 function messageUpdated() | 40 function messageUpdated() |
| 41 { | 41 { |
| 42 InspectorTest.dumpConsoleCounters(); | 42 InspectorTest.dumpConsoleCounters(); |
| 43 InspectorTest.completeTest(); | 43 InspectorTest.completeTest(); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 </script> | 47 </script> |
| 48 </head> | 48 </head> |
| 49 | 49 |
| 50 <body onload="runTest()"> | 50 <body onload="runTest()"> |
| 51 <p>Tests that console revokes lazily handled promise rejections.</p> | 51 <p>Tests that console revokes lazily handled promise rejections.</p> |
| 52 | 52 |
| 53 </body> | 53 </body> |
| 54 </html> | 54 </html> |
| OLD | NEW |