Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: chrome/browser/ui/panels/base_panel_browser_test.cc

Issue 10544113: Revert 141690 - Modify old Panel test files and include them in .gyp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/panels/native_panel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/base_panel_browser_test.cc
===================================================================
--- chrome/browser/ui/panels/base_panel_browser_test.cc (revision 141691)
+++ chrome/browser/ui/panels/base_panel_browser_test.cc (working copy)
@@ -330,6 +330,20 @@
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 {
@@ -340,13 +354,9 @@
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) {
- browser()->window()->Activate();
- }
+ // Restore focus where it was. It will deactivate the new panel.
+ if (last_active_browser_to_restore)
+ last_active_browser_to_restore->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
« no previous file with comments | « no previous file | chrome/browser/ui/panels/native_panel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698