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/aura/wm_window_aura.h" |
10 #include "ash/common/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
930 } | 930 } |
931 | 931 |
932 // Launches an app in the background and then tries to open it. This is test for | 932 // Launches an app in the background and then tries to open it. This is test for |
933 // a crash we had. | 933 // a crash we had. |
934 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchInBackground) { | 934 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchInBackground) { |
935 TabStripModel* tab_strip = browser()->tab_strip_model(); | 935 TabStripModel* tab_strip = browser()->tab_strip_model(); |
936 int tab_count = tab_strip->count(); | 936 int tab_count = tab_strip->count(); |
937 LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, | 937 LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, |
938 WindowOpenDisposition::NEW_BACKGROUND_TAB); | 938 WindowOpenDisposition::NEW_BACKGROUND_TAB); |
939 EXPECT_EQ(++tab_count, tab_strip->count()); | 939 EXPECT_EQ(++tab_count, tab_strip->count()); |
940 controller_->LaunchApp(last_loaded_extension_id(), | 940 controller_->LaunchApp(last_loaded_extension_id(), "", |
941 ash::LAUNCH_FROM_UNKNOWN, | 941 ash::LAUNCH_FROM_UNKNOWN, 0); |
942 0); | |
943 } | 942 } |
944 | 943 |
945 // Confirm that clicking a icon for an app running in one of 2 maxmized windows | 944 // Confirm that clicking a icon for an app running in one of 2 maxmized windows |
946 // activates the right window. | 945 // activates the right window. |
947 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) { | 946 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) { |
948 aura::Window* window1 = browser()->window()->GetNativeWindow(); | 947 aura::Window* window1 = browser()->window()->GetNativeWindow(); |
949 ash::wm::WindowState* window1_state = ash::wm::GetWindowState(window1); | 948 ash::wm::WindowState* window1_state = ash::wm::GetWindowState(window1); |
950 window1_state->Maximize(); | 949 window1_state->Maximize(); |
951 content::WindowedNotificationObserver open_observer( | 950 content::WindowedNotificationObserver open_observer( |
952 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 951 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
985 EXPECT_EQ(tab_count, tab_strip->count()); | 984 EXPECT_EQ(tab_count, tab_strip->count()); |
986 } | 985 } |
987 | 986 |
988 // Launching the same app multiple times should launch a copy for each call. | 987 // Launching the same app multiple times should launch a copy for each call. |
989 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchApp) { | 988 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchApp) { |
990 TabStripModel* tab_strip = browser()->tab_strip_model(); | 989 TabStripModel* tab_strip = browser()->tab_strip_model(); |
991 int tab_count = tab_strip->count(); | 990 int tab_count = tab_strip->count(); |
992 const Extension* extension = | 991 const Extension* extension = |
993 LoadExtension(test_data_dir_.AppendASCII("app1")); | 992 LoadExtension(test_data_dir_.AppendASCII("app1")); |
994 | 993 |
995 controller_->LaunchApp(extension->id(), ash::LAUNCH_FROM_UNKNOWN, 0); | 994 controller_->LaunchApp(extension->id(), "", ash::LAUNCH_FROM_UNKNOWN, 0); |
996 EXPECT_EQ(++tab_count, tab_strip->count()); | 995 EXPECT_EQ(++tab_count, tab_strip->count()); |
997 controller_->LaunchApp(extension->id(), ash::LAUNCH_FROM_UNKNOWN, 0); | 996 controller_->LaunchApp(extension->id(), "", ash::LAUNCH_FROM_UNKNOWN, 0); |
998 EXPECT_EQ(++tab_count, tab_strip->count()); | 997 EXPECT_EQ(++tab_count, tab_strip->count()); |
999 } | 998 } |
1000 | 999 |
1001 // Launch 2 apps and toggle which is active. | 1000 // Launch 2 apps and toggle which is active. |
1002 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) { | 1001 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) { |
1003 int item_count = model_->item_count(); | 1002 int item_count = model_->item_count(); |
1004 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1003 TabStripModel* tab_strip = browser()->tab_strip_model(); |
1005 int tab_count = tab_strip->count(); | 1004 int tab_count = tab_strip->count(); |
1006 ash::ShelfID shortcut1 = CreateShortcut("app1"); | 1005 ash::ShelfID shortcut1 = CreateShortcut("app1"); |
1007 EXPECT_EQ(++item_count, model_->item_count()); | 1006 EXPECT_EQ(++item_count, model_->item_count()); |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2417 IsItemPresentInMenu(menu1.get(), LauncherContextMenu::MENU_CLOSE)); | 2416 IsItemPresentInMenu(menu1.get(), LauncherContextMenu::MENU_CLOSE)); |
2418 | 2417 |
2419 // Close all windows via the menu item. | 2418 // Close all windows via the menu item. |
2420 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2419 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
2421 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2420 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
2422 | 2421 |
2423 // Check if "Close" is removed from the context menu. | 2422 // Check if "Close" is removed from the context menu. |
2424 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2423 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
2425 ASSERT_FALSE( | 2424 ASSERT_FALSE( |
2426 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2425 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
2427 } | 2426 } |
Mr4D (OOO till 08-26)
2016/12/03 01:55:27
Could you add a unit test to test that you get in
Andra Paraschiv
2016/12/06 13:19:16
Yes, I can add another unit test for the restoring
| |
OLD | NEW |