| 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/shelf/app_list_button.h" | 9 #include "ash/common/shelf/app_list_button.h" |
| 10 #include "ash/common/shelf/shelf_button.h" | 10 #include "ash/common/shelf/shelf_button.h" |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 } | 919 } |
| 920 | 920 |
| 921 // Launches an app in the background and then tries to open it. This is test for | 921 // Launches an app in the background and then tries to open it. This is test for |
| 922 // a crash we had. | 922 // a crash we had. |
| 923 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchInBackground) { | 923 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchInBackground) { |
| 924 TabStripModel* tab_strip = browser()->tab_strip_model(); | 924 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| 925 int tab_count = tab_strip->count(); | 925 int tab_count = tab_strip->count(); |
| 926 LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, | 926 LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, |
| 927 WindowOpenDisposition::NEW_BACKGROUND_TAB); | 927 WindowOpenDisposition::NEW_BACKGROUND_TAB); |
| 928 EXPECT_EQ(++tab_count, tab_strip->count()); | 928 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 929 controller_->LaunchApp(last_loaded_extension_id(), | 929 controller_->LaunchApp( |
| 930 ash::LAUNCH_FROM_UNKNOWN, | 930 ash::launcher::AppLauncherId(last_loaded_extension_id()), |
| 931 0); | 931 ash::LAUNCH_FROM_UNKNOWN, 0); |
| 932 } | 932 } |
| 933 | 933 |
| 934 // Confirm that clicking a icon for an app running in one of 2 maxmized windows | 934 // Confirm that clicking a icon for an app running in one of 2 maxmized windows |
| 935 // activates the right window. | 935 // activates the right window. |
| 936 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) { | 936 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) { |
| 937 aura::Window* window1 = browser()->window()->GetNativeWindow(); | 937 aura::Window* window1 = browser()->window()->GetNativeWindow(); |
| 938 ash::wm::WindowState* window1_state = ash::wm::GetWindowState(window1); | 938 ash::wm::WindowState* window1_state = ash::wm::GetWindowState(window1); |
| 939 window1_state->Maximize(); | 939 window1_state->Maximize(); |
| 940 content::WindowedNotificationObserver open_observer( | 940 content::WindowedNotificationObserver open_observer( |
| 941 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 941 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 971 controller_->ActivateApp(extension->id(), ash::LAUNCH_FROM_UNKNOWN, 0); | 971 controller_->ActivateApp(extension->id(), ash::LAUNCH_FROM_UNKNOWN, 0); |
| 972 EXPECT_EQ(++tab_count, tab_strip->count()); | 972 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 973 controller_->ActivateApp(extension->id(), ash::LAUNCH_FROM_UNKNOWN, 0); | 973 controller_->ActivateApp(extension->id(), ash::LAUNCH_FROM_UNKNOWN, 0); |
| 974 EXPECT_EQ(tab_count, tab_strip->count()); | 974 EXPECT_EQ(tab_count, tab_strip->count()); |
| 975 } | 975 } |
| 976 | 976 |
| 977 // Launching the same app multiple times should launch a copy for each call. | 977 // Launching the same app multiple times should launch a copy for each call. |
| 978 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchApp) { | 978 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchApp) { |
| 979 TabStripModel* tab_strip = browser()->tab_strip_model(); | 979 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| 980 int tab_count = tab_strip->count(); | 980 int tab_count = tab_strip->count(); |
| 981 const Extension* extension = | 981 ash::launcher::AppLauncherId id( |
| 982 LoadExtension(test_data_dir_.AppendASCII("app1")); | 982 LoadExtension(test_data_dir_.AppendASCII("app1"))->id()); |
| 983 | 983 controller_->LaunchApp(id, ash::LAUNCH_FROM_UNKNOWN, 0); |
| 984 controller_->LaunchApp(extension->id(), ash::LAUNCH_FROM_UNKNOWN, 0); | |
| 985 EXPECT_EQ(++tab_count, tab_strip->count()); | 984 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 986 controller_->LaunchApp(extension->id(), ash::LAUNCH_FROM_UNKNOWN, 0); | 985 controller_->LaunchApp(id, ash::LAUNCH_FROM_UNKNOWN, 0); |
| 987 EXPECT_EQ(++tab_count, tab_strip->count()); | 986 EXPECT_EQ(++tab_count, tab_strip->count()); |
| 988 } | 987 } |
| 989 | 988 |
| 990 // Launch 2 apps and toggle which is active. | 989 // Launch 2 apps and toggle which is active. |
| 991 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) { | 990 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) { |
| 992 int item_count = model_->item_count(); | 991 int item_count = model_->item_count(); |
| 993 TabStripModel* tab_strip = browser()->tab_strip_model(); | 992 TabStripModel* tab_strip = browser()->tab_strip_model(); |
| 994 int tab_count = tab_strip->count(); | 993 int tab_count = tab_strip->count(); |
| 995 ash::ShelfID shortcut1 = CreateShortcut("app1"); | 994 ash::ShelfID shortcut1 = CreateShortcut("app1"); |
| 996 EXPECT_EQ(++item_count, model_->item_count()); | 995 EXPECT_EQ(++item_count, model_->item_count()); |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 | 2391 |
| 2393 // Close all windows via the menu item. | 2392 // Close all windows via the menu item. |
| 2394 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2393 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2395 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2394 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2396 | 2395 |
| 2397 // Check if "Close" is removed from the context menu. | 2396 // Check if "Close" is removed from the context menu. |
| 2398 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2397 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2399 ASSERT_FALSE( | 2398 ASSERT_FALSE( |
| 2400 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2399 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2401 } | 2400 } |
| OLD | NEW |