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

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

Issue 2208963002: [DevTools] Removed InspectorTest.invokeFunctionInPageAsync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-promise-from-other-tests
Patch Set: Created 4 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
OLDNEW
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 var callback;
31 var promise = new Promise((fulfill) => callback = fulfill);
30 worker2 = new Worker("resources/worker.js"); 32 worker2 = new Worker("resources/worker.js");
31 worker2.postMessage(""); 33 worker2.postMessage("");
32 worker2.onmessage = function(event) 34 worker2.onmessage = function(event)
33 { 35 {
34 onActionComplete(); 36 callback();
35 worker2.onmessage = null; 37 worker2.onmessage = null;
36 } 38 }
39 return promise;
caseq 2016/08/05 17:56:43 return new Promise(fulfill => worker2.onmessage =
kozy 2016/08/10 01:21:15 Done.
37 } 40 }
38 41
39 function test() 42 function test()
40 { 43 {
41 InspectorTest.invokeWithTracing("startSecondWorker", InspectorTest.safeWrap( processTracingEvents)); 44 InspectorTest.invokeWithTracing("startSecondWorker", InspectorTest.safeWrap( processTracingEvents));
42 45
43 var workerMetadataEventCount = 0; 46 var workerMetadataEventCount = 0;
44 function processTracingEvents() 47 function processTracingEvents()
45 { 48 {
46 InspectorTest.tracingModel().sortedProcesses().forEach(function(process) { 49 InspectorTest.tracingModel().sortedProcesses().forEach(function(process) {
(...skipping 19 matching lines...) Expand all
66 69
67 </script> 70 </script>
68 </head> 71 </head>
69 72
70 <body onload="startWorkerAndRunTest()"> 73 <body onload="startWorkerAndRunTest()">
71 <p> 74 <p>
72 Tests that worker events are recorded with proper devtools metadata events. 75 Tests that worker events are recorded with proper devtools metadata events.
73 </p> 76 </p>
74 </body> 77 </body>
75 </html> 78 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698