Reland: WebTest: Closing the main window should fallback gracefully.

The revert:
https://chromium-review.googlesource.com/c/chromium/src/+/3002068

The reland: (patchset 1)
https://chromium-review.googlesource.com/c/chromium/src/+/3001312/1

The diff: (Diff patchset 1...n)
Restore the previous behavior where Shell::Shutdown was call automatically.
Introduce Shell::UseManualShutdown() to allow the web_test runner to continue
after the fuzzer/test closed all the windows.

Bug: 1222610,1221183,1225986
Change-Id: I726fc745f9aea22d6e3de21c1f80c274fd00ed23
Fixed: 1222610,1221183,1225986
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3001368
Commit-Queue: Arthur Sonzogni <[email protected]>
Reviewed-by: danakj <[email protected]>
Cr-Commit-Position: refs/heads/master@{#898853}
diff --git a/content/shell/browser/shell_platform_delegate.cc b/content/shell/browser/shell_platform_delegate.cc
index 6fdedb3..5a28c3a 100644
--- a/content/shell/browser/shell_platform_delegate.cc
+++ b/content/shell/browser/shell_platform_delegate.cc
@@ -6,6 +6,7 @@
 
 #include "content/public/browser/javascript_dialog_manager.h"
 #include "content/public/browser/web_contents.h"
+#include "content/shell/browser/shell.h"
 
 namespace content {
 
@@ -13,6 +14,10 @@
     Shell* shell,
     WebContents* web_contents) {}
 
+void ShellPlatformDelegate::DidCloseLastWindow() {
+  Shell::Shutdown();
+}
+
 std::unique_ptr<JavaScriptDialogManager>
 ShellPlatformDelegate::CreateJavaScriptDialogManager(Shell* shell) {
   return nullptr;