Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: LayoutTests/inspector/timeline/tracing/worker-events.html

Issue 477153005: DevTools: adopt existing Timeline tests for tracing based Timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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>
7
8 function startWorkerAndRunTest()
9 {
10 var worker1 = new Worker("resources/worker.js");
11 worker1.postMessage("");
12
13 if (window.testRunner) {
14 testRunner.dumpAsText();
15 testRunner.waitUntilDone();
16 }
17
18 worker1.onmessage = function(event)
19 {
20 worker1.onmessage = null;
21 runTest();
22 }
23 }
24
25 function startSecondWorker(onActionComplete)
26 {
27 var worker2 = new Worker("resources/worker.js");
28 worker2.postMessage("");
29 worker2.onmessage = function(event)
30 {
31 onActionComplete();
32 worker2.onmessage = null;
33 }
34 }
35
36 function test()
37 {
38 InspectorTest.invokeWithTracing("startSecondWorker", processTracingEvents);
39
40 var workerMetadataEventCount = 0;
41 function processTracingEvents()
42 {
43 InspectorTest.tracingModel.sortedProcesses().forEach(function(process) {
44 process.sortedThreads().forEach(function(thread) {
45 thread.events().forEach(processEvent);
46 });
47 });
48 InspectorTest.assertEquals(2, workerMetadataEventCount);
49 InspectorTest.completeTest();
50 }
51
52 function processEvent(event)
53 {
54 if (event.category !== WebInspector.TracingModel.DevToolsMetadataEventCa tegory || event.name !== WebInspector.TracingModel.DevToolsMetadataEvent.Tracing StartedInWorker)
55 return;
56
57 ++workerMetadataEventCount;
58 InspectorTest.assertEquals(InspectorTest.tracingModel.sessionId(), event .args["sessionId"]);
59 InspectorTest.addResult("Got DevTools worker metadata event(" + workerMe tadataEventCount + "): " + event.name);
60 }
61
62 }
63
64 </script>
65 </head>
66
67 <body onload="startWorkerAndRunTest()">
68 <p>
69 Tests that worker events are recorded with proper devtools metadata events.
70 </p>
71 </body>
72 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698