Index: chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc |
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc |
index 0a158f956834d300c3562bb39a3173327356b720..11380bcd6e7a213dd7596b72c6df601d882123c8 100644 |
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc |
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc |
@@ -196,13 +196,21 @@ TEST_F(AppInfoDialogViewsTest, UninstallingOtherAppDoesNotCloseDialog) { |
// Tests that the dialog closes when the current profile is destroyed. |
TEST_F(AppInfoDialogViewsTest, DestroyedProfileClosesDialog) { |
ShowAppInfo(kTestExtensionId); |
+ |
// First delete the test browser window. This ensures the test harness isn't |
// surprised by it being closed in response to the profile deletion below. |
- // Note the base class doesn't own the profile, so that part is skipped. |
- DestroyBrowserAndProfile(); |
+ std::unique_ptr<Browser> browser(release_browser()); |
+ browser->tab_strip_model()->CloseAllTabs(); |
+ browser.reset(); |
+ std::unique_ptr<BrowserWindow> browser_window(release_browser_window()); |
+ browser_window->Close(); |
+ browser_window.reset(); |
+ |
+ // This does not actually destroy the profile; see DestroyProfile above. |
+ DestroyProfile(profile()); |
// The following does nothing: it just ensures the Widget close is being |
- // triggered by the DeleteProfile() call rather than the line above. |
+ // triggered by the DeleteProfile() call rather than the code above. |
base::RunLoop().RunUntilIdle(); |
ASSERT_TRUE(widget_); |