| 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/display/display_controller.h" | 8 #include "ash/display/display_controller.h" |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_button.h" | 10 #include "ash/shelf/shelf_button.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 private: | 335 private: |
| 336 | 336 |
| 337 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTest); | 337 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTest); |
| 338 }; | 338 }; |
| 339 | 339 |
| 340 class ShelfAppBrowserTestNoDefaultBrowser : public ShelfAppBrowserTest { | 340 class ShelfAppBrowserTestNoDefaultBrowser : public ShelfAppBrowserTest { |
| 341 protected: | 341 protected: |
| 342 ShelfAppBrowserTestNoDefaultBrowser() {} | 342 ShelfAppBrowserTestNoDefaultBrowser() {} |
| 343 virtual ~ShelfAppBrowserTestNoDefaultBrowser() {} | 343 virtual ~ShelfAppBrowserTestNoDefaultBrowser() {} |
| 344 | 344 |
| 345 virtual void SetUpCommandLine(CommandLine* command_line) override { | 345 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 346 ShelfAppBrowserTest::SetUpCommandLine(command_line); | 346 ShelfAppBrowserTest::SetUpCommandLine(command_line); |
| 347 command_line->AppendSwitch(switches::kNoStartupWindow); | 347 command_line->AppendSwitch(switches::kNoStartupWindow); |
| 348 } | 348 } |
| 349 | 349 |
| 350 private: | 350 private: |
| 351 | 351 |
| 352 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTestNoDefaultBrowser); | 352 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTestNoDefaultBrowser); |
| 353 }; | 353 }; |
| 354 | 354 |
| 355 // Since the default for minimizing on click might change, I added both classes | 355 // Since the default for minimizing on click might change, I added both classes |
| 356 // to either get the minimize on click or not. | 356 // to either get the minimize on click or not. |
| 357 class ShelfAppBrowserNoMinimizeOnClick : public LauncherPlatformAppBrowserTest { | 357 class ShelfAppBrowserNoMinimizeOnClick : public LauncherPlatformAppBrowserTest { |
| 358 protected: | 358 protected: |
| 359 ShelfAppBrowserNoMinimizeOnClick() {} | 359 ShelfAppBrowserNoMinimizeOnClick() {} |
| 360 virtual ~ShelfAppBrowserNoMinimizeOnClick() {} | 360 virtual ~ShelfAppBrowserNoMinimizeOnClick() {} |
| 361 | 361 |
| 362 virtual void SetUpCommandLine(CommandLine* command_line) override { | 362 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 363 LauncherPlatformAppBrowserTest::SetUpCommandLine(command_line); | 363 LauncherPlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 364 command_line->AppendSwitch( | 364 command_line->AppendSwitch( |
| 365 switches::kDisableMinimizeOnSecondLauncherItemClick); | 365 switches::kDisableMinimizeOnSecondLauncherItemClick); |
| 366 } | 366 } |
| 367 | 367 |
| 368 private: | 368 private: |
| 369 | 369 |
| 370 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserNoMinimizeOnClick); | 370 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserNoMinimizeOnClick); |
| 371 }; | 371 }; |
| 372 | 372 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 item1_controller->ItemSelected(click_event); | 797 item1_controller->ItemSelected(click_event); |
| 798 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 798 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 799 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 799 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 800 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 800 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 801 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); | 801 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); |
| 802 } | 802 } |
| 803 | 803 |
| 804 // Confirm that click behavior for app panels is correct. | 804 // Confirm that click behavior for app panels is correct. |
| 805 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) { | 805 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) { |
| 806 // Enable experimental APIs to allow panel creation. | 806 // Enable experimental APIs to allow panel creation. |
| 807 CommandLine::ForCurrentProcess()->AppendSwitch( | 807 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 808 extensions::switches::kEnableExperimentalExtensionApis); | 808 extensions::switches::kEnableExperimentalExtensionApis); |
| 809 // Launch a platform app and create a panel window for it. | 809 // Launch a platform app and create a panel window for it. |
| 810 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); | 810 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); |
| 811 AppWindow::CreateParams params; | 811 AppWindow::CreateParams params; |
| 812 params.window_type = AppWindow::WINDOW_TYPE_PANEL; | 812 params.window_type = AppWindow::WINDOW_TYPE_PANEL; |
| 813 params.focused = false; | 813 params.focused = false; |
| 814 AppWindow* panel = CreateAppWindowFromParams(extension1, params); | 814 AppWindow* panel = CreateAppWindowFromParams(extension1, params); |
| 815 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); | 815 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); |
| 816 // Panels should not be active by default. | 816 // Panels should not be active by default. |
| 817 EXPECT_FALSE(panel->GetBaseWindow()->IsActive()); | 817 EXPECT_FALSE(panel->GetBaseWindow()->IsActive()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 852 |
| 853 ash::wm::ActivateWindow(browser()->window()->GetNativeWindow()); | 853 ash::wm::ActivateWindow(browser()->window()->GetNativeWindow()); |
| 854 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); | 854 EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); |
| 855 } | 855 } |
| 856 | 856 |
| 857 // Test that opening an app sets the correct icon | 857 // Test that opening an app sets the correct icon |
| 858 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) { | 858 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) { |
| 859 TestAppWindowRegistryObserver test_observer(browser()->profile()); | 859 TestAppWindowRegistryObserver test_observer(browser()->profile()); |
| 860 | 860 |
| 861 // Enable experimental APIs to allow panel creation. | 861 // Enable experimental APIs to allow panel creation. |
| 862 CommandLine::ForCurrentProcess()->AppendSwitch( | 862 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 863 extensions::switches::kEnableExperimentalExtensionApis); | 863 extensions::switches::kEnableExperimentalExtensionApis); |
| 864 | 864 |
| 865 int base_shelf_item_count = shelf_model()->item_count(); | 865 int base_shelf_item_count = shelf_model()->item_count(); |
| 866 ExtensionTestMessageListener completed_listener("Completed", false); | 866 ExtensionTestMessageListener completed_listener("Completed", false); |
| 867 LoadAndLaunchPlatformApp("app_icon", "Launched"); | 867 LoadAndLaunchPlatformApp("app_icon", "Launched"); |
| 868 ASSERT_TRUE(completed_listener.WaitUntilSatisfied()); | 868 ASSERT_TRUE(completed_listener.WaitUntilSatisfied()); |
| 869 | 869 |
| 870 // Now wait until the WebContent has decoded the icons and chrome has | 870 // Now wait until the WebContent has decoded the icons and chrome has |
| 871 // processed it. This needs to be in a loop since the renderer runs in a | 871 // processed it. This needs to be in a loop since the renderer runs in a |
| 872 // different process. | 872 // different process. |
| (...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 | 1758 |
| 1759 #if !defined(OS_WIN) | 1759 #if !defined(OS_WIN) |
| 1760 // Used to test drag & drop an item between app list and shelf with multi | 1760 // Used to test drag & drop an item between app list and shelf with multi |
| 1761 // display environment. | 1761 // display environment. |
| 1762 class ShelfAppBrowserTestWithMultiMonitor | 1762 class ShelfAppBrowserTestWithMultiMonitor |
| 1763 : public ShelfAppBrowserTestNoDefaultBrowser { | 1763 : public ShelfAppBrowserTestNoDefaultBrowser { |
| 1764 protected: | 1764 protected: |
| 1765 ShelfAppBrowserTestWithMultiMonitor() {} | 1765 ShelfAppBrowserTestWithMultiMonitor() {} |
| 1766 virtual ~ShelfAppBrowserTestWithMultiMonitor() {} | 1766 virtual ~ShelfAppBrowserTestWithMultiMonitor() {} |
| 1767 | 1767 |
| 1768 virtual void SetUpCommandLine(CommandLine* command_line) override { | 1768 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 1769 ShelfAppBrowserTestNoDefaultBrowser::SetUpCommandLine(command_line); | 1769 ShelfAppBrowserTestNoDefaultBrowser::SetUpCommandLine(command_line); |
| 1770 command_line->AppendSwitchASCII("ash-host-window-bounds", | 1770 command_line->AppendSwitchASCII("ash-host-window-bounds", |
| 1771 "800x800,801+0-800x800"); | 1771 "800x800,801+0-800x800"); |
| 1772 } | 1772 } |
| 1773 | 1773 |
| 1774 private: | 1774 private: |
| 1775 | 1775 |
| 1776 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTestWithMultiMonitor); | 1776 DISALLOW_COPY_AND_ASSIGN(ShelfAppBrowserTestWithMultiMonitor); |
| 1777 }; | 1777 }; |
| 1778 | 1778 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2167 chrome::GetSettingsUrl(std::string())); | 2167 chrome::GetSettingsUrl(std::string())); |
| 2168 Browser* settings_browser = | 2168 Browser* settings_browser = |
| 2169 settings_manager->FindBrowserForProfile(browser()->profile()); | 2169 settings_manager->FindBrowserForProfile(browser()->profile()); |
| 2170 ASSERT_TRUE(settings_browser); | 2170 ASSERT_TRUE(settings_browser); |
| 2171 EXPECT_EQ(browser_count, NumberOfDetectedLauncherBrowsers(false)); | 2171 EXPECT_EQ(browser_count, NumberOfDetectedLauncherBrowsers(false)); |
| 2172 EXPECT_EQ(item_count + 1, shelf_model->item_count()); | 2172 EXPECT_EQ(item_count + 1, shelf_model->item_count()); |
| 2173 | 2173 |
| 2174 // TODO(stevenjb): Test multiprofile on Chrome OS when test support is addded. | 2174 // TODO(stevenjb): Test multiprofile on Chrome OS when test support is addded. |
| 2175 // crbug.com/230464. | 2175 // crbug.com/230464. |
| 2176 } | 2176 } |
| OLD | NEW |