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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "ash/public/cpp/app_launch_id.h" | 9 #include "ash/public/cpp/app_launch_id.h" |
10 #include "ash/public/cpp/shelf_item_delegate.h" | 10 #include "ash/public/cpp/shelf_item_delegate.h" |
11 #include "ash/public/cpp/window_properties.h" | 11 #include "ash/public/cpp/window_properties.h" |
12 #include "ash/shelf/app_list_button.h" | 12 #include "ash/shelf/app_list_button.h" |
13 #include "ash/shelf/shelf_button.h" | 13 #include "ash/shelf/shelf_button.h" |
14 #include "ash/shelf/shelf_constants.h" | 14 #include "ash/shelf/shelf_constants.h" |
15 #include "ash/shelf/shelf_model.h" | 15 #include "ash/shelf/shelf_model.h" |
16 #include "ash/shelf/shelf_view.h" | 16 #include "ash/shelf/shelf_view.h" |
17 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
18 #include "ash/shelf/wm_shelf.h" | 18 #include "ash/shelf/wm_shelf.h" |
19 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 20 #include "ash/shell_port.h" |
20 #include "ash/test/shelf_view_test_api.h" | 21 #include "ash/test/shelf_view_test_api.h" |
21 #include "ash/wm/window_properties.h" | 22 #include "ash/wm/window_properties.h" |
22 #include "ash/wm/window_state.h" | 23 #include "ash/wm/window_state.h" |
23 #include "ash/wm/window_state_aura.h" | 24 #include "ash/wm/window_state_aura.h" |
24 #include "ash/wm/window_util.h" | 25 #include "ash/wm/window_util.h" |
25 #include "ash/wm_shell.h" | |
26 #include "ash/wm_window.h" | 26 #include "ash/wm_window.h" |
27 #include "base/macros.h" | 27 #include "base/macros.h" |
28 #include "base/run_loop.h" | 28 #include "base/run_loop.h" |
29 #include "base/strings/stringprintf.h" | 29 #include "base/strings/stringprintf.h" |
30 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
31 #include "build/build_config.h" | 31 #include "build/build_config.h" |
32 #include "chrome/browser/apps/app_browsertest_util.h" | 32 #include "chrome/browser/apps/app_browsertest_util.h" |
33 #include "chrome/browser/chrome_notification_types.h" | 33 #include "chrome/browser/chrome_notification_types.h" |
34 #include "chrome/browser/extensions/extension_apitest.h" | 34 #include "chrome/browser/extensions/extension_apitest.h" |
35 #include "chrome/browser/extensions/extension_browsertest.h" | 35 #include "chrome/browser/extensions/extension_browsertest.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 ShelfAppBrowserTest() : shelf_(NULL), model_(NULL), controller_(NULL) { | 279 ShelfAppBrowserTest() : shelf_(NULL), model_(NULL), controller_(NULL) { |
280 } | 280 } |
281 | 281 |
282 ~ShelfAppBrowserTest() override {} | 282 ~ShelfAppBrowserTest() override {} |
283 | 283 |
284 void RunTestOnMainThreadLoop() override { | 284 void RunTestOnMainThreadLoop() override { |
285 // Ensure ash starts the session and creates the shelf and controller. | 285 // Ensure ash starts the session and creates the shelf and controller. |
286 SessionControllerClient::FlushForTesting(); | 286 SessionControllerClient::FlushForTesting(); |
287 | 287 |
288 shelf_ = | 288 shelf_ = |
289 ash::WmShelf::ForWindow(ash::WmShell::Get()->GetPrimaryRootWindow()); | 289 ash::WmShelf::ForWindow(ash::ShellPort::Get()->GetPrimaryRootWindow()); |
290 model_ = ash::Shell::Get()->shelf_model(); | 290 model_ = ash::Shell::Get()->shelf_model(); |
291 controller_ = GetChromeLauncherControllerImpl(); | 291 controller_ = GetChromeLauncherControllerImpl(); |
292 ASSERT_TRUE(controller_); | 292 ASSERT_TRUE(controller_); |
293 return ExtensionBrowserTest::RunTestOnMainThreadLoop(); | 293 return ExtensionBrowserTest::RunTestOnMainThreadLoop(); |
294 } | 294 } |
295 | 295 |
296 size_t NumberOfDetectedLauncherBrowsers(bool show_all_tabs) { | 296 size_t NumberOfDetectedLauncherBrowsers(bool show_all_tabs) { |
297 ash::ShelfItemDelegate* item_controller = | 297 ash::ShelfItemDelegate* item_controller = |
298 controller_->GetBrowserShortcutLauncherItemController(); | 298 controller_->GetBrowserShortcutLauncherItemController(); |
299 return item_controller | 299 return item_controller |
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 | 2409 |
2410 // Close all windows via the menu item. | 2410 // Close all windows via the menu item. |
2411 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2411 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
2412 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2412 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
2413 | 2413 |
2414 // Check if "Close" is removed from the context menu. | 2414 // Check if "Close" is removed from the context menu. |
2415 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2415 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
2416 ASSERT_FALSE( | 2416 ASSERT_FALSE( |
2417 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2417 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
2418 } | 2418 } |
OLD | NEW |