Index: chrome/browser/ui/panels/panel_browsertest.cc |
diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc |
index 379527770f19c13fea93e27e28efc24c36024723..c52f25a4372b914ed6b9bc5da8c99987aa3f5b37 100644 |
--- a/chrome/browser/ui/panels/panel_browsertest.cc |
+++ b/chrome/browser/ui/panels/panel_browsertest.cc |
@@ -52,6 +52,15 @@ class PanelBrowserTest : public BasePanelBrowserTest { |
MessageLoopForUI::current()->RunAllPending(); |
} |
+ void MoveMouseAndWaitForExpansionStateChange(Panel* panel, |
+ const gfx::Point& position) { |
+ ui_test_utils::WindowedNotificationObserver signal( |
+ chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, |
+ content::Source<Panel>(panel)); |
+ MoveMouse(position); |
+ signal.Wait(); |
+ } |
+ |
void TestCreatePanelOnOverflow() { |
PanelManager* panel_manager = PanelManager::GetInstance(); |
EXPECT_EQ(0, panel_manager->num_panels()); // No panels initially. |
@@ -398,14 +407,14 @@ class PanelBrowserTest : public BasePanelBrowserTest { |
// Hover mouse on minimized panel. |
// Verify titlebar is exposed on all panels. |
gfx::Point hover_point(panels[index]->GetBounds().origin()); |
- MoveMouse(hover_point); |
+ MoveMouseAndWaitForExpansionStateChange(panels[index], hover_point); |
EXPECT_EQ(titlebar_exposed_bounds, GetAllPanelBounds()); |
EXPECT_EQ(titlebar_exposed_states, GetAllPanelExpansionStates()); |
// Hover mouse above the panel. Verify all panels are minimized. |
hover_point.set_y( |
panels[index]->GetBounds().y() - kFarEnoughFromHoverArea); |
- MoveMouse(hover_point); |
+ MoveMouseAndWaitForExpansionStateChange(panels[index], hover_point); |
EXPECT_EQ(minimized_bounds, GetAllPanelBounds()); |
EXPECT_EQ(minimized_states, GetAllPanelExpansionStates()); |
@@ -413,7 +422,7 @@ class PanelBrowserTest : public BasePanelBrowserTest { |
// Verify titlebar is exposed on all panels. |
hover_point.set_y(panels[index]->GetBounds().y() + |
panels[index]->GetBounds().height() + 5); |
- MoveMouse(hover_point); |
+ MoveMouseAndWaitForExpansionStateChange(panels[index], hover_point); |
EXPECT_EQ(titlebar_exposed_bounds, GetAllPanelBounds()); |
EXPECT_EQ(titlebar_exposed_states, GetAllPanelExpansionStates()); |
@@ -427,7 +436,7 @@ class PanelBrowserTest : public BasePanelBrowserTest { |
// Hover mouse above panel. Verify all panels are minimized. |
hover_point.set_y( |
panels[index]->GetBounds().y() - kFarEnoughFromHoverArea); |
- MoveMouse(hover_point); |
+ MoveMouseAndWaitForExpansionStateChange(panels[index], hover_point); |
EXPECT_EQ(minimized_bounds, GetAllPanelBounds()); |
EXPECT_EQ(minimized_states, GetAllPanelExpansionStates()); |
} |