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 52180e76eb72eb10e67844bcd87ce4ffa635102c..a472bfeb38c0fbccf956b53de994976bb8632637 100644 |
--- a/chrome/browser/ui/panels/base_panel_browser_test.cc |
+++ b/chrome/browser/ui/panels/base_panel_browser_test.cc |
@@ -330,20 +330,6 @@ Panel* BasePanelBrowserTest::CreatePanelWithParams( |
EXPECT_TRUE(panel->auto_resizable()); |
} |
-#if defined(OS_LINUX) |
- // On bots, we might have a simple window manager which always activates new |
- // windows, and can't always deactivate them. Keep track of the previously |
- // active window so we can activate that window back to ensure the new window |
- // is inactive. |
- Browser* last_active_browser_to_restore = NULL; |
- if (params.expected_active_state == SHOW_AS_INACTIVE && |
- ui::GuessWindowManager() == ui::WM_ICE_WM) { |
- last_active_browser_to_restore = BrowserList::GetLastActive(); |
- EXPECT_TRUE(last_active_browser_to_restore); |
- EXPECT_NE(last_active_browser_to_restore, panel_browser); |
- } |
-#endif |
- |
if (params.show_flag == SHOW_AS_ACTIVE) { |
panel->Show(); |
} else { |
@@ -354,9 +340,13 @@ Panel* BasePanelBrowserTest::CreatePanelWithParams( |
MessageLoopForUI::current()->RunAllPending(); |
#if defined(OS_LINUX) |
- // Restore focus where it was. It will deactivate the new panel. |
- if (last_active_browser_to_restore) |
- last_active_browser_to_restore->window()->Activate(); |
+ // 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) { |
+ browser()->window()->Activate(); |
+ } |
#endif |
// More waiting, because gaining or losing focus may require inter-process |
// asynchronous communication, and it is not enough to just run the local |