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

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

Issue 2726823003: Remove WmLookup. (Closed)
Patch Set: Clean up include and modify comment. Created 3 years, 9 months 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
« no previous file with comments | « ash/common/shelf/shelf_widget.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/shelf/shelf_item_types.h" 8 #include "ash/common/shelf/shelf_item_types.h"
9 #include "ash/common/shelf/shelf_model.h" 9 #include "ash/common/shelf/shelf_model.h"
10 #include "ash/common/wm/window_resizer.h" 10 #include "ash/common/wm/window_resizer.h"
11 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
12 #include "ash/common/wm_lookup.h"
13 #include "ash/common/wm_shell.h" 12 #include "ash/common/wm_shell.h"
14 #include "ash/common/wm_window.h" 13 #include "ash/common/wm_window.h"
15 #include "ash/common/wm_window_property.h" 14 #include "ash/common/wm_window_property.h"
16 #include "ash/public/cpp/shell_window_ids.h" 15 #include "ash/public/cpp/shell_window_ids.h"
17 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
18 #include "ash/test/ash_test_base.h" 17 #include "ash/test/ash_test_base.h"
19 #include "ui/base/hit_test.h" 18 #include "ui/base/hit_test.h"
20 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
21 20
22 namespace ash { 21 namespace ash {
(...skipping 27 matching lines...) Expand all
50 }; 49 };
51 50
52 // Ensure shelf items are added and removed as windows are opened and closed. 51 // Ensure shelf items are added and removed as windows are opened and closed.
53 TEST_F(ShelfWindowWatcherTest, OpenAndClose) { 52 TEST_F(ShelfWindowWatcherTest, OpenAndClose) {
54 // ShelfModel only has an APP_LIST item. 53 // ShelfModel only has an APP_LIST item.
55 EXPECT_EQ(1, model_->item_count()); 54 EXPECT_EQ(1, model_->item_count());
56 55
57 // Adding windows with valid ShelfItemType properties adds shelf items. 56 // Adding windows with valid ShelfItemType properties adds shelf items.
58 std::unique_ptr<views::Widget> widget1 = 57 std::unique_ptr<views::Widget> widget1 =
59 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 58 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
60 CreateShelfItem(WmLookup::Get()->GetWindowForWidget(widget1.get())); 59 CreateShelfItem(WmWindow::Get(widget1->GetNativeWindow()));
61 EXPECT_EQ(2, model_->item_count()); 60 EXPECT_EQ(2, model_->item_count());
62 std::unique_ptr<views::Widget> widget2 = 61 std::unique_ptr<views::Widget> widget2 =
63 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 62 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
64 CreateShelfItem(WmLookup::Get()->GetWindowForWidget(widget2.get())); 63 CreateShelfItem(WmWindow::Get(widget2->GetNativeWindow()));
65 EXPECT_EQ(3, model_->item_count()); 64 EXPECT_EQ(3, model_->item_count());
66 65
67 // Each ShelfItem is removed when the associated window is destroyed. 66 // Each ShelfItem is removed when the associated window is destroyed.
68 widget1.reset(); 67 widget1.reset();
69 EXPECT_EQ(2, model_->item_count()); 68 EXPECT_EQ(2, model_->item_count());
70 widget2.reset(); 69 widget2.reset();
71 EXPECT_EQ(1, model_->item_count()); 70 EXPECT_EQ(1, model_->item_count());
72 } 71 }
73 72
74 TEST_F(ShelfWindowWatcherTest, CreateAndRemoveShelfItemProperties) { 73 TEST_F(ShelfWindowWatcherTest, CreateAndRemoveShelfItemProperties) {
75 // TODO: investigate failure in mash. http://crbug.com/695562. 74 // TODO: investigate failure in mash. http://crbug.com/695562.
76 if (WmShell::Get()->IsRunningInMash()) 75 if (WmShell::Get()->IsRunningInMash())
77 return; 76 return;
78 77
79 // ShelfModel only has an APP_LIST item. 78 // ShelfModel only has an APP_LIST item.
80 EXPECT_EQ(1, model_->item_count()); 79 EXPECT_EQ(1, model_->item_count());
81 80
82 // Creating windows without a valid ShelfItemType does not add items. 81 // Creating windows without a valid ShelfItemType does not add items.
83 std::unique_ptr<views::Widget> widget1 = 82 std::unique_ptr<views::Widget> widget1 =
84 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 83 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
85 WmWindow* window1 = WmLookup::Get()->GetWindowForWidget(widget1.get()); 84 WmWindow* window1 = WmWindow::Get(widget1->GetNativeWindow());
86 std::unique_ptr<views::Widget> widget2 = 85 std::unique_ptr<views::Widget> widget2 =
87 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 86 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
88 WmWindow* window2 = WmLookup::Get()->GetWindowForWidget(widget2.get()); 87 WmWindow* window2 = WmWindow::Get(widget2->GetNativeWindow());
89 EXPECT_EQ(1, model_->item_count()); 88 EXPECT_EQ(1, model_->item_count());
90 89
91 // Create a ShelfItem for the first window. 90 // Create a ShelfItem for the first window.
92 ShelfID id_w1 = CreateShelfItem(window1); 91 ShelfID id_w1 = CreateShelfItem(window1);
93 EXPECT_EQ(2, model_->item_count()); 92 EXPECT_EQ(2, model_->item_count());
94 93
95 int index_w1 = model_->ItemIndexByID(id_w1); 94 int index_w1 = model_->ItemIndexByID(id_w1);
96 EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status); 95 EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status);
97 96
98 // Create a ShelfItem for the second window. 97 // Create a ShelfItem for the second window.
(...skipping 15 matching lines...) Expand all
114 113
115 TEST_F(ShelfWindowWatcherTest, ActivateWindow) { 114 TEST_F(ShelfWindowWatcherTest, ActivateWindow) {
116 // TODO: investigate failure in mash. http://crbug.com/695562. 115 // TODO: investigate failure in mash. http://crbug.com/695562.
117 if (WmShell::Get()->IsRunningInMash()) 116 if (WmShell::Get()->IsRunningInMash())
118 return; 117 return;
119 118
120 // ShelfModel only have APP_LIST item. 119 // ShelfModel only have APP_LIST item.
121 EXPECT_EQ(1, model_->item_count()); 120 EXPECT_EQ(1, model_->item_count());
122 std::unique_ptr<views::Widget> widget1 = 121 std::unique_ptr<views::Widget> widget1 =
123 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 122 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
124 WmWindow* window1 = WmLookup::Get()->GetWindowForWidget(widget1.get()); 123 WmWindow* window1 = WmWindow::Get(widget1->GetNativeWindow());
125 std::unique_ptr<views::Widget> widget2 = 124 std::unique_ptr<views::Widget> widget2 =
126 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 125 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
127 WmWindow* window2 = WmLookup::Get()->GetWindowForWidget(widget2.get()); 126 WmWindow* window2 = WmWindow::Get(widget2->GetNativeWindow());
128 127
129 // Create a ShelfItem for the first window. 128 // Create a ShelfItem for the first window.
130 ShelfID id_w1 = CreateShelfItem(window1); 129 ShelfID id_w1 = CreateShelfItem(window1);
131 EXPECT_EQ(2, model_->item_count()); 130 EXPECT_EQ(2, model_->item_count());
132 int index_w1 = model_->ItemIndexByID(id_w1); 131 int index_w1 = model_->ItemIndexByID(id_w1);
133 EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status); 132 EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status);
134 133
135 // Create a ShelfItem for the second window. 134 // Create a ShelfItem for the second window.
136 ShelfID id_w2 = CreateShelfItem(window2); 135 ShelfID id_w2 = CreateShelfItem(window2);
137 EXPECT_EQ(3, model_->item_count()); 136 EXPECT_EQ(3, model_->item_count());
(...skipping 15 matching lines...) Expand all
153 TEST_F(ShelfWindowWatcherTest, UpdateWindowProperty) { 152 TEST_F(ShelfWindowWatcherTest, UpdateWindowProperty) {
154 // TODO: investigate failure in mash. http://crbug.com/695562. 153 // TODO: investigate failure in mash. http://crbug.com/695562.
155 if (WmShell::Get()->IsRunningInMash()) 154 if (WmShell::Get()->IsRunningInMash())
156 return; 155 return;
157 156
158 // ShelfModel only has an APP_LIST item. 157 // ShelfModel only has an APP_LIST item.
159 EXPECT_EQ(1, model_->item_count()); 158 EXPECT_EQ(1, model_->item_count());
160 159
161 std::unique_ptr<views::Widget> widget = 160 std::unique_ptr<views::Widget> widget =
162 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 161 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
163 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); 162 WmWindow* window = WmWindow::Get(widget->GetNativeWindow());
164 163
165 // Create a ShelfItem for |window|. 164 // Create a ShelfItem for |window|.
166 ShelfID id = CreateShelfItem(window); 165 ShelfID id = CreateShelfItem(window);
167 EXPECT_EQ(2, model_->item_count()); 166 EXPECT_EQ(2, model_->item_count());
168 167
169 int index = model_->ItemIndexByID(id); 168 int index = model_->ItemIndexByID(id);
170 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status); 169 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status);
171 170
172 // Update the ShelfItemType for |window|. 171 // Update the ShelfItemType for |window|.
173 window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP); 172 window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP);
174 // No new item is created after updating a launcher item. 173 // No new item is created after updating a launcher item.
175 EXPECT_EQ(2, model_->item_count()); 174 EXPECT_EQ(2, model_->item_count());
176 // index and id are not changed after updating a launcher item. 175 // index and id are not changed after updating a launcher item.
177 EXPECT_EQ(index, model_->ItemIndexByID(id)); 176 EXPECT_EQ(index, model_->ItemIndexByID(id));
178 EXPECT_EQ(id, model_->items()[index].id); 177 EXPECT_EQ(id, model_->items()[index].id);
179 } 178 }
180 179
181 TEST_F(ShelfWindowWatcherTest, MaximizeAndRestoreWindow) { 180 TEST_F(ShelfWindowWatcherTest, MaximizeAndRestoreWindow) {
182 // TODO: investigate failure in mash. http://crbug.com/695562. 181 // TODO: investigate failure in mash. http://crbug.com/695562.
183 if (WmShell::Get()->IsRunningInMash()) 182 if (WmShell::Get()->IsRunningInMash())
184 return; 183 return;
185 184
186 // ShelfModel only has an APP_LIST item. 185 // ShelfModel only has an APP_LIST item.
187 EXPECT_EQ(1, model_->item_count()); 186 EXPECT_EQ(1, model_->item_count());
188 187
189 std::unique_ptr<views::Widget> widget = 188 std::unique_ptr<views::Widget> widget =
190 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 189 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
191 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); 190 WmWindow* window = WmWindow::Get(widget->GetNativeWindow());
192 wm::WindowState* window_state = window->GetWindowState(); 191 wm::WindowState* window_state = window->GetWindowState();
193 192
194 // Create a ShelfItem for |window|. 193 // Create a ShelfItem for |window|.
195 ShelfID id = CreateShelfItem(window); 194 ShelfID id = CreateShelfItem(window);
196 EXPECT_EQ(2, model_->item_count()); 195 EXPECT_EQ(2, model_->item_count());
197 196
198 int index = model_->ItemIndexByID(id); 197 int index = model_->ItemIndexByID(id);
199 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status); 198 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status);
200 199
201 // Maximize window |window|. 200 // Maximize window |window|.
(...skipping 20 matching lines...) Expand all
222 TEST_F(ShelfWindowWatcherTest, DockWindow) { 221 TEST_F(ShelfWindowWatcherTest, DockWindow) {
223 // TODO: investigate failure in mash. http://crbug.com/695562. 222 // TODO: investigate failure in mash. http://crbug.com/695562.
224 if (WmShell::Get()->IsRunningInMash()) 223 if (WmShell::Get()->IsRunningInMash())
225 return; 224 return;
226 225
227 // ShelfModel only has an APP_LIST item. 226 // ShelfModel only has an APP_LIST item.
228 EXPECT_EQ(1, model_->item_count()); 227 EXPECT_EQ(1, model_->item_count());
229 228
230 std::unique_ptr<views::Widget> widget = 229 std::unique_ptr<views::Widget> widget =
231 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 230 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
232 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); 231 WmWindow* window = WmWindow::Get(widget->GetNativeWindow());
233 232
234 // Create a ShelfItem for |window|. 233 // Create a ShelfItem for |window|.
235 ShelfID id = CreateShelfItem(window); 234 ShelfID id = CreateShelfItem(window);
236 EXPECT_EQ(2, model_->item_count()); 235 EXPECT_EQ(2, model_->item_count());
237 236
238 int index = model_->ItemIndexByID(id); 237 int index = model_->ItemIndexByID(id);
239 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status); 238 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status);
240 239
241 WmWindow* root_window = window->GetRootWindow(); 240 WmWindow* root_window = window->GetRootWindow();
242 WmWindow* default_container = 241 WmWindow* default_container =
(...skipping 19 matching lines...) Expand all
262 TEST_F(ShelfWindowWatcherTest, DragWindow) { 261 TEST_F(ShelfWindowWatcherTest, DragWindow) {
263 // TODO: investigate failure in mash. http://crbug.com/695562. 262 // TODO: investigate failure in mash. http://crbug.com/695562.
264 if (WmShell::Get()->IsRunningInMash()) 263 if (WmShell::Get()->IsRunningInMash())
265 return; 264 return;
266 265
267 // ShelfModel only has an APP_LIST item. 266 // ShelfModel only has an APP_LIST item.
268 EXPECT_EQ(1, model_->item_count()); 267 EXPECT_EQ(1, model_->item_count());
269 268
270 std::unique_ptr<views::Widget> widget = 269 std::unique_ptr<views::Widget> widget =
271 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 270 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
272 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); 271 WmWindow* window = WmWindow::Get(widget->GetNativeWindow());
273 272
274 // Create a ShelfItem for |window|. 273 // Create a ShelfItem for |window|.
275 ShelfID id = CreateShelfItem(window); 274 ShelfID id = CreateShelfItem(window);
276 EXPECT_EQ(2, model_->item_count()); 275 EXPECT_EQ(2, model_->item_count());
277 276
278 int index = model_->ItemIndexByID(id); 277 int index = model_->ItemIndexByID(id);
279 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status); 278 EXPECT_EQ(STATUS_ACTIVE, model_->items()[index].status);
280 279
281 // Simulate dragging of |window| and check its item is not changed. 280 // Simulate dragging of |window| and check its item is not changed.
282 std::unique_ptr<WindowResizer> resizer(CreateWindowResizer( 281 std::unique_ptr<WindowResizer> resizer(CreateWindowResizer(
(...skipping 12 matching lines...) Expand all
295 // TODO: investigate failure in mash. http://crbug.com/695562. 294 // TODO: investigate failure in mash. http://crbug.com/695562.
296 if (WmShell::Get()->IsRunningInMash()) 295 if (WmShell::Get()->IsRunningInMash())
297 return; 296 return;
298 297
299 // ShelfModel only has an APP_LIST item. 298 // ShelfModel only has an APP_LIST item.
300 EXPECT_EQ(1, model_->item_count()); 299 EXPECT_EQ(1, model_->item_count());
301 300
302 // Adding windows with valid ShelfItemType properties adds shelf items. 301 // Adding windows with valid ShelfItemType properties adds shelf items.
303 std::unique_ptr<views::Widget> widget1 = 302 std::unique_ptr<views::Widget> widget1 =
304 CreateTestWidget(nullptr, kShellWindowId_PanelContainer, gfx::Rect()); 303 CreateTestWidget(nullptr, kShellWindowId_PanelContainer, gfx::Rect());
305 WmWindow* window1 = WmLookup::Get()->GetWindowForWidget(widget1.get()); 304 WmWindow* window1 = WmWindow::Get(widget1->GetNativeWindow());
306 window1->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP_PANEL); 305 window1->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP_PANEL);
307 EXPECT_EQ(2, model_->item_count()); 306 EXPECT_EQ(2, model_->item_count());
308 std::unique_ptr<views::Widget> widget2 = 307 std::unique_ptr<views::Widget> widget2 =
309 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 308 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
310 WmWindow* window2 = WmLookup::Get()->GetWindowForWidget(widget2.get()); 309 WmWindow* window2 = WmWindow::Get(widget2->GetNativeWindow());
311 window2->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP_PANEL); 310 window2->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, TYPE_APP_PANEL);
312 EXPECT_EQ(3, model_->item_count()); 311 EXPECT_EQ(3, model_->item_count());
313 312
314 // Create a panel-type widget to mimic Chrome's app panel windows. 313 // Create a panel-type widget to mimic Chrome's app panel windows.
315 views::Widget panel_widget; 314 views::Widget panel_widget;
316 views::Widget::InitParams panel_params(views::Widget::InitParams::TYPE_PANEL); 315 views::Widget::InitParams panel_params(views::Widget::InitParams::TYPE_PANEL);
317 panel_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 316 panel_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
318 WmShell::Get() 317 WmShell::Get()
319 ->GetPrimaryRootWindow() 318 ->GetPrimaryRootWindow()
320 ->GetRootWindowController() 319 ->GetRootWindowController()
321 ->ConfigureWidgetInitParamsForContainer( 320 ->ConfigureWidgetInitParamsForContainer(
322 &panel_widget, kShellWindowId_PanelContainer, &panel_params); 321 &panel_widget, kShellWindowId_PanelContainer, &panel_params);
323 panel_widget.Init(panel_params); 322 panel_widget.Init(panel_params);
324 panel_widget.Show(); 323 panel_widget.Show();
325 WmWindow* panel_window = WmLookup::Get()->GetWindowForWidget(&panel_widget); 324 WmWindow* panel_window = WmWindow::Get(panel_widget.GetNativeWindow());
326 panel_window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE, 325 panel_window->SetIntProperty(WmWindowProperty::SHELF_ITEM_TYPE,
327 TYPE_APP_PANEL); 326 TYPE_APP_PANEL);
328 EXPECT_EQ(4, model_->item_count()); 327 EXPECT_EQ(4, model_->item_count());
329 328
330 // Each ShelfItem is removed when the associated window is destroyed. 329 // Each ShelfItem is removed when the associated window is destroyed.
331 panel_widget.CloseNow(); 330 panel_widget.CloseNow();
332 EXPECT_EQ(3, model_->item_count()); 331 EXPECT_EQ(3, model_->item_count());
333 widget2.reset(); 332 widget2.reset();
334 EXPECT_EQ(2, model_->item_count()); 333 EXPECT_EQ(2, model_->item_count());
335 widget1.reset(); 334 widget1.reset();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 ShelfModel* model = WmShell::Get()->shelf_model(); 367 ShelfModel* model = WmShell::Get()->shelf_model();
369 ASSERT_FALSE( 368 ASSERT_FALSE(
370 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); 369 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted());
371 370
372 // ShelfModel only has an APP_LIST item. 371 // ShelfModel only has an APP_LIST item.
373 EXPECT_EQ(1, model->item_count()); 372 EXPECT_EQ(1, model->item_count());
374 373
375 // Construct a window that should get a shelf item once the session starts. 374 // Construct a window that should get a shelf item once the session starts.
376 std::unique_ptr<views::Widget> widget = 375 std::unique_ptr<views::Widget> widget =
377 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 376 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
378 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); 377 WmWindow* window = WmWindow::Get(widget->GetNativeWindow());
379 ShelfWindowWatcherTest::CreateShelfItem(window); 378 ShelfWindowWatcherTest::CreateShelfItem(window);
380 EXPECT_EQ(1, model->item_count()); 379 EXPECT_EQ(1, model->item_count());
381 380
382 // Start the test user session; ShelfWindowWatcher will find the open window. 381 // Start the test user session; ShelfWindowWatcher will find the open window.
383 SetSessionStarted(true); 382 SetSessionStarted(true);
384 EXPECT_EQ(2, model->item_count()); 383 EXPECT_EQ(2, model->item_count());
385 } 384 }
386 385
387 } // namespace ash 386 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_widget.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698