Handle dedicated, service, and shared workers

This CL is the second patch of a 6-sided patch involving the CTS,
Chrome, and Dawn. Here, we add code to handle tests with
?worker=dedicated, ?worker=shared, and ?worker=service URL parameters

Bug: chromium:330596242
Change-Id: Ie5b5467cd01be7d5bdec853516397b2c3009bd2a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/178780
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Fr <beaufort.francois@gmail.com>
diff --git a/webgpu-cts/test_runner.js b/webgpu-cts/test_runner.js
index 26729ff..7c31712 100644
--- a/webgpu-cts/test_runner.js
+++ b/webgpu-cts/test_runner.js
@@ -35,7 +35,7 @@
 import { parseSearchParamLikeWithCTSOptions } from '../third_party/webgpu-cts/src/common/runtime/helper/options.js';
 import { setDefaultRequestAdapterOptions } from '../third_party/webgpu-cts/src/common/util/navigator_gpu.js';
 
-import { TestWorker } from '../third_party/webgpu-cts/src/common/runtime/helper/test_worker.js';
+import { TestWorker, TestDedicatedWorker, TestSharedWorker, TestServiceWorker } from '../third_party/webgpu-cts/src/common/runtime/helper/test_worker.js';
 
 // The Python-side websockets library has a max payload size of 72638. Set the
 // max allowable logs size in a single payload to a bit less than that.
@@ -179,6 +179,14 @@
   const { queries, options } = parseSearchParamLikeWithCTSOptions(queryString);
   const workerEnabled = use_worker || options.worker;
   const worker = workerEnabled ? new TestWorker(options) : undefined;
+  const dedicatedWorker =
+    options.worker === "dedicated"
+      ? new TestDedicatedWorker(options)
+      : undefined;
+  const sharedWorker =
+    options.worker === "shared" ? new TestSharedWorker(options) : undefined;
+  const serviceWorker =
+    options.worker === "service" ? new TestServiceWorker(options) : undefined;
 
   const loader = new DefaultTestFileLoader();
   const filterQuery = parseQuery(queries[0]);
@@ -217,6 +225,12 @@
     beginHeartbeatScope();
     if (worker) {
       await worker.run(rec, name, expectations);
+    } else if (dedicatedWorker) {
+      await dedicatedWorker.run(rec, name, expectations);
+    } else if (sharedWorker) {
+      await sharedWorker.run(rec, name, expectations);
+    } else if (serviceWorker) {
+      await serviceWorker.run(rec, name, expectations);
     } else {
       await testcase.run(rec, expectations);
     }