Chromium Code Reviews| Index: ash/launcher/launcher_view_unittest.cc |
| diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc |
| index 468e8f90084654723b5192595bddfa11253627b6..e99c76900749aaeedbcd06cbba97a8c3690a70a1 100644 |
| --- a/ash/launcher/launcher_view_unittest.cc |
| +++ b/ash/launcher/launcher_view_unittest.cc |
| @@ -220,6 +220,12 @@ class LauncherViewTest : public AshTestBase { |
| return id; |
| } |
| + LauncherID AddPanel() { |
| + LauncherID id = AddPanelNoWait(); |
| + test_api_->RunMessageLoopUntilAnimationsDone(); |
| + return id; |
| + } |
| + |
| LauncherID AddPlatformAppNoWait() { |
| LauncherItem item; |
| item.type = TYPE_PLATFORM_APP; |
| @@ -230,6 +236,16 @@ class LauncherViewTest : public AshTestBase { |
| return id; |
| } |
| + LauncherID AddPanelNoWait() { |
| + LauncherItem item; |
| + item.type = TYPE_APP_PANEL; |
| + item.status = STATUS_RUNNING; |
| + |
| + LauncherID id = model_->next_id(); |
| + model_->Add(item); |
| + return id; |
| + } |
| + |
| LauncherID AddPlatformApp() { |
| LauncherID id = AddPlatformAppNoWait(); |
| test_api_->RunMessageLoopUntilAnimationsDone(); |
| @@ -370,6 +386,51 @@ TEST_F(LauncherViewTest, AddAppShortcutWithBrowserButtonUntilOverflow) { |
| EXPECT_FALSE(GetButtonByID(browser_button_id)->visible()); |
| } |
| +TEST_F(LauncherViewTest, AddPanelHidesTabbedBrowser) { |
| + ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, |
| + test_api_->GetButtonCount()); |
| + |
| + // Add tabbed browser until overflow, remember last visible tabbed browser. |
| + LauncherID first_added = AddTabbedBrowser(); |
| + EXPECT_TRUE(GetButtonByID(first_added)->visible()); |
| + LauncherID last_visible = first_added; |
| + while (true) { |
| + LauncherID added = AddTabbedBrowser(); |
| + if (test_api_->IsOverflowButtonVisible()) { |
| + EXPECT_FALSE(GetButtonByID(added)->visible()); |
| + break; |
| + } |
| + last_visible = added; |
|
stevenjb
2012/11/26 18:19:21
We should add something like:
++items_added;
ASSER
flackr
2012/11/27 18:40:21
Done. And the other instances of this in the file.
|
| + } |
| + |
| + LauncherID panel = AddPanel(); |
| + EXPECT_TRUE(GetButtonByID(panel)->visible()); |
| + EXPECT_FALSE(GetButtonByID(last_visible)->visible()); |
| + |
| + RemoveByID(panel); |
| + EXPECT_TRUE(GetButtonByID(last_visible)->visible()); |
| +} |
| + |
| +TEST_F(LauncherViewTest, PanelsHideLast) { |
| + ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, |
| + test_api_->GetButtonCount()); |
| + |
| + // Add tabbed browser. |
| + LauncherID browser = AddTabbedBrowser(); |
| + LauncherID first_panel = AddPanel(); |
| + |
| + EXPECT_TRUE(GetButtonByID(browser)->visible()); |
| + EXPECT_TRUE(GetButtonByID(first_panel)->visible()); |
| + |
| + LauncherID last_panel = first_panel; |
| + while (!test_api_->IsOverflowButtonVisible()) |
| + last_panel = AddPanel(); |
|
stevenjb
2012/11/26 18:19:21
Same here.
flackr
2012/11/27 18:40:21
Done.
|
| + |
| + EXPECT_TRUE(GetButtonByID(last_panel)->visible()); |
| + EXPECT_TRUE(GetButtonByID(first_panel)->visible()); |
| + EXPECT_FALSE(GetButtonByID(browser)->visible()); |
| +} |
| + |
| // Adds button until overflow then removes first added one. Verifies that |
| // the last added one changes from invisible to visible and overflow |
| // chevron is gone. |
| @@ -379,7 +440,7 @@ TEST_F(LauncherViewTest, RemoveButtonRevealsOverflowed) { |
| test_api_->GetButtonCount()); |
| // Add tabbed browser until overflow. |
| - LauncherID first_added= AddTabbedBrowser(); |
| + LauncherID first_added = AddTabbedBrowser(); |
| LauncherID last_added = first_added; |
| while (!test_api_->IsOverflowButtonVisible()) |
| last_added = AddTabbedBrowser(); |