| 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/timeline-test.js"></script> | 4 <script src="../../http/tests/inspector/timeline-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 // Save references to the worker objects to make sure they are not GC'ed. | 7 // Save references to the worker objects to make sure they are not GC'ed. |
| 8 var worker1; | 8 var worker1; |
| 9 var worker2; | 9 var worker2; |
| 10 | 10 |
| 11 function startWorkerAndRunTest() | 11 function startWorkerAndRunTest() |
| 12 { | 12 { |
| 13 worker1 = new Worker("resources/worker.js"); | 13 worker1 = new Worker("resources/worker.js"); |
| 14 worker1.postMessage(""); | 14 worker1.postMessage(""); |
| 15 | 15 |
| 16 if (window.testRunner) { | 16 if (window.testRunner) { |
| 17 testRunner.dumpAsText(); | 17 testRunner.dumpAsText(); |
| 18 testRunner.waitUntilDone(); | 18 testRunner.waitUntilDone(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 worker1.onmessage = function(event) | 21 worker1.onmessage = function(event) |
| 22 { | 22 { |
| 23 worker1.onmessage = null; | 23 worker1.onmessage = null; |
| 24 runTest(); | 24 runTest(); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 function startSecondWorker(onActionComplete) | 28 function startSecondWorker() |
| 29 { | 29 { |
| 30 worker2 = new Worker("resources/worker.js"); | 30 worker2 = new Worker("resources/worker.js"); |
| 31 worker2.postMessage(""); | 31 worker2.postMessage(""); |
| 32 worker2.onmessage = function(event) | 32 return new Promise((fulfill) => worker2.onmessage = fulfill); |
| 33 { | |
| 34 onActionComplete(); | |
| 35 worker2.onmessage = null; | |
| 36 } | |
| 37 } | 33 } |
| 38 | 34 |
| 39 function test() | 35 function test() |
| 40 { | 36 { |
| 41 InspectorTest.invokeWithTracing("startSecondWorker", InspectorTest.safeWrap(
processTracingEvents)); | 37 InspectorTest.invokeWithTracing("startSecondWorker", InspectorTest.safeWrap(
processTracingEvents)); |
| 42 | 38 |
| 43 var workerMetadataEventCount = 0; | 39 var workerMetadataEventCount = 0; |
| 44 function processTracingEvents() | 40 function processTracingEvents() |
| 45 { | 41 { |
| 46 InspectorTest.tracingModel().sortedProcesses().forEach(function(process)
{ | 42 InspectorTest.tracingModel().sortedProcesses().forEach(function(process)
{ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 66 | 62 |
| 67 </script> | 63 </script> |
| 68 </head> | 64 </head> |
| 69 | 65 |
| 70 <body onload="startWorkerAndRunTest()"> | 66 <body onload="startWorkerAndRunTest()"> |
| 71 <p> | 67 <p> |
| 72 Tests that worker events are recorded with proper devtools metadata events. | 68 Tests that worker events are recorded with proper devtools metadata events. |
| 73 </p> | 69 </p> |
| 74 </body> | 70 </body> |
| 75 </html> | 71 </html> |
| OLD | NEW |