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

Side by Side Diff: ash/common/shelf/shelf_window_watcher_unittest.cc

Issue 2514473003: Replace IDR window property use with gfx::ImageSkia icons. (Closed)
Patch Set: Remove TODOs let mash Task Manager and Settings icons temporarily regress. Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index_w2].status); 98 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index_w2].status);
99 99
100 // ShelfItem is removed when the item type window property is cleared. 100 // ShelfItem is removed when the item type window property is cleared.
101 window1->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_UNDEFINED); 101 window1->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_UNDEFINED);
102 EXPECT_EQ(2, model_->item_count()); 102 EXPECT_EQ(2, model_->item_count());
103 window2->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_UNDEFINED); 103 window2->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_UNDEFINED);
104 EXPECT_EQ(1, model_->item_count()); 104 EXPECT_EQ(1, model_->item_count());
105 // Clearing twice doesn't do anything. 105 // Clearing twice doesn't do anything.
106 window2->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_UNDEFINED); 106 window2->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_UNDEFINED);
107 EXPECT_EQ(1, model_->item_count()); 107 EXPECT_EQ(1, model_->item_count());
108
109 // Setting an icon id (without a valid item type) does not add a shelf item.
110 window2->SetIntProperty(WmWindowProperty::SHELF_ICON_RESOURCE_ID, 1234);
111 EXPECT_EQ(1, model_->item_count());
112 } 108 }
113 109
114 TEST_F(ShelfWindowWatcherTest, ActivateWindow) { 110 TEST_F(ShelfWindowWatcherTest, ActivateWindow) {
115 // ShelfModel only have APP_LIST item. 111 // ShelfModel only have APP_LIST item.
116 EXPECT_EQ(1, model_->item_count()); 112 EXPECT_EQ(1, model_->item_count());
117 std::unique_ptr<views::Widget> widget1 = 113 std::unique_ptr<views::Widget> widget1 =
118 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 114 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
119 WmWindow* window1 = WmLookup::Get()->GetWindowForWidget(widget1.get()); 115 WmWindow* window1 = WmLookup::Get()->GetWindowForWidget(widget1.get());
120 std::unique_ptr<views::Widget> widget2 = 116 std::unique_ptr<views::Widget> widget2 =
121 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 117 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // Each ShelfItem is removed when the associated window is destroyed. 301 // Each ShelfItem is removed when the associated window is destroyed.
306 panel_widget.CloseNow(); 302 panel_widget.CloseNow();
307 EXPECT_EQ(3, model_->item_count()); 303 EXPECT_EQ(3, model_->item_count());
308 widget2.reset(); 304 widget2.reset();
309 EXPECT_EQ(2, model_->item_count()); 305 EXPECT_EQ(2, model_->item_count());
310 widget1.reset(); 306 widget1.reset();
311 EXPECT_EQ(1, model_->item_count()); 307 EXPECT_EQ(1, model_->item_count());
312 } 308 }
313 309
314 } // namespace ash 310 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698