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/session/session_controller.h" | 10 #include "ash/common/session/session_controller.h" |
11 #include "ash/common/shelf/shelf_layout_manager.h" | 11 #include "ash/common/shelf/shelf_layout_manager.h" |
12 #include "ash/common/shelf/shelf_widget.h" | 12 #include "ash/common/shelf/shelf_widget.h" |
13 #include "ash/common/shelf/wm_shelf.h" | 13 #include "ash/common/shelf/wm_shelf.h" |
14 #include "ash/common/test/test_session_controller_client.h" | 14 #include "ash/common/test/test_session_controller_client.h" |
15 #include "ash/common/wallpaper/wallpaper_widget_controller.h" | 15 #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
16 #include "ash/common/wm_shell.h" | 16 #include "ash/common/wm_shell.h" |
17 #include "ash/common/wm_window.h" | 17 #include "ash/common/wm_window.h" |
18 #include "ash/display/mouse_cursor_event_filter.h" | 18 #include "ash/display/mouse_cursor_event_filter.h" |
19 #include "ash/drag_drop/drag_drop_controller.h" | 19 #include "ash/drag_drop/drag_drop_controller.h" |
20 #include "ash/public/cpp/shell_window_ids.h" | 20 #include "ash/public/cpp/shell_window_ids.h" |
21 #include "ash/root_window_controller.h" | 21 #include "ash/root_window_controller.h" |
22 #include "ash/test/ash_test_base.h" | 22 #include "ash/test/ash_test_base.h" |
23 #include "ash/test/shell_test_api.h" | 23 #include "ash/test/shell_test_api.h" |
24 #include "ash/wm/window_util.h" | 24 #include "ash/wm/window_util.h" |
| 25 #include "base/macros.h" |
25 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
26 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
27 #include "ui/aura/client/aura_constants.h" | 28 #include "ui/aura/client/aura_constants.h" |
28 #include "ui/aura/env.h" | 29 #include "ui/aura/env.h" |
29 #include "ui/aura/window.h" | 30 #include "ui/aura/window.h" |
30 #include "ui/aura/window_event_dispatcher.h" | 31 #include "ui/aura/window_event_dispatcher.h" |
31 #include "ui/base/models/simple_menu_model.h" | 32 #include "ui/base/models/simple_menu_model.h" |
32 #include "ui/events/test/event_generator.h" | 33 #include "ui/events/test/event_generator.h" |
33 #include "ui/events/test/events_test_utils.h" | 34 #include "ui/events/test/events_test_utils.h" |
34 #include "ui/events/test/test_event_handler.h" | 35 #include "ui/events/test/test_event_handler.h" |
(...skipping 15 matching lines...) Expand all Loading... |
50 kShellWindowId_DefaultContainer); | 51 kShellWindowId_DefaultContainer); |
51 } | 52 } |
52 | 53 |
53 aura::Window* GetAlwaysOnTopContainer() { | 54 aura::Window* GetAlwaysOnTopContainer() { |
54 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 55 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
55 kShellWindowId_AlwaysOnTopContainer); | 56 kShellWindowId_AlwaysOnTopContainer); |
56 } | 57 } |
57 | 58 |
58 // Expect ALL the containers! | 59 // Expect ALL the containers! |
59 void ExpectAllContainers() { | 60 void ExpectAllContainers() { |
| 61 // Validate no duplicate container IDs. |
| 62 const size_t all_shell_container_ids_size = arraysize(kAllShellContainerIds); |
| 63 std::set<int32_t> container_ids; |
| 64 for (size_t i = 0; i < all_shell_container_ids_size; ++i) |
| 65 EXPECT_TRUE(container_ids.insert(kAllShellContainerIds[i]).second); |
| 66 |
60 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 67 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
61 EXPECT_TRUE( | 68 EXPECT_TRUE( |
62 Shell::GetContainer(root_window, kShellWindowId_WallpaperContainer)); | 69 Shell::GetContainer(root_window, kShellWindowId_WallpaperContainer)); |
63 EXPECT_TRUE( | 70 EXPECT_TRUE( |
64 Shell::GetContainer(root_window, kShellWindowId_DefaultContainer)); | 71 Shell::GetContainer(root_window, kShellWindowId_DefaultContainer)); |
65 EXPECT_TRUE( | 72 EXPECT_TRUE( |
66 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer)); | 73 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer)); |
67 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_PanelContainer)); | 74 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_PanelContainer)); |
68 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_ShelfContainer)); | 75 EXPECT_TRUE(Shell::GetContainer(root_window, kShellWindowId_ShelfContainer)); |
69 EXPECT_TRUE( | 76 EXPECT_TRUE( |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // the case with classic-ash where embedders can separately create | 511 // the case with classic-ash where embedders can separately create |
505 // aura::Windows. | 512 // aura::Windows. |
506 if (WmShell::Get()->IsRunningInMash()) | 513 if (WmShell::Get()->IsRunningInMash()) |
507 return; | 514 return; |
508 | 515 |
509 window_.reset(new aura::Window(NULL)); | 516 window_.reset(new aura::Window(NULL)); |
510 window_->Init(ui::LAYER_NOT_DRAWN); | 517 window_->Init(ui::LAYER_NOT_DRAWN); |
511 } | 518 } |
512 | 519 |
513 } // namespace ash | 520 } // namespace ash |
OLD | NEW |