Load accessibility_test_runner as module

The test runner was previously loaded as a script in the Runtime. To
be able to remove the scripts infrastructure from `module.json`, we have
to port all existing test runners to use `modules`. However, this means
that we are no longer including the test runner implementations in the
`_module.js` bundles that `build_release_applications` builds.

Therefore, we have to copy the sources ourselves to make them once again
available for loading. We update the `module.json` to use `modules`
instead, which then dynamically imports the file. We shouldn't use
`devtools_module` here, as we don't intend to include these files in the
GRD and should not end up in the eventual front_end bundle.

[email protected],[email protected]

Bug: 1105476
Change-Id: I93380510198551d5b303d7ba136d04d0d1f2d4d9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2401163
Commit-Queue: Tim van der Lippe <[email protected]>
Reviewed-by: Jack Franklin <[email protected]>
diff --git a/BUILD.gn b/BUILD.gn
index 8de4da6..83d9fd8 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -12,7 +12,7 @@
 
 devtools_test_files = [
   "//third_party/axe-core/axe.js",
-  "front_end/accessibility_test_runner/AccessibilityPaneTestRunner.js",
+  "front_end/accessibility_test_runner/accessibility_test_runner.js",
   "front_end/accessibility_test_runner/module.json",
   "front_end/application_test_runner/AppcacheTestRunner.js",
   "front_end/application_test_runner/CacheStorageTestRunner.js",
@@ -396,7 +396,10 @@
     "front_end/rollup.config.js",
   ]
 
-  deps = [ "front_end" ]
+  deps = [
+    "front_end",
+    "front_end:legacy_test-resources",
+  ]
 
   inputs = helper_scripts + all_devtools_files + devtools_test_files +
            application_templates + all_worker_entrypoints +
diff --git a/all_devtools_files.gni b/all_devtools_files.gni
index c3c6120..8e5fca6 100644
--- a/all_devtools_files.gni
+++ b/all_devtools_files.gni
@@ -6,7 +6,7 @@
 
 all_devtools_files = [
   "front_end/shell.js",
-  "front_end/accessibility_test_runner/AccessibilityPaneTestRunner.js",
+  "front_end/accessibility_test_runner/accessibility_test_runner.js",
   "front_end/accessibility_test_runner/module.json",
   "front_end/accessibility/accessibilityNode.css",
   "front_end/accessibility/accessibilityProperties.css",
diff --git a/front_end/BUILD.gn b/front_end/BUILD.gn
index 6328ca5..38bd0c6 100644
--- a/front_end/BUILD.gn
+++ b/front_end/BUILD.gn
@@ -101,6 +101,10 @@
   ]
 }
 
+group("legacy_test-resources") {
+  public_deps = [ "accessibility_test_runner:bundle" ]
+}
+
 group("legacy_css") {
   public_deps = [
     "cm:legacy_css",
diff --git a/front_end/accessibility_test_runner/BUILD.gn b/front_end/accessibility_test_runner/BUILD.gn
new file mode 100644
index 0000000..ac6ee18
--- /dev/null
+++ b/front_end/accessibility_test_runner/BUILD.gn
@@ -0,0 +1,9 @@
+# Copyright 2020 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../../scripts/build/ninja/copy.gni")
+
+copy_sources_to_resources("bundle") {
+  sources = [ "accessibility_test_runner.js" ]
+}
diff --git a/front_end/accessibility_test_runner/AccessibilityPaneTestRunner.js b/front_end/accessibility_test_runner/accessibility_test_runner.js
similarity index 100%
rename from front_end/accessibility_test_runner/AccessibilityPaneTestRunner.js
rename to front_end/accessibility_test_runner/accessibility_test_runner.js
diff --git a/front_end/accessibility_test_runner/module.json b/front_end/accessibility_test_runner/module.json
index f841d02..2d136e1 100644
--- a/front_end/accessibility_test_runner/module.json
+++ b/front_end/accessibility_test_runner/module.json
@@ -4,10 +4,10 @@
     "accessibility",
     "elements_test_runner"
   ],
-  "scripts": [
-    "AccessibilityPaneTestRunner.js"
+  "modules": [
+    "accessibility_test_runner.js"
   ],
   "skip_compilation": [
-    "AccessibilityPaneTestRunner.js"
+    "accessibility_test_runner.js"
   ]
 }