Reland "Add support for launching webcam software for use in recipes"

This is a reland of cd469a4ce5315fee62bb77b5e781a18a99da506d
With vpython specified

Original change's description:
> Add support for launching webcam software for use in recipes
>
> * Copy ensure_webcam_is_running.py from recipes repo
> * Turn it into a wrapper that can launch another script
>   (fix_python_path is copied from test_env.py as _ForcePythonInterpreter)
> * Support it in mb.py
> * Add it to video_capture_unittests
>
> No-Try: True
> Bug: chromium:755660
> Change-Id: I376724a77e443620724add7818592e9368d02079
> Reviewed-on: https://webrtc-review.googlesource.com/77320
> Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#23275}

No-Try: True
Bug: chromium:755660
Change-Id: Ibf4fbe3fea4b003a23b12332b3a6078a2db99a8d
Reviewed-on: https://webrtc-review.googlesource.com/77460
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23279}
diff --git a/tools_webrtc/mb/mb_unittest.py b/tools_webrtc/mb/mb_unittest.py
index 6dea9b8..fa86b1f 100755
--- a/tools_webrtc/mb/mb_unittest.py
+++ b/tools_webrtc/mb/mb_unittest.py
@@ -374,6 +374,7 @@
     command = isolate_file_contents['variables']['command']
 
     self.assertEqual(files, [
+        '../../.vpython',
         '../../testing/test_env.py',
         '../../third_party/gtest-parallel/gtest-parallel',
         '../../third_party/gtest-parallel/gtest_parallel.py',
@@ -456,6 +457,7 @@
     command = isolate_file_contents['variables']['command']
 
     self.assertEqual(files, [
+        '../../.vpython',
         '../../testing/test_env.py',
         'base_unittests',
     ])
@@ -493,6 +495,7 @@
     command = isolate_file_contents['variables']['command']
 
     self.assertEqual(files, [
+        '../../.vpython',
         '../../testing/test_env.py',
         '../../third_party/gtest-parallel/gtest-parallel',
         '../../third_party/gtest-parallel/gtest_parallel.py',
@@ -541,6 +544,7 @@
     command = isolate_file_contents['variables']['command']
 
     self.assertEqual(files, [
+        '../../.vpython',
         '../../testing/test_env.py',
         '../../testing/xvfb.py',
         '../../third_party/gtest-parallel/gtest-parallel',
@@ -592,6 +596,7 @@
     command = isolate_file_contents['variables']['command']
 
     self.assertEqual(files, [
+        '../../.vpython',
         '../../testing/test_env.py',
         '../../third_party/gtest-parallel/gtest-parallel',
         '../../third_party/gtest-parallel/gtest_parallel.py',
@@ -639,6 +644,7 @@
     command = isolate_file_contents['variables']['command']
 
     self.assertEqual(files, [
+        '../../.vpython',
         '../../testing/test_env.py',
         '../../third_party/gtest-parallel/gtest-parallel',
         '../../third_party/gtest-parallel/gtest_parallel.py',
@@ -687,6 +693,7 @@
     command = isolate_file_contents['variables']['command']
 
     self.assertEqual(files, [
+        '../../.vpython',
         '../../testing/test_env.py',
         '../../tools_webrtc/valgrind/webrtc_tests.sh',
         'base_unittests',
@@ -711,6 +718,58 @@
         '--tsan=0',
     ])
 
+  def test_isolate_test_launcher_with_webcam(self):
+    test_files = {
+      '/tmp/swarming_targets': 'base_unittests\n',
+      '/fake_src/testing/buildbot/gn_isolate_map.pyl': (
+          "{'base_unittests': {"
+          "  'label': '//base:base_unittests',"
+          "  'type': 'console_test_launcher',"
+          "  'use_webcam': True,"
+          "}}\n"
+      ),
+      '/fake_src/out/Default/base_unittests.runtime_deps': (
+          "base_unittests\n"
+          "some_resource_file\n"
+      ),
+    }
+    mbw = self.check(['gen', '-c', 'debug_goma', '//out/Default',
+                      '--swarming-targets-file', '/tmp/swarming_targets',
+                      '--isolate-map-file',
+                      '/fake_src/testing/buildbot/gn_isolate_map.pyl'],
+                     files=test_files, ret=0)
+
+    isolate_file = mbw.files['/fake_src/out/Default/base_unittests.isolate']
+    isolate_file_contents = ast.literal_eval(isolate_file)
+    files = isolate_file_contents['variables']['files']
+    command = isolate_file_contents['variables']['command']
+
+    self.assertEqual(files, [
+        '../../.vpython',
+        '../../testing/test_env.py',
+        '../../third_party/gtest-parallel/gtest-parallel',
+        '../../third_party/gtest-parallel/gtest_parallel.py',
+        '../../tools_webrtc/ensure_webcam_is_running.py',
+        '../../tools_webrtc/gtest-parallel-wrapper.py',
+        'base_unittests',
+        'some_resource_file',
+    ])
+    self.assertEqual(command, [
+        '../../tools_webrtc/ensure_webcam_is_running.py',
+        '../../testing/test_env.py',
+        '../../tools_webrtc/gtest-parallel-wrapper.py',
+        '--output_dir=${ISOLATED_OUTDIR}/test_logs',
+        '--gtest_color=no',
+        '--timeout=900',
+        '--retry_failed=3',
+        './base_unittests',
+        '--',
+        '--asan=0',
+        '--lsan=0',
+        '--msan=0',
+        '--tsan=0',
+    ])
+
   def test_isolate(self):
     files = {
       '/fake_src/out/Default/toolchain.ninja': "",