OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "apps/shell_window.h" | 7 #include "apps/shell_window.h" |
8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "chrome/browser/ui/extensions/application_launch.h" | 38 #include "chrome/browser/ui/extensions/application_launch.h" |
39 #include "chrome/browser/ui/extensions/native_app_window.h" | 39 #include "chrome/browser/ui/extensions/native_app_window.h" |
40 #include "chrome/browser/ui/host_desktop.h" | 40 #include "chrome/browser/ui/host_desktop.h" |
41 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 41 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
42 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
43 #include "chrome/common/extensions/extension_constants.h" | 43 #include "chrome/common/extensions/extension_constants.h" |
44 #include "chrome/test/base/ui_test_utils.h" | 44 #include "chrome/test/base/ui_test_utils.h" |
45 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
46 #include "content/public/browser/notification_source.h" | 46 #include "content/public/browser/notification_source.h" |
47 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
| 48 #include "extensions/common/switches.h" |
48 #include "testing/gtest/include/gtest/gtest.h" | 49 #include "testing/gtest/include/gtest/gtest.h" |
49 #include "ui/app_list/views/apps_grid_view.h" | 50 #include "ui/app_list/views/apps_grid_view.h" |
50 #include "ui/aura/test/event_generator.h" | 51 #include "ui/aura/test/event_generator.h" |
51 #include "ui/aura/window.h" | 52 #include "ui/aura/window.h" |
52 #include "ui/base/events/event.h" | 53 #include "ui/base/events/event.h" |
53 | 54 |
54 using apps::ShellWindow; | 55 using apps::ShellWindow; |
55 using extensions::Extension; | 56 using extensions::Extension; |
56 using content::WebContents; | 57 using content::WebContents; |
57 | 58 |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 689 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
689 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 690 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
690 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); | 691 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); |
691 } | 692 } |
692 | 693 |
693 // Confirm that click behavior for app panels is correct. | 694 // Confirm that click behavior for app panels is correct. |
694 IN_PROC_BROWSER_TEST_F(LauncherPlatformPerAppAppBrowserTest, | 695 IN_PROC_BROWSER_TEST_F(LauncherPlatformPerAppAppBrowserTest, |
695 AppPanelClickBehavior) { | 696 AppPanelClickBehavior) { |
696 // Enable experimental APIs to allow panel creation. | 697 // Enable experimental APIs to allow panel creation. |
697 CommandLine::ForCurrentProcess()->AppendSwitch( | 698 CommandLine::ForCurrentProcess()->AppendSwitch( |
698 switches::kEnableExperimentalExtensionApis); | 699 extensions::switches::kEnableExperimentalExtensionApis); |
699 // Launch a platform app and create a panel window for it. | 700 // Launch a platform app and create a panel window for it. |
700 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); | 701 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); |
701 ShellWindow::CreateParams params; | 702 ShellWindow::CreateParams params; |
702 params.window_type = ShellWindow::WINDOW_TYPE_PANEL; | 703 params.window_type = ShellWindow::WINDOW_TYPE_PANEL; |
703 params.focused = false; | 704 params.focused = false; |
704 ShellWindow* panel = CreateShellWindowFromParams(extension1, params); | 705 ShellWindow* panel = CreateShellWindowFromParams(extension1, params); |
705 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); | 706 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); |
706 // Panels should not be active by default. | 707 // Panels should not be active by default. |
707 EXPECT_FALSE(panel->GetBaseWindow()->IsActive()); | 708 EXPECT_FALSE(panel->GetBaseWindow()->IsActive()); |
708 // Confirm that a controller item was created and is the correct state. | 709 // Confirm that a controller item was created and is the correct state. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 EXPECT_EQ(ash::STATUS_RUNNING, | 746 EXPECT_EQ(ash::STATUS_RUNNING, |
746 launcher_model()->ItemByID(item_id1)->status); | 747 launcher_model()->ItemByID(item_id1)->status); |
747 } | 748 } |
748 | 749 |
749 // Test that opening an app sets the correct icon | 750 // Test that opening an app sets the correct icon |
750 IN_PROC_BROWSER_TEST_F(LauncherPlatformPerAppAppBrowserTest, SetIcon) { | 751 IN_PROC_BROWSER_TEST_F(LauncherPlatformPerAppAppBrowserTest, SetIcon) { |
751 TestShellWindowRegistryObserver test_observer(browser()->profile()); | 752 TestShellWindowRegistryObserver test_observer(browser()->profile()); |
752 | 753 |
753 // Enable experimental APIs to allow panel creation. | 754 // Enable experimental APIs to allow panel creation. |
754 CommandLine::ForCurrentProcess()->AppendSwitch( | 755 CommandLine::ForCurrentProcess()->AppendSwitch( |
755 switches::kEnableExperimentalExtensionApis); | 756 extensions::switches::kEnableExperimentalExtensionApis); |
756 | 757 |
757 int base_launcher_item_count = launcher_model()->item_count(); | 758 int base_launcher_item_count = launcher_model()->item_count(); |
758 ExtensionTestMessageListener launched_listener("Launched", false); | 759 ExtensionTestMessageListener launched_listener("Launched", false); |
759 ExtensionTestMessageListener completed_listener("Completed", false); | 760 ExtensionTestMessageListener completed_listener("Completed", false); |
760 LoadAndLaunchPlatformApp("app_icon"); | 761 LoadAndLaunchPlatformApp("app_icon"); |
761 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 762 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
762 ASSERT_TRUE(completed_listener.WaitUntilSatisfied()); | 763 ASSERT_TRUE(completed_listener.WaitUntilSatisfied()); |
763 | 764 |
764 // Now wait until the WebContent has decoded the icons and chrome has | 765 // Now wait until the WebContent has decoded the icons and chrome has |
765 // processed it. This needs to be in a loop since the renderer runs in a | 766 // processed it. This needs to be in a loop since the renderer runs in a |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 EXPECT_TRUE(ash::wm::IsWindowMinimized(window)); | 1512 EXPECT_TRUE(ash::wm::IsWindowMinimized(window)); |
1512 | 1513 |
1513 // Activate again. This doesn't create new browser. | 1514 // Activate again. This doesn't create new browser. |
1514 // It activates window. | 1515 // It activates window. |
1515 item_controller->Activate(); | 1516 item_controller->Activate(); |
1516 running_browser = chrome::GetTotalBrowserCount(); | 1517 running_browser = chrome::GetTotalBrowserCount(); |
1517 EXPECT_EQ(1u, running_browser); | 1518 EXPECT_EQ(1u, running_browser); |
1518 EXPECT_TRUE(item_controller->IsOpen()); | 1519 EXPECT_TRUE(item_controller->IsOpen()); |
1519 EXPECT_FALSE(ash::wm::IsWindowMinimized(window)); | 1520 EXPECT_FALSE(ash::wm::IsWindowMinimized(window)); |
1520 } | 1521 } |
OLD | NEW |