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

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

Issue 460363002: Record DevTools metadata events on worker threads when starting recoring 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/timeline/tracing/worker-events.html
diff --git a/LayoutTests/inspector/timeline/tracing/worker-events.html b/LayoutTests/inspector/timeline/tracing/worker-events.html
new file mode 100644
index 0000000000000000000000000000000000000000..60560723b0effcd85724d4909eca879eb4b25139
--- /dev/null
+++ b/LayoutTests/inspector/timeline/tracing/worker-events.html
@@ -0,0 +1,72 @@
+<html>
+<head>
+<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../../http/tests/inspector/timeline-test.js"></script>
+<script src="../../tracing-test.js"></script>
+<script>
+
+function startWorkerAndRunTest()
+{
+ var worker1 = new Worker("resources/worker.js");
+ worker1.postMessage("");
+
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ worker1.onmessage = function(event)
+ {
+ worker1.onmessage = null;
+ runTest();
+ }
+}
+
+function startSecondWorker(onActionComplete)
+{
+ var worker2 = new Worker("resources/worker.js");
+ worker2.postMessage("");
+ worker2.onmessage = function(event)
+ {
+ onActionComplete();
+ worker2.onmessage = null;
+ }
+}
+
+function test()
+{
+ InspectorTest.invokeWithTracing("startSecondWorker", processTracingEvents);
+
+ var workerMetadataEventCount = 0;
+ function processTracingEvents()
+ {
+ InspectorTest.tracingModel.sortedProcesses().forEach(function(process) {
+ process.sortedThreads().forEach(function(thread) {
+ thread.events().forEach(processEvent);
+ });
+ });
+ InspectorTest.assertEquals(2, workerMetadataEventCount);
+ InspectorTest.completeTest();
+ }
+
+ function processEvent(event)
+ {
+ if (event.category !== WebInspector.TracingModel.DevToolsMetadataEventCategory || event.name !== WebInspector.TracingModel.DevToolsMetadataEvent.TracingStartedInWorker)
+ return;
+
+ ++workerMetadataEventCount;
+ InspectorTest.assertEquals(InspectorTest.tracingModel.sessionId(), event.args["sessionId"]);
+ InspectorTest.addResult("Got DevTools worker metadata event(" + workerMetadataEventCount + "): " + event.name);
+ }
+
+}
+
+</script>
+</head>
+
+<body onload="startWorkerAndRunTest()">
+<p>
+Tests that worker events are recorded with proper devtools metadata events.
+</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698