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

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

Issue 10689082: Fix flaky linux panel tests related to active state checks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up log msgs. Add fix to new tests. 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
Index: chrome/browser/ui/panels/old_base_panel_browser_test.cc
diff --git a/chrome/browser/ui/panels/old_base_panel_browser_test.cc b/chrome/browser/ui/panels/old_base_panel_browser_test.cc
index 41d7c010e015e163f3792d7ea63c1ce929977387..daa1360c57dde4206390c1c7d744405d2e124257 100644
--- a/chrome/browser/ui/panels/old_base_panel_browser_test.cc
+++ b/chrome/browser/ui/panels/old_base_panel_browser_test.cc
@@ -255,7 +255,16 @@ void OldBasePanelBrowserTest::WaitForPanelActiveState(
return; // Already in required state.
signal.Wait();
// Verify that transition happened in the desired direction.
- EXPECT_TRUE(panel->IsActive() == (expected_state == SHOW_AS_ACTIVE));
+ bool expect_active = (expected_state == SHOW_AS_ACTIVE);
+ bool is_active = panel->IsActive();
+ EXPECT_TRUE(expect_active == is_active);
dcheng 2012/07/03 23:04:25 EXPECT_EQ
+ if (expect_active != is_active) {
+ LOG(WARNING) << "Expected active: " << expect_active
dcheng 2012/07/03 23:04:25 Did you mean to print this out in two different fo
+ << (expect_active ? " y" : " n")
+ << " but actual is: " << is_active
+ << (is_active ? " y" : " n")
+ << " for panel: " << panel->app_name();
+ }
}
void OldBasePanelBrowserTest::WaitForWindowSizeAvailable(Panel* panel) {
@@ -338,21 +347,27 @@ Panel* OldBasePanelBrowserTest::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.
+ LOG(INFO) << "waiting for new to be active before deactivating";
+ WaitForPanelActiveState(panel, SHOW_AS_ACTIVE);
+ LOG(INFO) << "got initial active state";
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
// message loop to make sure this activity has completed.
+ LOG(INFO) << "waiting for actual created active state";
WaitForPanelActiveState(panel, params.expected_active_state);
+ LOG(INFO) << "got created active state";
// On Linux, window size is not available right away and we should wait
// before moving forward with the test.

Powered by Google App Engine
This is Rietveld 408576698