Chromium Code Reviews| 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 cb63fb1464cc312a393a082090aa012a62868974..ec65e5d21658819fabd0c66e63860e87942c3002 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" |
| @@ -377,6 +378,30 @@ void InProcessBrowserTest::TearDown() { |
| BrowserTestBase::TearDown(); |
| } |
| +void InProcessBrowserTest::CloseBrowserSynchronously(Browser* browser) { |
| + content::WindowedNotificationObserver observer( |
| + chrome::NOTIFICATION_BROWSER_CLOSED, |
| + content::NotificationService::AllSources()); |
|
Robert Sesek
2015/07/08 22:19:36
May want to limit this to just the |browser| Sourc
|
| + browser->window()->Close(); |
| +#if defined(OS_MACOSX) |
| + // BrowserWindowController depends on the auto release pool being recycled |
| + // in the message loop to delete itself, which frees the Browser object |
| + // which fires this event. |
| + AutoreleasePool()->Recycle(); |
| +#endif |
| + observer.Wait(); |
| +} |
| + |
| +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, which frees the Browser object |
| + // which fires this event. |
| + 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 |