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