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

Unified Diff: chrome/browser/ui/panels/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/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..dfc2c3159862cfbadffa0e0c35ea0a11f246f1a3 100644
--- a/chrome/browser/ui/panels/base_panel_browser_test.cc
+++ b/chrome/browser/ui/panels/base_panel_browser_test.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/ui/panels/native_panel.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"
@@ -246,14 +247,8 @@ void BasePanelBrowserTest::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 BasePanelBrowserTest::WaitForWindowSizeAvailable(Panel* panel) {
@@ -336,6 +331,10 @@ Panel* BasePanelBrowserTest::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/base_panel_browser_test.h ('k') | chrome/browser/ui/panels/detached_panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698