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 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/ui/app_list/app_list_service.h" | 31 #include "chrome/browser/ui/app_list/app_list_service.h" |
32 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 32 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
33 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 33 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
34 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 34 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
35 #include "chrome/browser/ui/browser.h" | 35 #include "chrome/browser/ui/browser.h" |
36 #include "chrome/browser/ui/browser_commands.h" | 36 #include "chrome/browser/ui/browser_commands.h" |
37 #include "chrome/browser/ui/browser_finder.h" | 37 #include "chrome/browser/ui/browser_finder.h" |
38 #include "chrome/browser/ui/browser_list.h" | 38 #include "chrome/browser/ui/browser_list.h" |
39 #include "chrome/browser/ui/browser_window.h" | 39 #include "chrome/browser/ui/browser_window.h" |
40 #include "chrome/browser/ui/chrome_pages.h" | 40 #include "chrome/browser/ui/chrome_pages.h" |
| 41 #include "chrome/browser/ui/extensions/app_launch_params.h" |
41 #include "chrome/browser/ui/extensions/application_launch.h" | 42 #include "chrome/browser/ui/extensions/application_launch.h" |
42 #include "chrome/browser/ui/host_desktop.h" | 43 #include "chrome/browser/ui/host_desktop.h" |
43 #include "chrome/browser/ui/settings_window_manager.h" | 44 #include "chrome/browser/ui/settings_window_manager.h" |
44 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 45 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
45 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
46 #include "chrome/test/base/ui_test_utils.h" | 47 #include "chrome/test/base/ui_test_utils.h" |
47 #include "content/public/browser/notification_service.h" | 48 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/notification_source.h" | 49 #include "content/public/browser/notification_source.h" |
49 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
50 #include "content/public/test/browser_test_utils.h" | 51 #include "content/public/test/browser_test_utils.h" |
51 #include "extensions/browser/app_window/app_window.h" | 52 #include "extensions/browser/app_window/app_window.h" |
52 #include "extensions/browser/app_window/app_window_registry.h" | 53 #include "extensions/browser/app_window/app_window_registry.h" |
53 #include "extensions/browser/app_window/native_app_window.h" | 54 #include "extensions/browser/app_window/native_app_window.h" |
54 #include "extensions/browser/extension_system.h" | 55 #include "extensions/browser/extension_system.h" |
55 #include "extensions/common/constants.h" | 56 #include "extensions/common/constants.h" |
56 #include "extensions/common/switches.h" | 57 #include "extensions/common/switches.h" |
57 #include "extensions/test/extension_test_message_listener.h" | 58 #include "extensions/test/extension_test_message_listener.h" |
58 #include "testing/gtest/include/gtest/gtest.h" | 59 #include "testing/gtest/include/gtest/gtest.h" |
59 #include "ui/app_list/views/app_list_item_view.h" | 60 #include "ui/app_list/views/app_list_item_view.h" |
60 #include "ui/app_list/views/apps_grid_view.h" | 61 #include "ui/app_list/views/apps_grid_view.h" |
61 #include "ui/aura/client/aura_constants.h" | 62 #include "ui/aura/client/aura_constants.h" |
62 #include "ui/aura/window.h" | 63 #include "ui/aura/window.h" |
| 64 #include "ui/base/window_open_disposition.h" |
63 #include "ui/events/event.h" | 65 #include "ui/events/event.h" |
64 #include "ui/events/test/event_generator.h" | 66 #include "ui/events/test/event_generator.h" |
65 | 67 |
66 using extensions::AppWindow; | 68 using extensions::AppWindow; |
67 using extensions::Extension; | 69 using extensions::Extension; |
68 using content::WebContents; | 70 using content::WebContents; |
69 | 71 |
70 namespace { | 72 namespace { |
71 | 73 |
72 class TestEvent : public ui::Event { | 74 class TestEvent : public ui::Event { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 extensions::LaunchContainer container, | 215 extensions::LaunchContainer container, |
214 WindowOpenDisposition disposition) { | 216 WindowOpenDisposition disposition) { |
215 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name))); | 217 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name))); |
216 | 218 |
217 ExtensionService* service = extensions::ExtensionSystem::Get( | 219 ExtensionService* service = extensions::ExtensionSystem::Get( |
218 profile())->extension_service(); | 220 profile())->extension_service(); |
219 const Extension* extension = | 221 const Extension* extension = |
220 service->GetExtensionById(last_loaded_extension_id(), false); | 222 service->GetExtensionById(last_loaded_extension_id(), false); |
221 EXPECT_TRUE(extension); | 223 EXPECT_TRUE(extension); |
222 | 224 |
223 OpenApplication(AppLaunchParams(profile(), | 225 OpenApplication(AppLaunchParams(profile(), extension, container, |
224 extension, | 226 disposition, extensions::SOURCE_UNTRACKED)); |
225 container, | |
226 disposition)); | |
227 return extension; | 227 return extension; |
228 } | 228 } |
229 | 229 |
230 ash::ShelfID CreateShortcut(const char* name) { | 230 ash::ShelfID CreateShortcut(const char* name) { |
231 ExtensionService* service = extensions::ExtensionSystem::Get( | 231 ExtensionService* service = extensions::ExtensionSystem::Get( |
232 profile())->extension_service(); | 232 profile())->extension_service(); |
233 LoadExtension(test_data_dir_.AppendASCII(name)); | 233 LoadExtension(test_data_dir_.AppendASCII(name)); |
234 | 234 |
235 // First get app_id. | 235 // First get app_id. |
236 const Extension* extension = | 236 const Extension* extension = |
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, V1AppNavigation) { | 2071 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, V1AppNavigation) { |
2072 // We assume that the web store is always there (which it apparently is). | 2072 // We assume that the web store is always there (which it apparently is). |
2073 controller_->PinAppWithID(extensions::kWebStoreAppId); | 2073 controller_->PinAppWithID(extensions::kWebStoreAppId); |
2074 ash::ShelfID id = controller_->GetShelfIDForAppID( | 2074 ash::ShelfID id = controller_->GetShelfIDForAppID( |
2075 extensions::kWebStoreAppId); | 2075 extensions::kWebStoreAppId); |
2076 ASSERT_NE(0, id); | 2076 ASSERT_NE(0, id); |
2077 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(id)->status); | 2077 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(id)->status); |
2078 | 2078 |
2079 // Create a windowed application. | 2079 // Create a windowed application. |
2080 AppLaunchParams params( | 2080 AppLaunchParams params( |
2081 profile(), | 2081 profile(), controller_->GetExtensionForAppID(extensions::kWebStoreAppId), |
2082 controller_->GetExtensionForAppID(extensions::kWebStoreAppId), | 2082 CURRENT_TAB, chrome::HOST_DESKTOP_TYPE_ASH, extensions::SOURCE_UNTRACKED); |
2083 0, | |
2084 chrome::HOST_DESKTOP_TYPE_ASH); | |
2085 params.container = extensions::LAUNCH_CONTAINER_WINDOW; | 2083 params.container = extensions::LAUNCH_CONTAINER_WINDOW; |
2086 OpenApplication(params); | 2084 OpenApplication(params); |
2087 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status); | 2085 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status); |
2088 | 2086 |
2089 // Find the browser which holds our app. | 2087 // Find the browser which holds our app. |
2090 Browser* app_browser = NULL; | 2088 Browser* app_browser = NULL; |
2091 const BrowserList* ash_browser_list = | 2089 const BrowserList* ash_browser_list = |
2092 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 2090 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
2093 for (BrowserList::const_reverse_iterator it = | 2091 for (BrowserList::const_reverse_iterator it = |
2094 ash_browser_list->begin_last_active(); | 2092 ash_browser_list->begin_last_active(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 chrome::GetSettingsUrl(std::string())); | 2128 chrome::GetSettingsUrl(std::string())); |
2131 Browser* settings_browser = | 2129 Browser* settings_browser = |
2132 settings_manager->FindBrowserForProfile(browser()->profile()); | 2130 settings_manager->FindBrowserForProfile(browser()->profile()); |
2133 ASSERT_TRUE(settings_browser); | 2131 ASSERT_TRUE(settings_browser); |
2134 EXPECT_EQ(browser_count, NumberOfDetectedLauncherBrowsers(false)); | 2132 EXPECT_EQ(browser_count, NumberOfDetectedLauncherBrowsers(false)); |
2135 EXPECT_EQ(item_count + 1, shelf_model->item_count()); | 2133 EXPECT_EQ(item_count + 1, shelf_model->item_count()); |
2136 | 2134 |
2137 // TODO(stevenjb): Test multiprofile on Chrome OS when test support is addded. | 2135 // TODO(stevenjb): Test multiprofile on Chrome OS when test support is addded. |
2138 // crbug.com/230464. | 2136 // crbug.com/230464. |
2139 } | 2137 } |
OLD | NEW |