| 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/aura/wm_window_aura.h" |
| 9 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/shelf/app_list_button.h" | 11 #include "ash/common/shelf/app_list_button.h" |
| 11 #include "ash/common/shelf/shelf_button.h" | 12 #include "ash/common/shelf/shelf_button.h" |
| 12 #include "ash/common/shelf/shelf_constants.h" | 13 #include "ash/common/shelf/shelf_constants.h" |
| 13 #include "ash/common/shelf/shelf_model.h" | 14 #include "ash/common/shelf/shelf_model.h" |
| 14 #include "ash/common/shelf/shelf_view.h" | 15 #include "ash/common/shelf/shelf_view.h" |
| 15 #include "ash/common/wm/window_state.h" | 16 #include "ash/common/wm/window_state.h" |
| 16 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
| 17 #include "ash/shelf/shelf.h" | 18 #include "ash/shelf/shelf.h" |
| 18 #include "ash/shelf/shelf_util.h" | 19 #include "ash/shelf/shelf_util.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 base::RunLoop().RunUntilIdle(); | 370 base::RunLoop().RunUntilIdle(); |
| 370 test->RunMessageLoopUntilAnimationsDone(); | 371 test->RunMessageLoopUntilAnimationsDone(); |
| 371 } | 372 } |
| 372 } | 373 } |
| 373 | 374 |
| 374 // Creates a context menu for the existing browser shortcut item. | 375 // Creates a context menu for the existing browser shortcut item. |
| 375 std::unique_ptr<LauncherContextMenu> CreateBrowserItemContextMenu() { | 376 std::unique_ptr<LauncherContextMenu> CreateBrowserItemContextMenu() { |
| 376 int index = model_->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT); | 377 int index = model_->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT); |
| 377 DCHECK_GE(index, 0); | 378 DCHECK_GE(index, 0); |
| 378 ash::ShelfItem item = model_->items()[index]; | 379 ash::ShelfItem item = model_->items()[index]; |
| 379 ash::Shelf* shelf = ash::Shelf::ForWindow(CurrentContext()); | 380 ash::Shelf* shelf = |
| 381 ash::Shelf::ForWindow(ash::WmWindowAura::Get(CurrentContext())); |
| 380 std::unique_ptr<LauncherContextMenu> menu(LauncherContextMenu::Create( | 382 std::unique_ptr<LauncherContextMenu> menu(LauncherContextMenu::Create( |
| 381 controller_, &item, ash::test::ShelfTestAPI(shelf).wm_shelf())); | 383 controller_, &item, ash::test::ShelfTestAPI(shelf).wm_shelf())); |
| 382 return menu; | 384 return menu; |
| 383 } | 385 } |
| 384 | 386 |
| 385 aura::Window* CurrentContext() { | 387 aura::Window* CurrentContext() { |
| 386 aura::Window* root_window = ash::Shell::GetTargetRootWindow(); | 388 aura::Window* root_window = ash::Shell::GetTargetRootWindow(); |
| 387 DCHECK(root_window); | 389 DCHECK(root_window); |
| 388 return root_window; | 390 return root_window; |
| 389 } | 391 } |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTestWithMultiMonitor); | 1893 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTestWithMultiMonitor); |
| 1892 }; | 1894 }; |
| 1893 | 1895 |
| 1894 // Do basic drag and drop interaction tests between the application list and | 1896 // Do basic drag and drop interaction tests between the application list and |
| 1895 // the launcher in the secondary monitor. | 1897 // the launcher in the secondary monitor. |
| 1896 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestWithMultiMonitor, | 1898 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestWithMultiMonitor, |
| 1897 BasicDragAndDrop) { | 1899 BasicDragAndDrop) { |
| 1898 // Get a number of interfaces we need. | 1900 // Get a number of interfaces we need. |
| 1899 DCHECK_EQ(ash::Shell::GetAllRootWindows().size(), 2U); | 1901 DCHECK_EQ(ash::Shell::GetAllRootWindows().size(), 2U); |
| 1900 aura::Window* secondary_root_window = ash::Shell::GetAllRootWindows()[1]; | 1902 aura::Window* secondary_root_window = ash::Shell::GetAllRootWindows()[1]; |
| 1901 ash::Shelf* secondary_shelf = ash::Shelf::ForWindow(secondary_root_window); | 1903 ash::Shelf* secondary_shelf = |
| 1904 ash::Shelf::ForWindow(ash::WmWindowAura::Get(secondary_root_window)); |
| 1902 | 1905 |
| 1903 ui::test::EventGenerator generator(secondary_root_window, gfx::Point()); | 1906 ui::test::EventGenerator generator(secondary_root_window, gfx::Point()); |
| 1904 ash::test::ShelfViewTestAPI test( | 1907 ash::test::ShelfViewTestAPI test( |
| 1905 ash::test::ShelfTestAPI(secondary_shelf).shelf_view()); | 1908 ash::test::ShelfTestAPI(secondary_shelf).shelf_view()); |
| 1906 AppListService* service = AppListService::Get(); | 1909 AppListService* service = AppListService::Get(); |
| 1907 | 1910 |
| 1908 // There should be two items in our shelf by this time. | 1911 // There should be two items in our shelf by this time. |
| 1909 EXPECT_EQ(2, model_->item_count()); | 1912 EXPECT_EQ(2, model_->item_count()); |
| 1910 EXPECT_FALSE(service->IsAppListVisible()); | 1913 EXPECT_FALSE(service->IsAppListVisible()); |
| 1911 | 1914 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 | 2403 |
| 2401 // Close all windows via the menu item. | 2404 // Close all windows via the menu item. |
| 2402 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2405 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2403 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2406 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2404 | 2407 |
| 2405 // Check if "Close" is removed from the context menu. | 2408 // Check if "Close" is removed from the context menu. |
| 2406 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2409 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2407 ASSERT_FALSE( | 2410 ASSERT_FALSE( |
| 2408 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2411 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2409 } | 2412 } |
| OLD | NEW |