Fix logic for selecting test worker type; build service worker files

Previously options.worker would always be truthy for any non-empty
worker= value, so workerEnabled would always be truthy, so `worker`
would always be created, so the sharedWorker/serviceWorker paths would
never be hit.

Since we were not running the service worker tests this also revealed we
didn't have the files for them. Updates the build step to generate them.
This will work once the CTS change rolls in to load them from the
correct place: https://github.com/gpuweb/cts/pull/3599

Also, simplifies some logic and cleans up some unused code, as a
follow-up to https://dawn-review.googlesource.com/c/dawn/+/178780 .
In test_page.html, add a fake favicon to silence favicon.ico 404 errors.

Bug: chromium:330596242, chromium:332934824
Change-Id: I55690a0959edafeab90a0535ac4e96b83c970c42
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/182540
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
diff --git a/third_party/gn/webgpu-cts/BUILD.gn b/third_party/gn/webgpu-cts/BUILD.gn
index e0a77a2..8236785 100644
--- a/third_party/gn/webgpu-cts/BUILD.gn
+++ b/third_party/gn/webgpu-cts/BUILD.gn
@@ -50,7 +50,7 @@
 js_outputs = []
 foreach(ts_file, filter_exclude(list_from_ts_sources_txt, [ "*.d.ts" ])) {
   js_file = string_replace(ts_file, ".ts", ".js")
-  js_node_file = string_replace(js_file, "src/", "src-node/")
+  js_node_file = string_replace(js_file, "src/", "src-node/", 1)
 
   js_outputs += [ "$target_gen_dir/../../webgpu-cts/$js_file" ]
 
@@ -62,6 +62,15 @@
     js_outputs += [ "$target_gen_dir/../../webgpu-cts/$js_node_file" ]
   }
 }
+foreach(ts_file,
+        filter_include(list_from_ts_sources_txt, [ "src/webgpu/*.spec.ts" ])) {
+  worker_js_file =
+      string_replace(string_replace(ts_file, ".spec.ts", ".worker.js"),
+                     "src/webgpu/",
+                     "src/webgpu/webworker/",
+                     1)
+  js_outputs += [ "$target_gen_dir/../../webgpu-cts/$worker_js_file" ]
+}
 
 action("compile_src") {
   script = "${dawn_root}/webgpu-cts/scripts/compile_src.py"