OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
11 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
12 #include "ash/common/shelf/shelf_layout_manager.h" | 12 #include "ash/common/shelf/shelf_layout_manager.h" |
13 #include "ash/common/shelf/shelf_widget.h" | 13 #include "ash/common/shelf/shelf_widget.h" |
14 #include "ash/common/shelf/wm_shelf.h" | 14 #include "ash/common/shelf/wm_shelf.h" |
15 #include "ash/common/shell_window_ids.h" | 15 #include "ash/common/shell_window_ids.h" |
16 #include "ash/common/wm_shell.h" | 16 #include "ash/common/wm_shell.h" |
17 #include "ash/desktop_background/desktop_background_widget_controller.h" | |
18 #include "ash/display/mouse_cursor_event_filter.h" | 17 #include "ash/display/mouse_cursor_event_filter.h" |
19 #include "ash/drag_drop/drag_drop_controller.h" | 18 #include "ash/drag_drop/drag_drop_controller.h" |
20 #include "ash/root_window_controller.h" | 19 #include "ash/root_window_controller.h" |
21 #include "ash/test/ash_test_base.h" | 20 #include "ash/test/ash_test_base.h" |
22 #include "ash/test/shell_test_api.h" | 21 #include "ash/test/shell_test_api.h" |
| 22 #include "ash/wallpaper/wallpaper_widget_controller.h" |
23 #include "ash/wm/window_util.h" | 23 #include "ash/wm/window_util.h" |
24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
25 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
26 #include "ui/aura/client/aura_constants.h" | 26 #include "ui/aura/client/aura_constants.h" |
27 #include "ui/aura/env.h" | 27 #include "ui/aura/env.h" |
28 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
29 #include "ui/aura/window_event_dispatcher.h" | 29 #include "ui/aura/window_event_dispatcher.h" |
30 #include "ui/base/models/simple_menu_model.h" | 30 #include "ui/base/models/simple_menu_model.h" |
31 #include "ui/events/test/event_generator.h" | 31 #include "ui/events/test/event_generator.h" |
32 #include "ui/events/test/events_test_utils.h" | 32 #include "ui/events/test/events_test_utils.h" |
(...skipping 17 matching lines...) Expand all Loading... |
50 } | 50 } |
51 | 51 |
52 aura::Window* GetAlwaysOnTopContainer() { | 52 aura::Window* GetAlwaysOnTopContainer() { |
53 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 53 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
54 kShellWindowId_AlwaysOnTopContainer); | 54 kShellWindowId_AlwaysOnTopContainer); |
55 } | 55 } |
56 | 56 |
57 // Expect ALL the containers! | 57 // Expect ALL the containers! |
58 void ExpectAllContainers() { | 58 void ExpectAllContainers() { |
59 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 59 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
60 EXPECT_TRUE(Shell::GetContainer(root_window, | 60 EXPECT_TRUE( |
61 kShellWindowId_DesktopBackgroundContainer)); | 61 Shell::GetContainer(root_window, kShellWindowId_WallpaperContainer)); |
62 EXPECT_TRUE( | 62 EXPECT_TRUE( |
63 Shell::GetContainer(root_window, kShellWindowId_DefaultContainer)); | 63 Shell::GetContainer(root_window, kShellWindowId_DefaultContainer)); |
64 EXPECT_TRUE( | 64 EXPECT_TRUE( |
65 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer)); | 65 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer)); |
66 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_PanelContainer)); | 66 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_PanelContainer)); |
67 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_ShelfContainer)); | 67 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_ShelfContainer)); |
68 EXPECT_TRUE( | 68 EXPECT_TRUE( |
69 Shell::GetContainer(root_window, kShellWindowId_SystemModalContainer)); | 69 Shell::GetContainer(root_window, kShellWindowId_SystemModalContainer)); |
70 EXPECT_TRUE(Shell::GetContainer( | 70 EXPECT_TRUE(Shell::GetContainer(root_window, |
71 root_window, kShellWindowId_LockScreenBackgroundContainer)); | 71 kShellWindowId_LockScreenWallpaperContainer)); |
72 EXPECT_TRUE( | 72 EXPECT_TRUE( |
73 Shell::GetContainer(root_window, kShellWindowId_LockScreenContainer)); | 73 Shell::GetContainer(root_window, kShellWindowId_LockScreenContainer)); |
74 EXPECT_TRUE(Shell::GetContainer(root_window, | 74 EXPECT_TRUE(Shell::GetContainer(root_window, |
75 kShellWindowId_LockSystemModalContainer)); | 75 kShellWindowId_LockSystemModalContainer)); |
76 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_StatusContainer)); | 76 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_StatusContainer)); |
77 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_MenuContainer)); | 77 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_MenuContainer)); |
78 EXPECT_TRUE(Shell::GetContainer(root_window, | 78 EXPECT_TRUE(Shell::GetContainer(root_window, |
79 kShellWindowId_DragImageAndTooltipContainer)); | 79 kShellWindowId_DragImageAndTooltipContainer)); |
80 EXPECT_TRUE( | 80 EXPECT_TRUE( |
81 Shell::GetContainer(root_window, kShellWindowId_SettingBubbleContainer)); | 81 Shell::GetContainer(root_window, kShellWindowId_SettingBubbleContainer)); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 // We start with the usual window containers. | 371 // We start with the usual window containers. |
372 ExpectAllContainers(); | 372 ExpectAllContainers(); |
373 // Shelf is visible. | 373 // Shelf is visible. |
374 ShelfWidget* shelf_widget = GetPrimaryShelf()->GetShelfWidgetForTesting(); | 374 ShelfWidget* shelf_widget = GetPrimaryShelf()->GetShelfWidgetForTesting(); |
375 EXPECT_TRUE(shelf_widget->IsVisible()); | 375 EXPECT_TRUE(shelf_widget->IsVisible()); |
376 // Shelf is at bottom-left of screen. | 376 // Shelf is at bottom-left of screen. |
377 EXPECT_EQ(0, shelf_widget->GetWindowBoundsInScreen().x()); | 377 EXPECT_EQ(0, shelf_widget->GetWindowBoundsInScreen().x()); |
378 EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHost()->GetBounds().height(), | 378 EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHost()->GetBounds().height(), |
379 shelf_widget->GetWindowBoundsInScreen().bottom()); | 379 shelf_widget->GetWindowBoundsInScreen().bottom()); |
380 // We have a desktop background but not a bare layer. | 380 // We have a wallpaper but not a bare layer. |
381 // TODO (antrim): enable once we find out why it fails component build. | 381 // TODO (antrim): enable once we find out why it fails component build. |
382 // DesktopBackgroundWidgetController* background = | 382 // WallpaperWidgetController* wallpaper = |
383 // Shell::GetPrimaryRootWindow()-> | 383 // Shell::GetPrimaryRootWindow()-> |
384 // GetProperty(kWindowDesktopComponent); | 384 // GetProperty(kWindowDesktopComponent); |
385 // EXPECT_TRUE(background); | 385 // EXPECT_TRUE(wallpaper); |
386 // EXPECT_TRUE(background->widget()); | 386 // EXPECT_TRUE(wallpaper->widget()); |
387 // EXPECT_FALSE(background->layer()); | 387 // EXPECT_FALSE(wallpaper->layer()); |
388 | 388 |
389 // Create a normal window. It is not maximized. | 389 // Create a normal window. It is not maximized. |
390 views::Widget::InitParams widget_params( | 390 views::Widget::InitParams widget_params( |
391 views::Widget::InitParams::TYPE_WINDOW); | 391 views::Widget::InitParams::TYPE_WINDOW); |
392 widget_params.bounds.SetRect(11, 22, 300, 400); | 392 widget_params.bounds.SetRect(11, 22, 300, 400); |
393 views::Widget* widget = CreateTestWindow(widget_params); | 393 views::Widget* widget = CreateTestWindow(widget_params); |
394 widget->Show(); | 394 widget->Show(); |
395 EXPECT_FALSE(widget->IsMaximized()); | 395 EXPECT_FALSE(widget->IsMaximized()); |
396 | 396 |
397 // Clean up. | 397 // Clean up. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 private: | 503 private: |
504 DISALLOW_COPY_AND_ASSIGN(ShellTest2); | 504 DISALLOW_COPY_AND_ASSIGN(ShellTest2); |
505 }; | 505 }; |
506 | 506 |
507 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { | 507 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { |
508 window_.reset(new aura::Window(NULL)); | 508 window_.reset(new aura::Window(NULL)); |
509 window_->Init(ui::LAYER_NOT_DRAWN); | 509 window_->Init(ui::LAYER_NOT_DRAWN); |
510 } | 510 } |
511 | 511 |
512 } // namespace ash | 512 } // namespace ash |
OLD | NEW |