Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../inspector-test.js"></script> | 3 <script src="../../inspector-test.js"></script> |
| 4 <script src="../../timeline-test.js"></script> | 4 <script src="../../timeline-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function performActions(callback) | 7 function performActions() |
| 8 { | 8 { |
| 9 var callback; | |
| 10 var promise = new Promise((fulfill) => callback = fulfill); | |
| 9 var ws = new WebSocket("ws://127.0.0.1:8880/simple"); | 11 var ws = new WebSocket("ws://127.0.0.1:8880/simple"); |
| 10 ws.onclose = callback; | 12 ws.onclose = callback; |
|
caseq
2016/08/10 22:44:55
return new Promise(fulfill => ws.onclose = fulfill
kozy
2016/08/11 01:34:16
Done.
| |
| 13 return promise; | |
| 11 } | 14 } |
| 12 | 15 |
| 13 function test() | 16 function test() |
| 14 { | 17 { |
| 15 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 18 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
| 16 | 19 |
| 17 function finish() | 20 function finish() |
| 18 { | 21 { |
| 19 InspectorTest.printTimelineRecordsWithDetails("WebSocketCreate"); | 22 InspectorTest.printTimelineRecordsWithDetails("WebSocketCreate"); |
| 20 InspectorTest.printTimelineRecordsWithDetails("WebSocketSendHandshakeReq uest"); | 23 InspectorTest.printTimelineRecordsWithDetails("WebSocketSendHandshakeReq uest"); |
| 21 InspectorTest.printTimelineRecordsWithDetails("WebSocketReceiveHandshake Response"); | 24 InspectorTest.printTimelineRecordsWithDetails("WebSocketReceiveHandshake Response"); |
| 22 InspectorTest.printTimelineRecordsWithDetails("WebSocketDestroy"); | 25 InspectorTest.printTimelineRecordsWithDetails("WebSocketDestroy"); |
| 23 InspectorTest.completeTest(); | 26 InspectorTest.completeTest(); |
| 24 } | 27 } |
| 25 } | 28 } |
| 26 | 29 |
| 27 if (!window.testRunner) | 30 if (!window.testRunner) |
| 28 setTimeout(performActions, 2000); | 31 setTimeout(performActions, 2000); |
| 29 | 32 |
| 30 </script> | 33 </script> |
| 31 </head> | 34 </head> |
| 32 | 35 |
| 33 <body onload="runTest()"> | 36 <body onload="runTest()"> |
| 34 <p> | 37 <p> |
| 35 Tests the Timeline events for WebSocket | 38 Tests the Timeline events for WebSocket |
| 36 </p> | 39 </p> |
| 37 | 40 |
| 38 </body> | 41 </body> |
| 39 </html> | 42 </html> |
| OLD | NEW |