Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / tracing / worker-js-profile.html
blob18972405d1ab196e012b2b7341d403baea206f26
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/timeline-test.js"></script>
5 <script src="../tracing-test.js"></script>
6 <script>
8 // Save references to the worker objects to make sure they are not GC'ed.
9 var worker1;
10 var worker2;
12 // The function ensures call stack for the current frame is captured.
13 function makeDOMEvent()
15 var e = document.createElement("div");
16 e.innerHTML = "<p>test</p>";
17 return e.lastChild.textContents;
20 function startWorkerAndRunTest()
22 worker1 = new Worker("resources/worker.js");
23 worker1.postMessage("");
25 if (window.testRunner) {
26 testRunner.dumpAsText();
27 testRunner.waitUntilDone();
30 worker1.onmessage = function(event)
32 worker1.onmessage = null;
33 runTest();
37 function startSecondWorker(onActionComplete)
39 worker2 = new Worker("resources/worker.js");
40 worker2.postMessage("");
41 makeDOMEvent();
42 worker2.onmessage = function(event)
44 worker2.onmessage = null;
45 makeDOMEvent();
46 onActionComplete();
50 function test()
52 InspectorTest.invokeWithTracing("startSecondWorker", processTracingEvents,
53 "disabled-by-default-devtools.timeline.stack", true);
55 function processTracingEvents()
57 var mainThread = { name: "Main Thread", events: InspectorTest.tracingTimelineModel()._mainThreadEvents };
58 processThread(new Set(["startSecondWorker", "worker2.onmessage"]), mainThread);
59 var workers = InspectorTest.tracingTimelineModel()._virtualThreads.filter(function(thread) { return thread.isWorker(); });
60 workers.forEach(processThread.bind(null, new Set(["onmessage"])));
61 InspectorTest.completeTest();
64 function processThread(expectedFunctions, thread)
66 InspectorTest.addResult(thread.name);
67 var missingFunctions = thread.events.reduce(processEvent, expectedFunctions);
68 if (missingFunctions.size) {
69 InspectorTest.addResult("FAIL: missing functions:");
70 missingFunctions.forEach(InspectorTest.addResult);
74 function processEvent(expectedFunctions, event)
76 if (event.name === WebInspector.TimelineModel.RecordType.JSFrame)
77 expectedFunctions.delete(event.args.data.functionName);
78 return expectedFunctions;
82 </script>
83 </head>
85 <body onload="startWorkerAndRunTest()">
86 <p>
87 Tests js cpu profile in timeline.
88 </p>
89 </body>
90 </html>