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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.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()); |
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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 | 1598 |
1599 // Checks that after a session restore, we do not start applications on an | 1599 // Checks that after a session restore, we do not start applications on an |
1600 // activation. | 1600 // activation. |
1601 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateAfterSessionRestore) { | 1601 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateAfterSessionRestore) { |
1602 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 1602 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
1603 | 1603 |
1604 // Create a known application. | 1604 // Create a known application. |
1605 ash::ShelfID shortcut_id = CreateShortcut("app1"); | 1605 ash::ShelfID shortcut_id = CreateShortcut("app1"); |
1606 | 1606 |
1607 // Create a new browser - without activating it - and load an "app" into it. | 1607 // Create a new browser - without activating it - and load an "app" into it. |
1608 Browser::CreateParams params = | 1608 Browser::CreateParams params = Browser::CreateParams(profile()); |
1609 Browser::CreateParams(profile(), chrome::GetActiveDesktop()); | |
1610 params.initial_show_state = ui::SHOW_STATE_INACTIVE; | 1609 params.initial_show_state = ui::SHOW_STATE_INACTIVE; |
1611 Browser* browser2 = new Browser(params); | 1610 Browser* browser2 = new Browser(params); |
1612 controller_->SetRefocusURLPatternForTest( | 1611 controller_->SetRefocusURLPatternForTest( |
1613 shortcut_id, GURL("http://www.example.com/path/*")); | 1612 shortcut_id, GURL("http://www.example.com/path/*")); |
1614 std::string url = "http://www.example.com/path/bla"; | 1613 std::string url = "http://www.example.com/path/bla"; |
1615 ui_test_utils::NavigateToURLWithDisposition( | 1614 ui_test_utils::NavigateToURLWithDisposition( |
1616 browser2, | 1615 browser2, |
1617 GURL(url), | 1616 GURL(url), |
1618 NEW_FOREGROUND_TAB, | 1617 NEW_FOREGROUND_TAB, |
1619 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1618 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 controller_->ActivateApp(bookmark_app->id(), ash::LAUNCH_FROM_APP_LIST, 0); | 2284 controller_->ActivateApp(bookmark_app->id(), ash::LAUNCH_FROM_APP_LIST, 0); |
2286 | 2285 |
2287 // There should be two new browsers. | 2286 // There should be two new browsers. |
2288 EXPECT_EQ(3u, chrome::GetBrowserCount(browser()->profile())); | 2287 EXPECT_EQ(3u, chrome::GetBrowserCount(browser()->profile())); |
2289 | 2288 |
2290 // The apps should now be running, with the last opened app active. | 2289 // The apps should now be running, with the last opened app active. |
2291 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(hosted_app_shelf_id)->status); | 2290 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(hosted_app_shelf_id)->status); |
2292 EXPECT_EQ(ash::STATUS_ACTIVE, | 2291 EXPECT_EQ(ash::STATUS_ACTIVE, |
2293 model_->ItemByID(bookmark_app_shelf_id)->status); | 2292 model_->ItemByID(bookmark_app_shelf_id)->status); |
2294 } | 2293 } |
OLD | NEW |