Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Side by Side Diff: chrome/browser/extensions/extension_management_apitest.cc

Issue 10626007: Move ExtensionSystem into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Master merge; moved class declaration Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 // Tests actions on extensions when no management policy is in place. 97 // Tests actions on extensions when no management policy is in place.
98 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, ManagementPolicyAllowed) { 98 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, ManagementPolicyAllowed) {
99 InstallExtensions(); 99 InstallExtensions();
100 ExtensionService* service = browser()->profile()->GetExtensionService(); 100 ExtensionService* service = browser()->profile()->GetExtensionService();
101 EXPECT_TRUE(service->GetExtensionById(extension_ids_["enabled_extension"], 101 EXPECT_TRUE(service->GetExtensionById(extension_ids_["enabled_extension"],
102 false)); 102 false));
103 103
104 // Ensure that all actions are allowed. 104 // Ensure that all actions are allowed.
105 ExtensionSystem::Get( 105 extensions::ExtensionSystem::Get(
106 browser()->profile())->management_policy()->UnregisterAllProviders(); 106 browser()->profile())->management_policy()->UnregisterAllProviders();
107 107
108 ASSERT_TRUE(RunExtensionSubtest("management/management_policy", 108 ASSERT_TRUE(RunExtensionSubtest("management/management_policy",
109 "allowed.html")); 109 "allowed.html"));
110 // The last thing the test does is uninstall the "enabled_extension". 110 // The last thing the test does is uninstall the "enabled_extension".
111 EXPECT_FALSE(service->GetExtensionById(extension_ids_["enabled_extension"], 111 EXPECT_FALSE(service->GetExtensionById(extension_ids_["enabled_extension"],
112 true)); 112 true));
113 } 113 }
114 114
115 // Tests actions on extensions when management policy prohibits those actions. 115 // Tests actions on extensions when management policy prohibits those actions.
116 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, ManagementPolicyProhibited) { 116 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, ManagementPolicyProhibited) {
117 InstallExtensions(); 117 InstallExtensions();
118 ExtensionService* service = browser()->profile()->GetExtensionService(); 118 ExtensionService* service = browser()->profile()->GetExtensionService();
119 EXPECT_TRUE(service->GetExtensionById(extension_ids_["enabled_extension"], 119 EXPECT_TRUE(service->GetExtensionById(extension_ids_["enabled_extension"],
120 false)); 120 false));
121 121
122 // Prohibit status changes. 122 // Prohibit status changes.
123 extensions::ManagementPolicy* policy = 123 extensions::ManagementPolicy* policy = extensions::ExtensionSystem::Get(
124 ExtensionSystem::Get(browser()->profile())->management_policy(); 124 browser()->profile())->management_policy();
125 policy->UnregisterAllProviders(); 125 policy->UnregisterAllProviders();
126 extensions::TestManagementPolicyProvider provider( 126 extensions::TestManagementPolicyProvider provider(
127 extensions::TestManagementPolicyProvider::PROHIBIT_MODIFY_STATUS); 127 extensions::TestManagementPolicyProvider::PROHIBIT_MODIFY_STATUS);
128 policy->RegisterProvider(&provider); 128 policy->RegisterProvider(&provider);
129 ASSERT_TRUE(RunExtensionSubtest("management/management_policy", 129 ASSERT_TRUE(RunExtensionSubtest("management/management_policy",
130 "prohibited.html")); 130 "prohibited.html"));
131 } 131 }
132 132
133 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) { 133 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
134 ExtensionService* service = browser()->profile()->GetExtensionService(); 134 ExtensionService* service = browser()->profile()->GetExtensionService();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_api.cc ('k') | chrome/browser/extensions/extension_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698