Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2201)

Unified Diff: ash/common/shelf/shelf_window_watcher_unittest.cc

Issue 2576023002: Fixes bug where shelf items could be added for children windows (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/shelf/shelf_window_watcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6e772bc347c53cb4821c3bcce195627feabe9dc2..1a8e5ce5babecfdc749df720eed2eb066bc6bff7 100644
--- a/ash/common/shelf/shelf_window_watcher_unittest.cc
+++ b/ash/common/shelf/shelf_window_watcher_unittest.cc
@@ -307,4 +307,30 @@ TEST_F(ShelfWindowWatcherTest, PanelWindow) {
EXPECT_EQ(1, model_->item_count());
}
+TEST_F(ShelfWindowWatcherTest, DontCreateShelfEntriesForChildWindows) {
+ const int initial_item_count = model_->item_count();
+
+ WmWindow* window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_NORMAL,
+ ui::LAYER_NOT_DRAWN);
+ window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP);
+ WmShell::Get()
+ ->GetPrimaryRootWindow()
+ ->GetChildByShellWindowId(kShellWindowId_DefaultContainer)
+ ->AddChild(window);
+ window->Show();
+ EXPECT_EQ(initial_item_count + 1, model_->item_count());
+
+ WmWindow* child_window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_NORMAL,
+ ui::LAYER_NOT_DRAWN);
+ child_window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP);
+ window->AddChild(child_window);
+ child_window->Show();
+ // |child_window| should not result in adding a new entry.
+ EXPECT_EQ(initial_item_count + 1, model_->item_count());
+
+ child_window->Destroy();
+ window->Destroy();
+ EXPECT_EQ(initial_item_count, model_->item_count());
+}
+
} // namespace ash
« no previous file with comments | « ash/common/shelf/shelf_window_watcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698