| 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/common/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
| 11 #include "ash/common/shelf/shelf_constants.h" | 11 #include "ash/common/shelf/shelf_constants.h" |
| 12 #include "ash/common/shelf/shelf_model.h" | 12 #include "ash/common/shelf/shelf_model.h" |
| 13 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
| 14 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 15 #include "ash/shelf/shelf.h" | 15 #include "ash/shelf/shelf.h" |
| 16 #include "ash/shelf/shelf_button.h" | 16 #include "ash/shelf/shelf_button.h" |
| 17 #include "ash/shelf/shelf_util.h" | 17 #include "ash/shelf/shelf_util.h" |
| 18 #include "ash/shelf/shelf_view.h" | 18 #include "ash/shelf/shelf_view.h" |
| 19 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 20 #include "ash/test/shelf_test_api.h" | 20 #include "ash/test/shelf_test_api.h" |
| 21 #include "ash/test/shelf_view_test_api.h" | 21 #include "ash/test/shelf_view_test_api.h" |
| 22 #include "ash/test/shell_test_api.h" | |
| 23 #include "ash/wm/window_state_aura.h" | 22 #include "ash/wm/window_state_aura.h" |
| 24 #include "ash/wm/window_util.h" | 23 #include "ash/wm/window_util.h" |
| 25 #include "base/macros.h" | 24 #include "base/macros.h" |
| 26 #include "base/run_loop.h" | 25 #include "base/run_loop.h" |
| 27 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
| 28 #include "base/strings/utf_string_conversions.h" | 27 #include "base/strings/utf_string_conversions.h" |
| 29 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 30 #include "chrome/browser/apps/app_browsertest_util.h" | 29 #include "chrome/browser/apps/app_browsertest_util.h" |
| 31 #include "chrome/browser/chrome_notification_types.h" | 30 #include "chrome/browser/chrome_notification_types.h" |
| 32 #include "chrome/browser/extensions/extension_apitest.h" | 31 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 192 } |
| 194 | 193 |
| 195 ~LauncherPlatformAppBrowserTest() override {} | 194 ~LauncherPlatformAppBrowserTest() override {} |
| 196 | 195 |
| 197 void RunTestOnMainThreadLoop() override { | 196 void RunTestOnMainThreadLoop() override { |
| 198 shelf_ = ash::Shelf::ForPrimaryDisplay(); | 197 shelf_ = ash::Shelf::ForPrimaryDisplay(); |
| 199 controller_ = GetChromeLauncherControllerImpl(); | 198 controller_ = GetChromeLauncherControllerImpl(); |
| 200 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); | 199 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); |
| 201 } | 200 } |
| 202 | 201 |
| 203 ash::ShelfModel* shelf_model() { | 202 ash::ShelfModel* shelf_model() { return ash::WmShell::Get()->shelf_model(); } |
| 204 return ash::test::ShellTestApi(ash::Shell::GetInstance()).shelf_model(); | |
| 205 } | |
| 206 | 203 |
| 207 ash::ShelfID CreateAppShortcutLauncherItem(const std::string& name) { | 204 ash::ShelfID CreateAppShortcutLauncherItem(const std::string& name) { |
| 208 return controller_->CreateAppShortcutLauncherItem( | 205 return controller_->CreateAppShortcutLauncherItem( |
| 209 name, shelf_model()->item_count()); | 206 name, shelf_model()->item_count()); |
| 210 } | 207 } |
| 211 | 208 |
| 212 const ash::ShelfItem& GetLastLauncherItem() { | 209 const ash::ShelfItem& GetLastLauncherItem() { |
| 213 // Unless there are any panels, the item at index [count - 1] will be | 210 // Unless there are any panels, the item at index [count - 1] will be |
| 214 // the desired item. | 211 // the desired item. |
| 215 return shelf_model()->items()[shelf_model()->item_count() - 1]; | 212 return shelf_model()->items()[shelf_model()->item_count() - 1]; |
| (...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2403 | 2400 |
| 2404 // Close all windows via the menu item. | 2401 // Close all windows via the menu item. |
| 2405 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2402 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2406 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2403 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2407 | 2404 |
| 2408 // Check if "Close" is removed from the context menu. | 2405 // Check if "Close" is removed from the context menu. |
| 2409 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2406 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2410 ASSERT_FALSE( | 2407 ASSERT_FALSE( |
| 2411 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2408 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2412 } | 2409 } |
| OLD | NEW |