Prepare the code to inherit from chromium's mb.py (3rd attempt).

Basically try to make low_bandwidth_audio_perf_test target work with chromium's mb.

Bug: webrtc:13867
Change-Id: If111e2b0f4f82935062d6321f4d16cc72c77d572
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256975
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Cr-Commit-Position: refs/heads/main@{#36364}
diff --git a/audio/BUILD.gn b/audio/BUILD.gn
index 17dcdce..5e51699 100644
--- a/audio/BUILD.gn
+++ b/audio/BUILD.gn
@@ -284,12 +284,6 @@
       if (is_mac) {
         data += [ "../tools_webrtc/audio_quality/mac/pesq" ]
       }
-
-      if (is_win) {
-        write_runtime_deps = "${root_out_dir}/${target_name}.exe.runtime_deps"
-      } else {
-        write_runtime_deps = "${root_out_dir}/${target_name}.runtime_deps"
-      }
     }
   }
 
diff --git a/tools_webrtc/mb/gn_isolate_map.pyl b/tools_webrtc/mb/gn_isolate_map.pyl
index 9948a45..02e8478 100644
--- a/tools_webrtc/mb/gn_isolate_map.pyl
+++ b/tools_webrtc/mb/gn_isolate_map.pyl
@@ -68,7 +68,7 @@
   },
   "low_bandwidth_audio_perf_test": {
     "label": "//audio:low_bandwidth_audio_perf_test",
-    "type": "console_test_launcher",
+    "type": "script",
     "script": "//audio/test/low_bandwidth_audio_test.py",
     "args": [
       ".", "--remove",
diff --git a/tools_webrtc/mb/mb.py b/tools_webrtc/mb/mb.py
index 01f4914..82fac8a 100755
--- a/tools_webrtc/mb/mb.py
+++ b/tools_webrtc/mb/mb.py
@@ -723,12 +723,13 @@
 
     android = 'target_os="android"' in vals['gn_args']
     for target in swarming_targets:
+      label = isolate_map[target]['label']
+      stamp_runtime_deps = 'obj/%s.stamp.runtime_deps' % label.replace(':', '/')
       if android:
         # Android targets may be either android_apk or executable. The
         # former will result in runtime_deps associated with the stamp
         # file, while the latter will result in runtime_deps associated
         # with the executable.
-        label = isolate_map[target]['label']
         runtime_deps_targets = [
             target + '.runtime_deps',
             'obj/%s.stamp.runtime_deps' % label.replace(':', '/')
@@ -739,12 +740,11 @@
         else:
           runtime_deps_targets = ['browser_tests.runtime_deps']
       elif isolate_map[target]['type'] == 'script':
-        label = isolate_map[target]['label'].split(':')[1]
-        runtime_deps_targets = ['%s.runtime_deps' % label]
+        runtime_deps_targets = [stamp_runtime_deps]
         if self.platform == 'win32':
-          runtime_deps_targets += [label + '.exe.runtime_deps']
+          runtime_deps_targets += [target + '.exe.runtime_deps']
         else:
-          runtime_deps_targets += [label + '.runtime_deps']
+          runtime_deps_targets += [target + '.runtime_deps']
       elif self.platform == 'win32':
         runtime_deps_targets = [target + '.exe.runtime_deps']
       else:
diff --git a/tools_webrtc/mb/mb_unittest.py b/tools_webrtc/mb/mb_unittest.py
index a79186a..d8a6452a 100755
--- a/tools_webrtc/mb/mb_unittest.py
+++ b/tools_webrtc/mb/mb_unittest.py
@@ -461,7 +461,7 @@
          "  'type': 'script',"
          "  'script': '//base/base_unittests_script.py',"
          "}}\n"),
-        '/fake_src/out/Default/base_unittests.runtime_deps':
+        '/fake_src/out/Default/base_unittests_script.runtime_deps':
         ("base_unittests\n"
          "base_unittests_script.py\n"),
     }