Index: chrome/browser/printing/print_preview_dialog_controller_browsertest.cc |
diff --git a/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc b/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc |
index 335becff7f9da01598fb382e25f39bb9a385a78b..ecf843aa0b90eecfee3e37ad9bae014bc0feee0c 100644 |
--- a/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc |
+++ b/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc |
@@ -266,6 +266,11 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, |
chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
content::WaitForLoadStop( |
browser()->tab_strip_model()->GetActiveWebContents()); |
+ // When Widget::Close is called, a task is posted that will destroy the |
+ // widget. Here the widget is closed when the navigation commits. Load stop |
+ // may occur right after the commit, before the widget is destroyed. |
+ // Execute pending tasks to account for this. |
+ base::RunLoop().RunUntilIdle(); |
ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); |
// Try printing again. |