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

Side by Side Diff: chrome/browser/extensions/api/management/management_api_browsertest.cc

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: replace missing extension_system include Created 8 years 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/browser/extensions/api/management/management_api.h" 10 #include "chrome/browser/extensions/api/management/management_api.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 ExtensionTestMessageListener listener1("success", false); 86 ExtensionTestMessageListener listener1("success", false);
87 ASSERT_TRUE(LoadExtension( 87 ASSERT_TRUE(LoadExtension(
88 test_data_dir_.AppendASCII("management/self_uninstall_helper"))); 88 test_data_dir_.AppendASCII("management/self_uninstall_helper")));
89 ASSERT_TRUE(LoadExtension( 89 ASSERT_TRUE(LoadExtension(
90 test_data_dir_.AppendASCII("management/self_uninstall"))); 90 test_data_dir_.AppendASCII("management/self_uninstall")));
91 ASSERT_TRUE(listener1.WaitUntilSatisfied()); 91 ASSERT_TRUE(listener1.WaitUntilSatisfied());
92 } 92 }
93 93
94 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, 94 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest,
95 UninstallWithConfirmDialog) { 95 UninstallWithConfirmDialog) {
96 ExtensionService* service = browser()->profile()->GetExtensionService(); 96 ExtensionService* service = extensions::ExtensionSystem::Get(
97 browser()->profile())->extension_service();
97 98
98 // Install an extension. 99 // Install an extension.
99 const extensions::Extension* extension = InstallExtension( 100 const extensions::Extension* extension = InstallExtension(
100 test_data_dir_.AppendASCII("api_test/management/enabled_extension"), 1); 101 test_data_dir_.AppendASCII("api_test/management/enabled_extension"), 1);
101 ASSERT_TRUE(extension); 102 ASSERT_TRUE(extension);
102 103
103 const std::string id = extension->id(); 104 const std::string id = extension->id();
104 105
105 // Uninstall, then cancel via the confirm dialog. 106 // Uninstall, then cancel via the confirm dialog.
106 scoped_refptr<UninstallFunction> uninstall_function(new UninstallFunction()); 107 scoped_refptr<UninstallFunction> uninstall_function(new UninstallFunction());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v1"), 174 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v1"),
174 scoped_temp_dir_.path().AppendASCII("permissions1.crx"), 175 scoped_temp_dir_.path().AppendASCII("permissions1.crx"),
175 pem_path, 176 pem_path,
176 FilePath()); 177 FilePath());
177 FilePath path_v2 = PackExtensionWithOptions( 178 FilePath path_v2 = PackExtensionWithOptions(
178 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v2"), 179 test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v2"),
179 scoped_temp_dir_.path().AppendASCII("permissions2.crx"), 180 scoped_temp_dir_.path().AppendASCII("permissions2.crx"),
180 pem_path, 181 pem_path,
181 FilePath()); 182 FilePath());
182 183
183 ExtensionService* service = browser()->profile()->GetExtensionService(); 184 ExtensionService* service = extensions::ExtensionSystem::Get(
185 browser()->profile())->extension_service();
184 186
185 // Install low-permission version of the extension. 187 // Install low-permission version of the extension.
186 ASSERT_TRUE(InstallExtension(path_v1, 1)); 188 ASSERT_TRUE(InstallExtension(path_v1, 1));
187 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); 189 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL);
188 190
189 // Update to a high-permission version - it should get disabled. 191 // Update to a high-permission version - it should get disabled.
190 EXPECT_FALSE(UpdateExtension(kId, path_v2, -1)); 192 EXPECT_FALSE(UpdateExtension(kId, path_v2, -1));
191 EXPECT_TRUE(service->GetExtensionById(kId, false) == NULL); 193 EXPECT_TRUE(service->GetExtensionById(kId, false) == NULL);
192 EXPECT_TRUE(service->GetExtensionById(kId, true) != NULL); 194 EXPECT_TRUE(service->GetExtensionById(kId, true) != NULL);
193 EXPECT_TRUE( 195 EXPECT_TRUE(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 257
256 // Crash the extension. Mock a reload by disabling and then enabling. The 258 // Crash the extension. Mock a reload by disabling and then enabling. The
257 // extension should be reloaded and enabled. 259 // extension should be reloaded and enabled.
258 ASSERT_TRUE(CrashEnabledExtension(kId)); 260 ASSERT_TRUE(CrashEnabledExtension(kId));
259 SetEnabled(false, true, ""); 261 SetEnabled(false, true, "");
260 SetEnabled(true, true, ""); 262 SetEnabled(true, true, "");
261 const extensions::Extension* extension = browser()->profile()-> 263 const extensions::Extension* extension = browser()->profile()->
262 GetExtensionService()->GetExtensionById(kId, false); 264 GetExtensionService()->GetExtensionById(kId, false);
263 EXPECT_TRUE(extension); 265 EXPECT_TRUE(extension);
264 } 266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698