Index: chrome/test/base/in_process_browser_test.cc |
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc |
index 2ee8c81231817fb77b3bafcb5c6bce35426edf8f..96f521b12bfb8a73f2b18e500d480eca98ad2eb3 100644 |
--- a/chrome/test/base/in_process_browser_test.cc |
+++ b/chrome/test/base/in_process_browser_test.cc |
@@ -19,6 +19,7 @@ |
#include "base/thread_task_runner_handle.h" |
#include "base/threading/non_thread_safe.h" |
#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/lifetime/application_lifetime.h" |
#include "chrome/browser/net/net_error_tab_helper.h" |
#include "chrome/browser/profiles/profile.h" |
@@ -382,6 +383,32 @@ void InProcessBrowserTest::TearDown() { |
BrowserTestBase::TearDown(); |
} |
+void InProcessBrowserTest::CloseBrowserSynchronously(Browser* browser) { |
+ content::WindowedNotificationObserver observer( |
+ chrome::NOTIFICATION_BROWSER_CLOSED, |
+ content::Source<Browser>(browser)); |
+ CloseBrowserAsynchronously(browser); |
+ observer.Wait(); |
+} |
+ |
+void InProcessBrowserTest::CloseBrowserAsynchronously(Browser* browser) { |
+ browser->window()->Close(); |
+#if defined(OS_MACOSX) |
+ // BrowserWindowController depends on the auto release pool being recycled |
+ // in the message loop to delete itself. |
+ AutoreleasePool()->Recycle(); |
+#endif |
+} |
+ |
+void InProcessBrowserTest::CloseAllBrowsers() { |
+ chrome::CloseAllBrowsers(); |
+#if defined(OS_MACOSX) |
+ // BrowserWindowController depends on the auto release pool being recycled |
+ // in the message loop to delete itself. |
+ AutoreleasePool()->Recycle(); |
+#endif |
+} |
+ |
// TODO(alexmos): This function should expose success of the underlying |
// navigation to tests, which should make sure navigations succeed when |
// appropriate. See https://crbug.com/425335 |