[bazel] Infra-PerCommit-Test-Bazel-Local: Make Puppeteer tests work.

This CL makes Puppeteer tests work when running Bazel locally (i.e. not on RBE) on a Swarming bot, as is the case with the Infra-PerCommit-Test-Bazel-Local tryjob, introduced in a follow-up CL: https://skia-review.googlesource.com/c/buildbot/+/373131.

Bug: skia:11111
Change-Id: I45621701baba2584eff79354ea4809bb578fe484
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/373759
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
diff --git a/puppeteer-tests/util.ts b/puppeteer-tests/util.ts
index 9829a8e..71c97ae 100644
--- a/puppeteer-tests/util.ts
+++ b/puppeteer-tests/util.ts
@@ -93,14 +93,21 @@
 export const inBazel = () => !!process.env.BAZEL_WORKSPACE;
 
 /**
- * Launches a Puppeteer browser with the right platform-specific arguments.
+ * Launches a Puppeteer browser.
  */
 export const launchBrowser = () => puppeteer.launch(
-  // See
+  // These options are required to run Puppeteer from within a Docker container, as is the case
+  // under Bazel and RBE. See
   // https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker.
-  exports.inDocker()
-    ? { args: ['--disable-dev-shm-usage', '--no-sandbox'] }
-    : {},
+  //
+  // Flag --no-sandbox is necessary to run Puppeteer tests under Bazel locally (i.e. not on RBE) on
+  // a Swarming bot. If we do not provide said flag, we get the following error:
+  //
+  //     No usable sandbox! Update your kernel or see
+  //     https://chromium.googlesource.com/chromium/src/+/master/docs/linux/suid_sandbox_development.md
+  //     for more information on developing with the SUID sandbox. If you want to live dangerously
+  //     and need an immediate workaround, you can try using --no-sandbox.
+  { args: ['--disable-dev-shm-usage', '--no-sandbox'] },
 );
 
 /**