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

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: remove log msg Created 8 years, 5 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..70fc0f03655787a9d19361c7182c69d50922520f 100644
--- a/chrome/browser/ui/panels/old_base_panel_browser_test.cc
+++ b/chrome/browser/ui/panels/old_base_panel_browser_test.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/ui/panels/panel_browser_window.h"
#include "chrome/browser/ui/panels/panel_manager.h"
#include "chrome/browser/ui/panels/panel_mouse_watcher.h"
+#include "chrome/browser/ui/panels/test_panel_active_state_observer.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
@@ -248,14 +249,8 @@ void OldBasePanelBrowserTest::WaitForPanelActiveState(
Panel* panel, ActiveState expected_state) {
DCHECK(expected_state == SHOW_AS_ACTIVE ||
expected_state == SHOW_AS_INACTIVE);
- ui_test_utils::WindowedNotificationObserver signal(
- chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS,
- content::Source<Panel>(panel));
- if (panel->IsActive() == (expected_state == SHOW_AS_ACTIVE))
- return; // Already in required state.
+ PanelActiveStateObserver signal(panel, expected_state == SHOW_AS_ACTIVE);
signal.Wait();
- // Verify that transition happened in the desired direction.
- EXPECT_TRUE(panel->IsActive() == (expected_state == SHOW_AS_ACTIVE));
}
void OldBasePanelBrowserTest::WaitForWindowSizeAvailable(Panel* panel) {
@@ -346,6 +341,10 @@ Panel* OldBasePanelBrowserTest::CreatePanelWithParams(
// 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
« no previous file with comments | « chrome/browser/ui/panels/detached_panel_browsertest.cc ('k') | chrome/browser/ui/panels/old_detached_panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698