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/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/extensions/api/management/management_api.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_system.h" | 11 #include "chrome/browser/extensions/extension_system.h" |
11 #include "chrome/browser/extensions/extension_test_message_listener.h" | 12 #include "chrome/browser/extensions/extension_test_message_listener.h" |
12 #include "chrome/browser/extensions/launch_util.h" | 13 #include "chrome/browser/extensions/launch_util.h" |
13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
16 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
17 #include "chrome/browser/ui/browser_iterator.h" | 18 #include "chrome/browser/ui/browser_iterator.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 119 |
119 // Disabled: http://crbug.com/174411 | 120 // Disabled: http://crbug.com/174411 |
120 #if defined(OS_WIN) | 121 #if defined(OS_WIN) |
121 #define MAYBE_Uninstall DISABLED_Uninstall | 122 #define MAYBE_Uninstall DISABLED_Uninstall |
122 #else | 123 #else |
123 #define MAYBE_Uninstall Uninstall | 124 #define MAYBE_Uninstall Uninstall |
124 #endif | 125 #endif |
125 | 126 |
126 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, MAYBE_Uninstall) { | 127 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, MAYBE_Uninstall) { |
127 LoadExtensions(); | 128 LoadExtensions(); |
| 129 // Confirmation dialog will be shown for uninstallations except for self. |
| 130 extensions::ManagementUninstallFunction::SetAutoConfirmForTest(true); |
128 ASSERT_TRUE(RunExtensionSubtest("management/test", "uninstall.html")); | 131 ASSERT_TRUE(RunExtensionSubtest("management/test", "uninstall.html")); |
129 } | 132 } |
130 | 133 |
131 // Fails often on Windows dbg bots. http://crbug.com/177163 | 134 // Fails often on Windows dbg bots. http://crbug.com/177163 |
132 #if defined(OS_WIN) | 135 #if defined(OS_WIN) |
133 #define MAYBE_ManagementPolicyAllowed DISABLED_ManagementPolicyAllowed | 136 #define MAYBE_ManagementPolicyAllowed DISABLED_ManagementPolicyAllowed |
134 #else | 137 #else |
135 #define MAYBE_ManagementPolicyAllowed ManagementPolicyAllowed | 138 #define MAYBE_ManagementPolicyAllowed ManagementPolicyAllowed |
136 #endif // defined(OS_WIN) | 139 #endif // defined(OS_WIN) |
137 // Tests actions on extensions when no management policy is in place. | 140 // Tests actions on extensions when no management policy is in place. |
138 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, | 141 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, |
139 MAYBE_ManagementPolicyAllowed) { | 142 MAYBE_ManagementPolicyAllowed) { |
140 LoadExtensions(); | 143 LoadExtensions(); |
| 144 extensions::ManagementUninstallFunction::SetAutoConfirmForTest(true); |
141 ExtensionService* service = extensions::ExtensionSystem::Get( | 145 ExtensionService* service = extensions::ExtensionSystem::Get( |
142 browser()->profile())->extension_service(); | 146 browser()->profile())->extension_service(); |
143 EXPECT_TRUE(service->GetExtensionById(extension_ids_["enabled_extension"], | 147 EXPECT_TRUE(service->GetExtensionById(extension_ids_["enabled_extension"], |
144 false)); | 148 false)); |
145 | 149 |
146 // Ensure that all actions are allowed. | 150 // Ensure that all actions are allowed. |
147 extensions::ExtensionSystem::Get( | 151 extensions::ExtensionSystem::Get( |
148 browser()->profile())->management_policy()->UnregisterAllProviders(); | 152 browser()->profile())->management_policy()->UnregisterAllProviders(); |
149 | 153 |
150 ASSERT_TRUE(RunExtensionSubtest("management/management_policy", | 154 ASSERT_TRUE(RunExtensionSubtest("management/management_policy", |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 300 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
297 #else | 301 #else |
298 // Find the app's browser. Opening in a new window will create | 302 // Find the app's browser. Opening in a new window will create |
299 // a new browser. | 303 // a new browser. |
300 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile(), | 304 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile(), |
301 browser()->host_desktop_type())); | 305 browser()->host_desktop_type())); |
302 Browser* app_browser = FindOtherBrowser(browser()); | 306 Browser* app_browser = FindOtherBrowser(browser()); |
303 ASSERT_TRUE(app_browser->is_app()); | 307 ASSERT_TRUE(app_browser->is_app()); |
304 #endif | 308 #endif |
305 } | 309 } |
OLD | NEW |