| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); | 150 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); |
| 151 | 151 |
| 152 // Create a ShelfItem for |window|. | 152 // Create a ShelfItem for |window|. |
| 153 ShelfID id = CreateShelfItem(window); | 153 ShelfID id = CreateShelfItem(window); |
| 154 EXPECT_EQ(2, model_->item_count()); | 154 EXPECT_EQ(2, model_->item_count()); |
| 155 | 155 |
| 156 int index = model_->ItemIndexByID(id); | 156 int index = model_->ItemIndexByID(id); |
| 157 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status); | 157 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status); |
| 158 | 158 |
| 159 // Update the ShelfItemType for |window|. | 159 // Update the ShelfItemType for |window|. |
| 160 window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_PLATFORM_APP); | 160 window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP); |
| 161 // No new item is created after updating a launcher item. | 161 // No new item is created after updating a launcher item. |
| 162 EXPECT_EQ(2, model_->item_count()); | 162 EXPECT_EQ(2, model_->item_count()); |
| 163 // index and id are not changed after updating a launcher item. | 163 // index and id are not changed after updating a launcher item. |
| 164 EXPECT_EQ(index, model_->ItemIndexByID(id)); | 164 EXPECT_EQ(index, model_->ItemIndexByID(id)); |
| 165 EXPECT_EQ(id, model_->items()[index].id); | 165 EXPECT_EQ(id, model_->items()[index].id); |
| 166 } | 166 } |
| 167 | 167 |
| 168 TEST_F(ShelfWindowWatcherTest, MaximizeAndRestoreWindow) { | 168 TEST_F(ShelfWindowWatcherTest, MaximizeAndRestoreWindow) { |
| 169 // ShelfModel only has an APP_LIST item. | 169 // ShelfModel only has an APP_LIST item. |
| 170 EXPECT_EQ(1, model_->item_count()); | 170 EXPECT_EQ(1, model_->item_count()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } // namespace ash | 310 } // namespace ash |
| OLD | NEW |