[tools][run-cts] Use absolute path in serveDir

This fixes the `chrome` subcommand when using a non-default CTS
directory.

Change-Id: Ia3728129a30e48d7973e626fc606cdcd61778ea0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/182640
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
diff --git a/tools/src/cmd/run-cts/chrome/cmd.go b/tools/src/cmd/run-cts/chrome/cmd.go
index 4d97d2d..7a62f60 100644
--- a/tools/src/cmd/run-cts/chrome/cmd.go
+++ b/tools/src/cmd/run-cts/chrome/cmd.go
@@ -197,9 +197,9 @@
 	handler.HandleFunc("/test_page.html", serveFile("webgpu-cts/test_page.html"))
 	handler.HandleFunc("/test_runner.js", serveFile("webgpu-cts/test_runner.js"))
 	handler.HandleFunc("/third_party/webgpu-cts/resources/",
-		serveDir("/third_party/webgpu-cts/resources/", "third_party/webgpu-cts/out/resources/"))
+		serveDir("/third_party/webgpu-cts/resources/", c.flags.CTS+"/out/resources/"))
 	handler.HandleFunc("/third_party/webgpu-cts/src/",
-		serveDir("/third_party/webgpu-cts/src/", "third_party/webgpu-cts/out/"))
+		serveDir("/third_party/webgpu-cts/src/", c.flags.CTS+"/out/"))
 	handler.HandleFunc("/", websocket.Handler(func(ws *websocket.Conn) {
 		go func() {
 			d := json.NewDecoder(ws)
@@ -336,9 +336,8 @@
 }
 
 func serveDir(remote, local string) func(http.ResponseWriter, *http.Request) {
-	dawnRoot := fileutils.DawnRoot()
 	return func(w http.ResponseWriter, r *http.Request) {
-		fullPath := filepath.Join(dawnRoot, local, strings.TrimPrefix(r.URL.Path, remote))
+		fullPath := filepath.Join(local, strings.TrimPrefix(r.URL.Path, remote))
 		if !fileutils.IsFile(fullPath) {
 			log.Printf("'%v' file does not exist", fullPath)
 		}