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" | |
42 #include "chrome/browser/ui/extensions/application_launch.h" | 41 #include "chrome/browser/ui/extensions/application_launch.h" |
43 #include "chrome/browser/ui/host_desktop.h" | 42 #include "chrome/browser/ui/host_desktop.h" |
44 #include "chrome/browser/ui/settings_window_manager.h" | 43 #include "chrome/browser/ui/settings_window_manager.h" |
45 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 44 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
46 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
47 #include "chrome/test/base/ui_test_utils.h" | 46 #include "chrome/test/base/ui_test_utils.h" |
48 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
49 #include "content/public/browser/notification_source.h" | 48 #include "content/public/browser/notification_source.h" |
50 #include "content/public/browser/web_contents.h" | 49 #include "content/public/browser/web_contents.h" |
51 #include "content/public/test/browser_test_utils.h" | 50 #include "content/public/test/browser_test_utils.h" |
52 #include "extensions/browser/app_window/app_window.h" | 51 #include "extensions/browser/app_window/app_window.h" |
53 #include "extensions/browser/app_window/app_window_registry.h" | 52 #include "extensions/browser/app_window/app_window_registry.h" |
54 #include "extensions/browser/app_window/native_app_window.h" | 53 #include "extensions/browser/app_window/native_app_window.h" |
55 #include "extensions/browser/extension_system.h" | 54 #include "extensions/browser/extension_system.h" |
56 #include "extensions/common/constants.h" | 55 #include "extensions/common/constants.h" |
57 #include "extensions/common/switches.h" | 56 #include "extensions/common/switches.h" |
58 #include "extensions/test/extension_test_message_listener.h" | 57 #include "extensions/test/extension_test_message_listener.h" |
59 #include "testing/gtest/include/gtest/gtest.h" | 58 #include "testing/gtest/include/gtest/gtest.h" |
60 #include "ui/app_list/views/app_list_item_view.h" | 59 #include "ui/app_list/views/app_list_item_view.h" |
61 #include "ui/app_list/views/apps_grid_view.h" | 60 #include "ui/app_list/views/apps_grid_view.h" |
62 #include "ui/aura/client/aura_constants.h" | 61 #include "ui/aura/client/aura_constants.h" |
63 #include "ui/aura/window.h" | 62 #include "ui/aura/window.h" |
64 #include "ui/base/window_open_disposition.h" | |
65 #include "ui/events/event.h" | 63 #include "ui/events/event.h" |
66 #include "ui/events/test/event_generator.h" | 64 #include "ui/events/test/event_generator.h" |
67 | 65 |
68 using extensions::AppWindow; | 66 using extensions::AppWindow; |
69 using extensions::Extension; | 67 using extensions::Extension; |
70 using content::WebContents; | 68 using content::WebContents; |
71 | 69 |
72 namespace { | 70 namespace { |
73 | 71 |
74 class TestEvent : public ui::Event { | 72 class TestEvent : public ui::Event { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 extensions::LaunchContainer container, | 213 extensions::LaunchContainer container, |
216 WindowOpenDisposition disposition) { | 214 WindowOpenDisposition disposition) { |
217 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name))); | 215 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name))); |
218 | 216 |
219 ExtensionService* service = extensions::ExtensionSystem::Get( | 217 ExtensionService* service = extensions::ExtensionSystem::Get( |
220 profile())->extension_service(); | 218 profile())->extension_service(); |
221 const Extension* extension = | 219 const Extension* extension = |
222 service->GetExtensionById(last_loaded_extension_id(), false); | 220 service->GetExtensionById(last_loaded_extension_id(), false); |
223 EXPECT_TRUE(extension); | 221 EXPECT_TRUE(extension); |
224 | 222 |
225 OpenApplication(AppLaunchParams(profile(), extension, container, | 223 OpenApplication(AppLaunchParams(profile(), |
226 disposition, extensions::SOURCE_UNTRACKED)); | 224 extension, |
| 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(), controller_->GetExtensionForAppID(extensions::kWebStoreAppId), | 2081 profile(), |
2082 CURRENT_TAB, chrome::HOST_DESKTOP_TYPE_ASH, extensions::SOURCE_UNTRACKED); | 2082 controller_->GetExtensionForAppID(extensions::kWebStoreAppId), |
| 2083 0, |
| 2084 chrome::HOST_DESKTOP_TYPE_ASH); |
2083 params.container = extensions::LAUNCH_CONTAINER_WINDOW; | 2085 params.container = extensions::LAUNCH_CONTAINER_WINDOW; |
2084 OpenApplication(params); | 2086 OpenApplication(params); |
2085 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status); | 2087 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status); |
2086 | 2088 |
2087 // Find the browser which holds our app. | 2089 // Find the browser which holds our app. |
2088 Browser* app_browser = NULL; | 2090 Browser* app_browser = NULL; |
2089 const BrowserList* ash_browser_list = | 2091 const BrowserList* ash_browser_list = |
2090 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 2092 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
2091 for (BrowserList::const_reverse_iterator it = | 2093 for (BrowserList::const_reverse_iterator it = |
2092 ash_browser_list->begin_last_active(); | 2094 ash_browser_list->begin_last_active(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 chrome::GetSettingsUrl(std::string())); | 2130 chrome::GetSettingsUrl(std::string())); |
2129 Browser* settings_browser = | 2131 Browser* settings_browser = |
2130 settings_manager->FindBrowserForProfile(browser()->profile()); | 2132 settings_manager->FindBrowserForProfile(browser()->profile()); |
2131 ASSERT_TRUE(settings_browser); | 2133 ASSERT_TRUE(settings_browser); |
2132 EXPECT_EQ(browser_count, NumberOfDetectedLauncherBrowsers(false)); | 2134 EXPECT_EQ(browser_count, NumberOfDetectedLauncherBrowsers(false)); |
2133 EXPECT_EQ(item_count + 1, shelf_model->item_count()); | 2135 EXPECT_EQ(item_count + 1, shelf_model->item_count()); |
2134 | 2136 |
2135 // TODO(stevenjb): Test multiprofile on Chrome OS when test support is addded. | 2137 // TODO(stevenjb): Test multiprofile on Chrome OS when test support is addded. |
2136 // crbug.com/230464. | 2138 // crbug.com/230464. |
2137 } | 2139 } |
OLD | NEW |