OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_service_test_base.h" | 10 #include "chrome/browser/extensions/extension_service_test_base.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 std::string extension_id = id_util::GenerateId("extension_id"); | 139 std::string extension_id = id_util::GenerateId("extension_id"); |
140 // Create and install an extension that imports our new module. | 140 // Create and install an extension that imports our new module. |
141 scoped_refptr<Extension> importing_extension = | 141 scoped_refptr<Extension> importing_extension = |
142 CreateExtensionImportingModule(shared_module->id(), extension_id, "1.0"); | 142 CreateExtensionImportingModule(shared_module->id(), extension_id, "1.0"); |
143 EXPECT_TRUE(InstallExtension(importing_extension, false)); | 143 EXPECT_TRUE(InstallExtension(importing_extension, false)); |
144 | 144 |
145 // Uninstall the extension that imports our module. | 145 // Uninstall the extension that imports our module. |
146 base::string16 error; | 146 base::string16 error; |
147 service()->UninstallExtension(importing_extension->id(), | 147 service()->UninstallExtension(importing_extension->id(), |
148 extensions::UNINSTALL_REASON_FOR_TESTING, | 148 extensions::UNINSTALL_REASON_FOR_TESTING, |
| 149 base::Bind(&base::DoNothing), |
149 &error); | 150 &error); |
150 EXPECT_TRUE(error.empty()); | 151 EXPECT_TRUE(error.empty()); |
151 | 152 |
152 // Since the module was only referenced by that single extension, it should | 153 // Since the module was only referenced by that single extension, it should |
153 // have been uninstalled as a side-effect of uninstalling the extension that | 154 // have been uninstalled as a side-effect of uninstalling the extension that |
154 // depended upon it. | 155 // depended upon it. |
155 EXPECT_FALSE(registry()->GetExtensionById(shared_module->id(), | 156 EXPECT_FALSE(registry()->GetExtensionById(shared_module->id(), |
156 ExtensionRegistry::EVERYTHING)); | 157 ExtensionRegistry::EVERYTHING)); |
157 } | 158 } |
158 | 159 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 260 |
260 // Try to install an extension with an ID that is not whitelisted. | 261 // Try to install an extension with an ID that is not whitelisted. |
261 scoped_refptr<Extension> nonwhitelisted_extension = | 262 scoped_refptr<Extension> nonwhitelisted_extension = |
262 CreateExtensionImportingModule(shared_module->id(), | 263 CreateExtensionImportingModule(shared_module->id(), |
263 nonwhitelisted_id, | 264 nonwhitelisted_id, |
264 "1.0"); | 265 "1.0"); |
265 EXPECT_FALSE(InstallExtension(nonwhitelisted_extension, false)); | 266 EXPECT_FALSE(InstallExtension(nonwhitelisted_extension, false)); |
266 } | 267 } |
267 | 268 |
268 } // namespace extensions | 269 } // namespace extensions |
OLD | NEW |