| 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.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 test->RunMessageLoopUntilAnimationsDone(); | 365 test->RunMessageLoopUntilAnimationsDone(); |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 std::unique_ptr<LauncherContextMenu> CreateLauncherContextMenu( | 369 std::unique_ptr<LauncherContextMenu> CreateLauncherContextMenu( |
| 370 ash::ShelfItemType shelf_item_type) { | 370 ash::ShelfItemType shelf_item_type) { |
| 371 ash::ShelfItem item; | 371 ash::ShelfItem item; |
| 372 item.id = 1; // dummy id | 372 item.id = 1; // dummy id |
| 373 item.type = shelf_item_type; | 373 item.type = shelf_item_type; |
| 374 ash::Shelf* shelf = ash::Shelf::ForWindow(CurrentContext()); | 374 ash::Shelf* shelf = ash::Shelf::ForWindow(CurrentContext()); |
| 375 std::unique_ptr<LauncherContextMenu> menu( | 375 std::unique_ptr<LauncherContextMenu> menu(LauncherContextMenu::Create( |
| 376 LauncherContextMenu::Create(controller_, &item, shelf)); | 376 controller_, &item, ash::test::ShelfTestAPI(shelf).wm_shelf())); |
| 377 return menu; | 377 return menu; |
| 378 } | 378 } |
| 379 | 379 |
| 380 aura::Window* CurrentContext() { | 380 aura::Window* CurrentContext() { |
| 381 aura::Window* root_window = ash::Shell::GetTargetRootWindow(); | 381 aura::Window* root_window = ash::Shell::GetTargetRootWindow(); |
| 382 DCHECK(root_window); | 382 DCHECK(root_window); |
| 383 return root_window; | 383 return root_window; |
| 384 } | 384 } |
| 385 | 385 |
| 386 bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { | 386 bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { |
| (...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2291 // Close all windows. | 2291 // Close all windows. |
| 2292 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2292 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2293 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2293 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2294 | 2294 |
| 2295 // Check if "Close" is removed from the context menu. | 2295 // Check if "Close" is removed from the context menu. |
| 2296 std::unique_ptr<LauncherContextMenu> menu2 = | 2296 std::unique_ptr<LauncherContextMenu> menu2 = |
| 2297 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT); | 2297 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT); |
| 2298 ASSERT_FALSE( | 2298 ASSERT_FALSE( |
| 2299 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2299 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2300 } | 2300 } |
| OLD | NEW |