| 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
|
|
|