| Index: LayoutTests/inspector/tracing/worker-js-profile.html
|
| diff --git a/LayoutTests/inspector/tracing/worker-events.html b/LayoutTests/inspector/tracing/worker-js-profile.html
|
| similarity index 57%
|
| copy from LayoutTests/inspector/tracing/worker-events.html
|
| copy to LayoutTests/inspector/tracing/worker-js-profile.html
|
| index aea4430c27e93e89edcfdbd7d44682faede97c1d..49891759a52c288b3c7f6d7e8bde221e7434b6bc 100644
|
| --- a/LayoutTests/inspector/tracing/worker-events.html
|
| +++ b/LayoutTests/inspector/tracing/worker-js-profile.html
|
| @@ -28,6 +28,7 @@ function startWorkerAndRunTest()
|
|
|
| function startSecondWorker(onActionComplete)
|
| {
|
| + // FIXME: add a payload to the worker to make it produce a JSFrame.
|
| worker2 = new Worker("resources/worker.js");
|
| worker2.postMessage("");
|
| worker2.onmessage = function(event)
|
| @@ -39,30 +40,30 @@ function startSecondWorker(onActionComplete)
|
|
|
| function test()
|
| {
|
| - InspectorTest.invokeWithTracing("startSecondWorker", processTracingEvents);
|
| + InspectorTest.invokeWithTracing("startSecondWorker", processTracingEvents,
|
| + "disabled-by-default-devtools.timeline.stack", true);
|
|
|
| - var workerMetadataEventCount = 0;
|
| + var seenFunctions = new Set();
|
| function processTracingEvents()
|
| {
|
| - InspectorTest.tracingModel().sortedProcesses().forEach(function(process) {
|
| - process.sortedThreads().forEach(function(thread) {
|
| - thread.events().forEach(processEvent);
|
| - });
|
| - });
|
| - InspectorTest.assertEquals(2, workerMetadataEventCount);
|
| + InspectorTest.addResult("Main thread");
|
| + InspectorTest.tracingTimelineModel()._mainThreadEvents.forEach(processEvent);
|
| + var threads = InspectorTest.tracingTimelineModel()._virtualThreads;
|
| + for (var i = 0; i < threads.length; ++i) {
|
| + InspectorTest.addResult(threads[i].name);
|
| + threads[i].events.forEach(processEvent);
|
| + }
|
| + InspectorTest.assertTrue(seenFunctions.has("startSecondWorker"));
|
| + InspectorTest.assertTrue(seenFunctions.has("worker2.onmessage"));
|
| InspectorTest.completeTest();
|
| }
|
|
|
| function processEvent(event)
|
| {
|
| - if (event.category !== WebInspector.TracingModel.DevToolsMetadataEventCategory || event.name !== WebInspector.TracingModel.DevToolsMetadataEvent.TracingSessionIdForWorker)
|
| + if (event.name !== WebInspector.TimelineModel.RecordType.JSFrame)
|
| return;
|
| -
|
| - ++workerMetadataEventCount;
|
| - InspectorTest.assertEquals(InspectorTest.tracingModel().sessionId(), event.args["data"]["sessionId"]);
|
| - InspectorTest.addResult("Got DevTools worker metadata event(" + workerMetadataEventCount + "): " + event.name);
|
| + seenFunctions.add(event.args.data.functionName);
|
| }
|
| -
|
| }
|
|
|
| </script>
|
| @@ -70,7 +71,7 @@ function test()
|
|
|
| <body onload="startWorkerAndRunTest()">
|
| <p>
|
| -Tests that worker events are recorded with proper devtools metadata events.
|
| +Tests js cpu profile in timeline.
|
| </p>
|
| </body>
|
| </html>
|
|
|