| 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 "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shelf/shelf_button.h" | 9 #include "ash/shelf/shelf_button.h" |
| 10 #include "ash/shelf/shelf_constants.h" | 10 #include "ash/shelf/shelf_constants.h" |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 | 929 |
| 930 // Confirm that clicking a icon for an app running in one of 2 maxmized windows | 930 // Confirm that clicking a icon for an app running in one of 2 maxmized windows |
| 931 // activates the right window. | 931 // activates the right window. |
| 932 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) { | 932 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) { |
| 933 aura::Window* window1 = browser()->window()->GetNativeWindow(); | 933 aura::Window* window1 = browser()->window()->GetNativeWindow(); |
| 934 ash::wm::WindowState* window1_state = ash::wm::GetWindowState(window1); | 934 ash::wm::WindowState* window1_state = ash::wm::GetWindowState(window1); |
| 935 window1_state->Maximize(); | 935 window1_state->Maximize(); |
| 936 content::WindowedNotificationObserver open_observer( | 936 content::WindowedNotificationObserver open_observer( |
| 937 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 937 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 938 content::NotificationService::AllSources()); | 938 content::NotificationService::AllSources()); |
| 939 chrome::NewEmptyWindow(browser()->profile(), chrome::HOST_DESKTOP_TYPE_ASH); | 939 chrome::NewEmptyWindow(browser()->profile(), ui::HOST_DESKTOP_TYPE_ASH); |
| 940 open_observer.Wait(); | 940 open_observer.Wait(); |
| 941 Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr(); | 941 Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr(); |
| 942 aura::Window* window2 = browser2->window()->GetNativeWindow(); | 942 aura::Window* window2 = browser2->window()->GetNativeWindow(); |
| 943 TabStripModel* tab_strip = browser2->tab_strip_model(); | 943 TabStripModel* tab_strip = browser2->tab_strip_model(); |
| 944 int tab_count = tab_strip->count(); | 944 int tab_count = tab_strip->count(); |
| 945 ash::wm::GetWindowState(window2)->Maximize(); | 945 ash::wm::GetWindowState(window2)->Maximize(); |
| 946 | 946 |
| 947 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 947 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
| 948 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); | 948 ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); |
| 949 EXPECT_EQ(++tab_count, tab_strip->count()); | 949 EXPECT_EQ(++tab_count, tab_strip->count()); |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 int tab_count1 = tab_strip->count(); | 1623 int tab_count1 = tab_strip->count(); |
| 1624 TabStripModel* tab_strip2 = browser2->tab_strip_model(); | 1624 TabStripModel* tab_strip2 = browser2->tab_strip_model(); |
| 1625 int tab_count2 = tab_strip2->count(); | 1625 int tab_count2 = tab_strip2->count(); |
| 1626 | 1626 |
| 1627 // Check that we have two browsers and the inactive browser remained inactive. | 1627 // Check that we have two browsers and the inactive browser remained inactive. |
| 1628 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 1628 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
| 1629 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()), | 1629 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()), |
| 1630 browser()); | 1630 browser()); |
| 1631 // Check that the LRU browser list does only contain the original browser. | 1631 // Check that the LRU browser list does only contain the original browser. |
| 1632 BrowserList* ash_browser_list = | 1632 BrowserList* ash_browser_list = |
| 1633 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 1633 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_ASH); |
| 1634 BrowserList::const_reverse_iterator it = | 1634 BrowserList::const_reverse_iterator it = |
| 1635 ash_browser_list->begin_last_active(); | 1635 ash_browser_list->begin_last_active(); |
| 1636 EXPECT_EQ(*it, browser()); | 1636 EXPECT_EQ(*it, browser()); |
| 1637 ++it; | 1637 ++it; |
| 1638 EXPECT_EQ(it, ash_browser_list->end_last_active()); | 1638 EXPECT_EQ(it, ash_browser_list->end_last_active()); |
| 1639 | 1639 |
| 1640 // Now request to either activate an existing app or create a new one. | 1640 // Now request to either activate an existing app or create a new one. |
| 1641 LauncherItemController* item_controller = | 1641 LauncherItemController* item_controller = |
| 1642 controller_->GetLauncherItemController(shortcut_id); | 1642 controller_->GetLauncherItemController(shortcut_id); |
| 1643 item_controller->ItemSelected(ui::KeyEvent(ui::ET_KEY_RELEASED, | 1643 item_controller->ItemSelected(ui::KeyEvent(ui::ET_KEY_RELEASED, |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 // We assume that the web store is always there (which it apparently is). | 2132 // We assume that the web store is always there (which it apparently is). |
| 2133 controller_->PinAppWithID(extensions::kWebStoreAppId); | 2133 controller_->PinAppWithID(extensions::kWebStoreAppId); |
| 2134 ash::ShelfID id = controller_->GetShelfIDForAppID( | 2134 ash::ShelfID id = controller_->GetShelfIDForAppID( |
| 2135 extensions::kWebStoreAppId); | 2135 extensions::kWebStoreAppId); |
| 2136 ASSERT_NE(0, id); | 2136 ASSERT_NE(0, id); |
| 2137 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(id)->status); | 2137 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(id)->status); |
| 2138 | 2138 |
| 2139 // Create a windowed application. | 2139 // Create a windowed application. |
| 2140 AppLaunchParams params( | 2140 AppLaunchParams params( |
| 2141 profile(), controller_->GetExtensionForAppID(extensions::kWebStoreAppId), | 2141 profile(), controller_->GetExtensionForAppID(extensions::kWebStoreAppId), |
| 2142 CURRENT_TAB, chrome::HOST_DESKTOP_TYPE_ASH, extensions::SOURCE_TEST); | 2142 CURRENT_TAB, ui::HOST_DESKTOP_TYPE_ASH, extensions::SOURCE_TEST); |
| 2143 params.container = extensions::LAUNCH_CONTAINER_WINDOW; | 2143 params.container = extensions::LAUNCH_CONTAINER_WINDOW; |
| 2144 OpenApplication(params); | 2144 OpenApplication(params); |
| 2145 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status); | 2145 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status); |
| 2146 | 2146 |
| 2147 // Find the browser which holds our app. | 2147 // Find the browser which holds our app. |
| 2148 Browser* app_browser = NULL; | 2148 Browser* app_browser = NULL; |
| 2149 const BrowserList* ash_browser_list = | 2149 const BrowserList* ash_browser_list = |
| 2150 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 2150 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_ASH); |
| 2151 for (BrowserList::const_reverse_iterator it = | 2151 for (BrowserList::const_reverse_iterator it = |
| 2152 ash_browser_list->begin_last_active(); | 2152 ash_browser_list->begin_last_active(); |
| 2153 it != ash_browser_list->end_last_active() && !app_browser; ++it) { | 2153 it != ash_browser_list->end_last_active() && !app_browser; ++it) { |
| 2154 if ((*it)->is_app()) { | 2154 if ((*it)->is_app()) { |
| 2155 app_browser = *it; | 2155 app_browser = *it; |
| 2156 break; | 2156 break; |
| 2157 } | 2157 } |
| 2158 } | 2158 } |
| 2159 ASSERT_TRUE(app_browser); | 2159 ASSERT_TRUE(app_browser); |
| 2160 | 2160 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2288 controller_->ActivateApp(bookmark_app->id(), ash::LAUNCH_FROM_APP_LIST, 0); | 2288 controller_->ActivateApp(bookmark_app->id(), ash::LAUNCH_FROM_APP_LIST, 0); |
| 2289 | 2289 |
| 2290 // There should be two new browsers. | 2290 // There should be two new browsers. |
| 2291 EXPECT_EQ(3u, chrome::GetTotalBrowserCountForProfile(browser()->profile())); | 2291 EXPECT_EQ(3u, chrome::GetTotalBrowserCountForProfile(browser()->profile())); |
| 2292 | 2292 |
| 2293 // The apps should now be running, with the last opened app active. | 2293 // The apps should now be running, with the last opened app active. |
| 2294 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(hosted_app_shelf_id)->status); | 2294 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(hosted_app_shelf_id)->status); |
| 2295 EXPECT_EQ(ash::STATUS_ACTIVE, | 2295 EXPECT_EQ(ash::STATUS_ACTIVE, |
| 2296 model_->ItemByID(bookmark_app_shelf_id)->status); | 2296 model_->ItemByID(bookmark_app_shelf_id)->status); |
| 2297 } | 2297 } |
| OLD | NEW |