| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/shelf/shelf_window_watcher.h" | 5 #include "ash/common/shelf/shelf_window_watcher.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_item_types.h" | 7 #include "ash/common/shelf/shelf_item_types.h" |
| 8 #include "ash/common/shelf/shelf_model.h" | 8 #include "ash/common/shelf/shelf_model.h" |
| 9 #include "ash/common/wm/window_resizer.h" | 9 #include "ash/common/wm/window_resizer.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 // Each ShelfItem is removed when the associated window is destroyed. | 301 // Each ShelfItem is removed when the associated window is destroyed. |
| 302 panel_widget.CloseNow(); | 302 panel_widget.CloseNow(); |
| 303 EXPECT_EQ(3, model_->item_count()); | 303 EXPECT_EQ(3, model_->item_count()); |
| 304 widget2.reset(); | 304 widget2.reset(); |
| 305 EXPECT_EQ(2, model_->item_count()); | 305 EXPECT_EQ(2, model_->item_count()); |
| 306 widget1.reset(); | 306 widget1.reset(); |
| 307 EXPECT_EQ(1, model_->item_count()); | 307 EXPECT_EQ(1, model_->item_count()); |
| 308 } | 308 } |
| 309 | 309 |
| 310 TEST_F(ShelfWindowWatcherTest, DontCreateShelfEntriesForChildWindows) { |
| 311 const int initial_item_count = model_->item_count(); |
| 312 |
| 313 WmWindow* window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_NORMAL, |
| 314 ui::LAYER_NOT_DRAWN); |
| 315 window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP); |
| 316 WmShell::Get() |
| 317 ->GetPrimaryRootWindow() |
| 318 ->GetChildByShellWindowId(kShellWindowId_DefaultContainer) |
| 319 ->AddChild(window); |
| 320 window->Show(); |
| 321 EXPECT_EQ(initial_item_count + 1, model_->item_count()); |
| 322 |
| 323 WmWindow* child_window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_NORMAL, |
| 324 ui::LAYER_NOT_DRAWN); |
| 325 child_window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP); |
| 326 window->AddChild(child_window); |
| 327 child_window->Show(); |
| 328 // |child_window| should not result in adding a new entry. |
| 329 EXPECT_EQ(initial_item_count + 1, model_->item_count()); |
| 330 |
| 331 child_window->Destroy(); |
| 332 window->Destroy(); |
| 333 EXPECT_EQ(initial_item_count, model_->item_count()); |
| 334 } |
| 335 |
| 310 } // namespace ash | 336 } // namespace ash |
| OLD | NEW |