Index: chrome/browser/ui/panels/base_panel_browser_test.cc |
diff --git a/chrome/browser/ui/panels/base_panel_browser_test.cc b/chrome/browser/ui/panels/base_panel_browser_test.cc |
index 764a9e4ce8e6abd7d8238d0b6c792806bc6d5371..1edc5bcec9575962801c6da4d83916cfd8ad5a52 100644 |
--- a/chrome/browser/ui/panels/base_panel_browser_test.cc |
+++ b/chrome/browser/ui/panels/base_panel_browser_test.cc |
@@ -328,14 +328,16 @@ Panel* BasePanelBrowserTest::CreatePanelWithParams( |
} |
if (params.wait_for_fully_created) { |
- MessageLoopForUI::current()->RunAllPending(); |
- |
#if defined(OS_LINUX) |
// On bots, we might have a simple window manager which always activates new |
// windows, and can't always deactivate them. Re-activate the main tabbed |
// browser to "deactivate" the newly created panel. |
if (params.expected_active_state == SHOW_AS_INACTIVE && |
ui::GuessWindowManager() == ui::WM_ICE_WM) { |
+ // Wait for new panel to become active before deactivating to ensure |
+ // the activated notification is consumed before we wait for the panel |
+ // to become inactive. |
+ WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); |
browser()->window()->Activate(); |
} |
#endif |