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

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: Created 6 years, 7 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_unittest.h" 10 #include "chrome/browser/extensions/extension_service_unittest.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 std::string extension_id = id_util::GenerateId("extension_id"); 120 std::string extension_id = id_util::GenerateId("extension_id");
121 // Create and install an extension that imports our new module. 121 // Create and install an extension that imports our new module.
122 scoped_refptr<Extension> importing_extension = 122 scoped_refptr<Extension> importing_extension =
123 CreateExtensionImportingModule(shared_module->id(), extension_id); 123 CreateExtensionImportingModule(shared_module->id(), extension_id);
124 EXPECT_TRUE(InstallExtension(importing_extension)); 124 EXPECT_TRUE(InstallExtension(importing_extension));
125 125
126 // Uninstall the extension that imports our module. 126 // Uninstall the extension that imports our module.
127 base::string16 error; 127 base::string16 error;
128 service_->UninstallExtension(importing_extension->id(), 128 service_->UninstallExtension(importing_extension->id(),
129 false, // Not external uninstall. 129 ExtensionService::kUninstallReasonDefault,
130 &error); 130 &error);
131 EXPECT_TRUE(error.empty()); 131 EXPECT_TRUE(error.empty());
132 132
133 // Since the module was only referenced by that single extension, it should 133 // Since the module was only referenced by that single extension, it should
134 // have been uninstalled as a side-effect of uninstalling the extension that 134 // have been uninstalled as a side-effect of uninstalling the extension that
135 // depended upon it. 135 // depended upon it.
136 EXPECT_FALSE(registry_->GetExtensionById(shared_module->id(), 136 EXPECT_FALSE(registry_->GetExtensionById(shared_module->id(),
137 ExtensionRegistry::EVERYTHING)); 137 ExtensionRegistry::EVERYTHING));
138 } 138 }
139 139
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 CreateExtensionImportingModule(shared_module->id(), whitelisted_id); 171 CreateExtensionImportingModule(shared_module->id(), whitelisted_id);
172 EXPECT_TRUE(InstallExtension(whitelisted_extension)); 172 EXPECT_TRUE(InstallExtension(whitelisted_extension));
173 173
174 // Try to install an extension with an ID that is not whitelisted. 174 // Try to install an extension with an ID that is not whitelisted.
175 scoped_refptr<Extension> nonwhitelisted_extension = 175 scoped_refptr<Extension> nonwhitelisted_extension =
176 CreateExtensionImportingModule(shared_module->id(), nonwhitelisted_id); 176 CreateExtensionImportingModule(shared_module->id(), nonwhitelisted_id);
177 EXPECT_FALSE(InstallExtension(nonwhitelisted_extension)); 177 EXPECT_FALSE(InstallExtension(nonwhitelisted_extension));
178 } 178 }
179 179
180 } // namespace extensions 180 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698