summaryrefslogtreecommitdiffstats
path: root/ash/wm/panel_layout_manager_unittest.cc
diff options
context:
space:
mode:
authorflackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 05:33:29 +0000
committerflackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 05:33:29 +0000
commit5b602190c3a6b949cfb74157e8b7c1ecf61bed36 (patch)
treea9a140196363fac1152c1520c57a7111c8787084 /ash/wm/panel_layout_manager_unittest.cc
parent9c233029a88b2b529a119f951361cb803987d5c1 (diff)
downloadchromium_src-5b602190c3a6b949cfb74157e8b7c1ecf61bed36.zip
chromium_src-5b602190c3a6b949cfb74157e8b7c1ecf61bed36.tar.gz
chromium_src-5b602190c3a6b949cfb74157e8b7c1ecf61bed36.tar.bz2
Create a separate callout widget per panel which displays over each icon.
BUG=162960 TEST=PanelManagerLayoutTest.MinimizeRestorePanel, PanelManagerLayoutTest.MultiplePanelCallout, RootWindowControllerTest.MoveWindows_Basic Review URL: https://chromiumcodereview.appspot.com/12282046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/panel_layout_manager_unittest.cc')
-rw-r--r--ash/wm/panel_layout_manager_unittest.cc38
1 files changed, 21 insertions, 17 deletions
diff --git a/ash/wm/panel_layout_manager_unittest.cc b/ash/wm/panel_layout_manager_unittest.cc
index 9a3c218..48170f7 100644
--- a/ash/wm/panel_layout_manager_unittest.cc
+++ b/ash/wm/panel_layout_manager_unittest.cc
@@ -72,12 +72,16 @@ class PanelLayoutManagerTest : public test::AshTestBase {
internal::kShellWindowId_PanelContainer);
}
- void GetCalloutWidget(views::Widget** widget) {
+ void GetCalloutWidgetForPanel(aura::Window* panel, views::Widget** widget) {
PanelLayoutManager* manager =
static_cast<PanelLayoutManager*>(GetPanelContainer()->layout_manager());
- ASSERT_TRUE(manager);
- ASSERT_TRUE(manager->callout_widget());
- *widget = manager->callout_widget();
+ DCHECK(manager);
+ PanelLayoutManager::PanelList::iterator found = std::find(
+ manager->panel_windows_.begin(), manager->panel_windows_.end(),
+ panel);
+ DCHECK(found != manager->panel_windows_.end());
+ DCHECK(found->callout_widget);
+ *widget = found->callout_widget;
}
void PanelInScreen(aura::Window* panel) {
@@ -127,7 +131,7 @@ class PanelLayoutManagerTest : public test::AshTestBase {
// Flush the message loop, since callout updates use a delayed task.
MessageLoop::current()->RunUntilIdle();
views::Widget* widget = NULL;
- GetCalloutWidget(&widget);
+ GetCalloutWidgetForPanel(panel, &widget);
Launcher* launcher = Launcher::ForPrimaryDisplay();
gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(panel);
@@ -141,9 +145,9 @@ class PanelLayoutManagerTest : public test::AshTestBase {
1);
}
- bool IsCalloutVisible() {
+ bool IsPanelCalloutVisible(aura::Window* panel) {
views::Widget* widget = NULL;
- GetCalloutWidget(&widget);
+ GetCalloutWidgetForPanel(panel, &widget);
return widget->IsVisible();
}
@@ -238,7 +242,10 @@ TEST_F(PanelLayoutManagerTest, MultiplePanelCallout) {
scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds));
scoped_ptr<aura::Window> w3(CreatePanelWindow(bounds));
scoped_ptr<aura::Window> w4(CreateNormalWindow());
- EXPECT_FALSE(IsCalloutVisible());
+ launcher_view_test()->RunMessageLoopUntilAnimationsDone();
+ EXPECT_TRUE(IsPanelCalloutVisible(w1.get()));
+ EXPECT_TRUE(IsPanelCalloutVisible(w2.get()));
+ EXPECT_TRUE(IsPanelCalloutVisible(w3.get()));
wm::ActivateWindow(w1.get());
EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w1.get()));
wm::ActivateWindow(w2.get());
@@ -246,14 +253,11 @@ TEST_F(PanelLayoutManagerTest, MultiplePanelCallout) {
wm::ActivateWindow(w3.get());
EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w3.get()));
wm::ActivateWindow(w4.get());
- EXPECT_FALSE(IsCalloutVisible());
wm::ActivateWindow(w3.get());
EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w3.get()));
w3.reset();
if (views::corewm::UseFocusController())
EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(w2.get()));
- else
- EXPECT_FALSE(IsCalloutVisible());
}
// Tests removing panels.
@@ -359,20 +363,20 @@ TEST_F(PanelLayoutManagerTest, MinimizeRestorePanel) {
// Activate the window, ensure callout is visible.
wm::ActivateWindow(window.get());
RunAllPendingInMessageLoop();
- EXPECT_TRUE(IsCalloutVisible());
+ EXPECT_TRUE(IsPanelCalloutVisible(window.get()));
// Minimize the panel, callout should be hidden.
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
RunAllPendingInMessageLoop();
- EXPECT_FALSE(IsCalloutVisible());
- // Restore the pantel; panel should not be activated by default and callout
- // should be hidden.
+ EXPECT_FALSE(IsPanelCalloutVisible(window.get()));
+ // Restore the pantel; panel should not be activated by default but callout
+ // should be visible.
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
RunAllPendingInMessageLoop();
- EXPECT_FALSE(IsCalloutVisible());
+ EXPECT_TRUE(IsPanelCalloutVisible(window.get()));
// Activate the window, ensure callout is visible.
wm::ActivateWindow(window.get());
RunAllPendingInMessageLoop();
- EXPECT_TRUE(IsCalloutVisible());
+ EXPECT_TRUE(IsPanelCalloutVisible(window.get()));
}
TEST_F(PanelLayoutManagerTest, PanelMoveBetweenMultipleDisplays) {