[fuchsia] Rewrite runner templates to use cleaner primitives.

Test runner and TUF installation rules are rewritten to make use of
the "fuchsia_run_script_with_packages" template, which adds package
handling to wrapper script generation and little else.

Adds a new target "chrome_fuchsia_runner", which deploys and executes
the standalone Chrome executable on a device.

Test runner script generation is relocated from testing/test.gni to
reduce clutter in that BUILD.gn file.

Bug: 1256870
Change-Id: I23058a8bc1b59b1be3dae79bb986d6efee72b680
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3206480
Commit-Queue: Kevin Marshall <[email protected]>
Reviewed-by: Chong Gu <[email protected]>
Reviewed-by: Greg Thompson <[email protected]>
Reviewed-by: Andrey Kosyakov <[email protected]>
Reviewed-by: Dirk Pranke <[email protected]>
Reviewed-by: danakj <[email protected]>
Reviewed-by: Robert Kroeger <[email protected]>
Cr-Commit-Position: refs/heads/main@{#932266}
diff --git a/testing/test.gni b/testing/test.gni
index d88d26c..47f01a30 100644
--- a/testing/test.gni
+++ b/testing/test.gni
@@ -398,39 +398,43 @@
     # |target_name| refers to the package-runner rule, so that building
     # "base_unittests" will build not only the executable, component, and
     # package, but also the script required to run them.
-    fuchsia_package_runner(target_name) {
-      is_test_exe = true
+    fuchsia_test_runner(target_name) {
       forward_variables_from(invoker,
                              [
-                               "use_run_test_component",
-                               "use_test_server",
+                               "data",
+                               "data_deps",
                                "package_deps",
-                               "visibility",
+                               "use_test_server",
                              ])
-      runner_script = "//build/fuchsia/test_runner.py"
+
       package = ":$_pkg_target"
-      package_name_override = _output_name
+      package_name = _output_name
 
-      if (tests_have_location_tags) {
-        data = [ "//testing/location_tags.json" ]
+      if (!defined(deps)) {
+        deps = []
       }
-      data_deps = [ "//testing/buildbot/filters:fuchsia_filters" ]
+      if (defined(invoker.deps)) {
+        deps += invoker.deps
+      }
 
+      if (!defined(data)) {
+        data = []
+      }
+      if (tests_have_location_tags) {
+        data += [ "//testing/location_tags.json" ]
+      }
+
+      if (!defined(data_deps)) {
+        data_deps = []
+      }
       if (use_rts) {
-        data_deps += [ ":${invoker.target_name}__rts_filters" ]
+        data_deps += [ ":${target_name}__rts_filters" ]
       }
     }
 
     executable(_exec_target) {
       forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
       output_name = _exec_target
-
-      if (use_rts) {
-        if (!defined(data_deps)) {
-          data_deps = []
-        }
-        data_deps += [ ":${invoker.target_name}__rts_filters" ]
-      }
     }
   } else if (is_ios) {
     assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb)