Stop browser_tests leaving an open Explorer window

This change stops browser_tests from leaving a file explorer window
open after it completes.

Currently, browser test `DownloadExtensionTest.DownloadsShowFunction`
tests the "Show in Folder" functionality by opening a file explorer
window, but has no way to close this window after it completes. This
results in a stray file-explorer window. At times, the stray window
may also come with an error popup if the temp directory it points to
has already been deleted.

With this change, the call to open the file explorer is skipped if
shell operations have been disabled for testing. The call is skipped
as late as possible, in order to exercise as much of the code as
possible.

Change-Id: If015143d98a3e7e5d4a6bce958780fce6fa63f32
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339599
Reviewed-by: David Trainor <[email protected]>
Commit-Queue: Jesse McKenna <[email protected]>
Cr-Commit-Position: refs/heads/master@{#796626}
diff --git a/chrome/browser/platform_util_internal.h b/chrome/browser/platform_util_internal.h
index 3c6f02c..372ad40 100644
--- a/chrome/browser/platform_util_internal.h
+++ b/chrome/browser/platform_util_internal.h
@@ -24,6 +24,9 @@
 // Prevent shell or external applications from being invoked during testing.
 void DisableShellOperationsForTesting();
 
+// Returns false if DisableShellOperationsForTesting() has been called.
+bool AreShellOperationsAllowed();
+
 }  // namespace internal
 }  // namespace platform_util