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

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

Issue 284103002: Replace "external_install" boolean parameter with explicit enumeration in ExtensionUninstall method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address issue exposed by failing unit test. Created 6 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 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 std::string extension_id = id_util::GenerateId("extension_id"); 125 std::string extension_id = id_util::GenerateId("extension_id");
126 // Create and install an extension that imports our new module. 126 // Create and install an extension that imports our new module.
127 scoped_refptr<Extension> importing_extension = 127 scoped_refptr<Extension> importing_extension =
128 CreateExtensionImportingModule(shared_module->id(), extension_id); 128 CreateExtensionImportingModule(shared_module->id(), extension_id);
129 EXPECT_TRUE(InstallExtension(importing_extension)); 129 EXPECT_TRUE(InstallExtension(importing_extension));
130 130
131 // Uninstall the extension that imports our module. 131 // Uninstall the extension that imports our module.
132 base::string16 error; 132 base::string16 error;
133 service_->UninstallExtension(importing_extension->id(), 133 service_->UninstallExtension(importing_extension->id(),
134 false, // Not external uninstall. 134 ExtensionService::UNINSTALL_REASON_FOR_TESTING,
135 &error); 135 &error);
136 EXPECT_TRUE(error.empty()); 136 EXPECT_TRUE(error.empty());
137 137
138 // Since the module was only referenced by that single extension, it should 138 // Since the module was only referenced by that single extension, it should
139 // have been uninstalled as a side-effect of uninstalling the extension that 139 // have been uninstalled as a side-effect of uninstalling the extension that
140 // depended upon it. 140 // depended upon it.
141 EXPECT_FALSE(registry()->GetExtensionById(shared_module->id(), 141 EXPECT_FALSE(registry()->GetExtensionById(shared_module->id(),
142 ExtensionRegistry::EVERYTHING)); 142 ExtensionRegistry::EVERYTHING));
143 } 143 }
144 144
(...skipping 25 matching lines...) Expand all
170 CreateExtensionImportingModule(shared_module->id(), whitelisted_id); 170 CreateExtensionImportingModule(shared_module->id(), whitelisted_id);
171 EXPECT_TRUE(InstallExtension(whitelisted_extension)); 171 EXPECT_TRUE(InstallExtension(whitelisted_extension));
172 172
173 // Try to install an extension with an ID that is not whitelisted. 173 // Try to install an extension with an ID that is not whitelisted.
174 scoped_refptr<Extension> nonwhitelisted_extension = 174 scoped_refptr<Extension> nonwhitelisted_extension =
175 CreateExtensionImportingModule(shared_module->id(), nonwhitelisted_id); 175 CreateExtensionImportingModule(shared_module->id(), nonwhitelisted_id);
176 EXPECT_FALSE(InstallExtension(nonwhitelisted_extension)); 176 EXPECT_FALSE(InstallExtension(nonwhitelisted_extension));
177 } 177 }
178 178
179 } // namespace extensions 179 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/shared_module_service.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698