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/shelf/shelf_window_watcher.h" | 5 #include "ash/shelf/shelf_window_watcher.h" |
6 | 6 |
7 #include "ash/public/cpp/config.h" | 7 #include "ash/public/cpp/config.h" |
8 #include "ash/public/cpp/shelf_item.h" | 8 #include "ash/public/cpp/shelf_item.h" |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/public/cpp/window_properties.h" | 10 #include "ash/public/cpp/window_properties.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); | 275 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); |
276 aura::Window* window2 = widget2->GetNativeWindow(); | 276 aura::Window* window2 = widget2->GetNativeWindow(); |
277 window2->SetProperty(kShelfIDKey, new std::string(ShelfID("b").Serialize())); | 277 window2->SetProperty(kShelfIDKey, new std::string(ShelfID("b").Serialize())); |
278 window2->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_DIALOG)); | 278 window2->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_DIALOG)); |
279 EXPECT_EQ(3, model_->item_count()); | 279 EXPECT_EQ(3, model_->item_count()); |
280 | 280 |
281 // Create a panel-type widget to mimic Chrome's app panel windows. | 281 // Create a panel-type widget to mimic Chrome's app panel windows. |
282 views::Widget panel_widget; | 282 views::Widget panel_widget; |
283 views::Widget::InitParams panel_params(views::Widget::InitParams::TYPE_PANEL); | 283 views::Widget::InitParams panel_params(views::Widget::InitParams::TYPE_PANEL); |
284 panel_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 284 panel_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
285 ShellPort::Get() | 285 Shell::GetPrimaryRootWindowController() |
286 ->GetPrimaryRootWindow() | |
287 ->GetRootWindowController() | |
288 ->ConfigureWidgetInitParamsForContainer( | 286 ->ConfigureWidgetInitParamsForContainer( |
289 &panel_widget, kShellWindowId_PanelContainer, &panel_params); | 287 &panel_widget, kShellWindowId_PanelContainer, &panel_params); |
290 panel_widget.Init(panel_params); | 288 panel_widget.Init(panel_params); |
291 panel_widget.Show(); | 289 panel_widget.Show(); |
292 aura::Window* panel_window = panel_widget.GetNativeWindow(); | 290 aura::Window* panel_window = panel_widget.GetNativeWindow(); |
293 panel_window->SetProperty(kShelfIDKey, | 291 panel_window->SetProperty(kShelfIDKey, |
294 new std::string(ShelfID("c").Serialize())); | 292 new std::string(ShelfID("c").Serialize())); |
295 panel_window->SetProperty(kShelfItemTypeKey, | 293 panel_window->SetProperty(kShelfItemTypeKey, |
296 static_cast<int32_t>(TYPE_APP_PANEL)); | 294 static_cast<int32_t>(TYPE_APP_PANEL)); |
297 EXPECT_EQ(4, model_->item_count()); | 295 EXPECT_EQ(4, model_->item_count()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); | 346 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); |
349 ShelfWindowWatcherTest::CreateShelfItem(widget->GetNativeWindow()); | 347 ShelfWindowWatcherTest::CreateShelfItem(widget->GetNativeWindow()); |
350 EXPECT_EQ(1, model->item_count()); | 348 EXPECT_EQ(1, model->item_count()); |
351 | 349 |
352 // Start the test user session; ShelfWindowWatcher will find the open window. | 350 // Start the test user session; ShelfWindowWatcher will find the open window. |
353 SetSessionStarted(true); | 351 SetSessionStarted(true); |
354 EXPECT_EQ(2, model->item_count()); | 352 EXPECT_EQ(2, model->item_count()); |
355 } | 353 } |
356 | 354 |
357 } // namespace ash | 355 } // namespace ash |
OLD | NEW |