Chromium Code Reviews| Index: ash/common/shelf/shelf_window_watcher_unittest.cc |
| diff --git a/ash/common/shelf/shelf_window_watcher_unittest.cc b/ash/common/shelf/shelf_window_watcher_unittest.cc |
| index acf5dc2d04dc86c50e89ca904ecbb14561465dfc..cf59b4fc1289a2880252f0f634609836d630c0ab 100644 |
| --- a/ash/common/shelf/shelf_window_watcher_unittest.cc |
| +++ b/ash/common/shelf/shelf_window_watcher_unittest.cc |
| @@ -268,4 +268,28 @@ TEST_F(ShelfWindowWatcherTest, DragWindow) { |
| EXPECT_EQ(id, model_->items()[index].id); |
| } |
| +// Ensure shelf items are added and removed as panels are opened and closed. |
| +TEST_F(ShelfWindowWatcherTest, PanelWindow) { |
| + // ShelfModel only has an APP_LIST item. |
| + EXPECT_EQ(1, model_->item_count()); |
| + |
| + // Adding windows with valid ShelfItemType properties adds shelf items. |
| + std::unique_ptr<views::Widget> widget1 = |
| + CreateTestWidget(nullptr, kShellWindowId_PanelContainer, gfx::Rect()); |
| + WmWindow* window_1 = WmLookup::Get()->GetWindowForWidget(widget1.get()); |
|
James Cook
2016/11/02 17:53:44
super nit: maybe window1 here or widget_1 above?
msw
2016/11/10 21:07:46
Done.
|
| + window_1->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP_PANEL); |
| + EXPECT_EQ(2, model_->item_count()); |
| + std::unique_ptr<views::Widget> widget2 = |
| + CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); |
| + WmWindow* window_2 = WmLookup::Get()->GetWindowForWidget(widget2.get()); |
| + window_2->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP_PANEL); |
| + EXPECT_EQ(3, model_->item_count()); |
| + |
| + // Each ShelfItem is removed when the associated window is destroyed. |
| + widget1.reset(); |
| + EXPECT_EQ(2, model_->item_count()); |
| + widget2.reset(); |
| + EXPECT_EQ(1, model_->item_count()); |
| +} |
|
James Cook
2016/11/02 17:53:44
Thanks for writing a test.
Is it possible to writ
msw
2016/11/10 21:07:46
I added LauncherPlatformAppBrowserTest.AppPanel, r
|
| + |
| } // namespace ash |