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 <map> | 5 #include <map> |
6 | 6 |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 signal.Wait(); | 160 signal.Wait(); |
161 | 161 |
162 // Unload the extension. | 162 // Unload the extension. |
163 UninstallExtension(app_id); | 163 UninstallExtension(app_id); |
164 ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile())); | 164 ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile())); |
165 ASSERT_FALSE(service->GetExtensionById(app_id, true)); | 165 ASSERT_FALSE(service->GetExtensionById(app_id, true)); |
166 | 166 |
167 // Set a pref indicating that the user wants to launch in a regular tab. | 167 // Set a pref indicating that the user wants to launch in a regular tab. |
168 // This should be ignored, because panel apps always load in a panel. | 168 // This should be ignored, because panel apps always load in a panel. |
169 service->extension_prefs()->SetLaunchType( | 169 service->extension_prefs()->SetLaunchType( |
170 app_id, ExtensionPrefs::LAUNCH_REGULAR); | 170 app_id, extensions::ExtensionPrefs::LAUNCH_REGULAR); |
171 | 171 |
172 // Load the extension again. | 172 // Load the extension again. |
173 std::string app_id_new; | 173 std::string app_id_new; |
174 LoadAndWaitForLaunch("management/launch_app_panel", &app_id_new); | 174 LoadAndWaitForLaunch("management/launch_app_panel", &app_id_new); |
175 ASSERT_FALSE(HasFatalFailure()); | 175 ASSERT_FALSE(HasFatalFailure()); |
176 | 176 |
177 // If the ID changed, then the pref will not apply to the app. | 177 // If the ID changed, then the pref will not apply to the app. |
178 ASSERT_EQ(app_id, app_id_new); | 178 ASSERT_EQ(app_id, app_id_new); |
179 | 179 |
180 // Find the app's browser. Apps that should load in a panel ignore | 180 // Find the app's browser. Apps that should load in a panel ignore |
(...skipping 28 matching lines...) Expand all Loading... |
209 ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile())); | 209 ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile())); |
210 ASSERT_EQ(2, browser()->tab_count()); | 210 ASSERT_EQ(2, browser()->tab_count()); |
211 | 211 |
212 // Unload the extension. | 212 // Unload the extension. |
213 UninstallExtension(app_id); | 213 UninstallExtension(app_id); |
214 ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile())); | 214 ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile())); |
215 ASSERT_FALSE(service->GetExtensionById(app_id, true)); | 215 ASSERT_FALSE(service->GetExtensionById(app_id, true)); |
216 | 216 |
217 // Set a pref indicating that the user wants to launch in a window. | 217 // Set a pref indicating that the user wants to launch in a window. |
218 service->extension_prefs()->SetLaunchType( | 218 service->extension_prefs()->SetLaunchType( |
219 app_id, ExtensionPrefs::LAUNCH_WINDOW); | 219 app_id, extensions::ExtensionPrefs::LAUNCH_WINDOW); |
220 | 220 |
221 std::string app_id_new; | 221 std::string app_id_new; |
222 LoadAndWaitForLaunch("management/launch_app_tab", &app_id_new); | 222 LoadAndWaitForLaunch("management/launch_app_tab", &app_id_new); |
223 ASSERT_FALSE(HasFatalFailure()); | 223 ASSERT_FALSE(HasFatalFailure()); |
224 | 224 |
225 // If the ID changed, then the pref will not apply to the app. | 225 // If the ID changed, then the pref will not apply to the app. |
226 ASSERT_EQ(app_id, app_id_new); | 226 ASSERT_EQ(app_id, app_id_new); |
227 | 227 |
228 #if defined(OS_MACOSX) | 228 #if defined(OS_MACOSX) |
229 // App windows are not yet implemented on mac os. We should fall back | 229 // App windows are not yet implemented on mac os. We should fall back |
230 // to a normal tab. | 230 // to a normal tab. |
231 ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile())); | 231 ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile())); |
232 ASSERT_EQ(2, browser()->tab_count()); | 232 ASSERT_EQ(2, browser()->tab_count()); |
233 #else | 233 #else |
234 // Find the app's browser. Opening in a new window will create | 234 // Find the app's browser. Opening in a new window will create |
235 // a new browser. | 235 // a new browser. |
236 ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); | 236 ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); |
237 Browser* app_browser = FindOtherBrowser(browser()); | 237 Browser* app_browser = FindOtherBrowser(browser()); |
238 ASSERT_TRUE(app_browser->is_app()); | 238 ASSERT_TRUE(app_browser->is_app()); |
239 ASSERT_FALSE(app_browser->is_type_panel()); | 239 ASSERT_FALSE(app_browser->is_type_panel()); |
240 #endif | 240 #endif |
241 } | 241 } |
OLD | NEW |