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

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

Issue 322893002: Cleanup: Make ExtensionService::OnExtensionInstalled take a bitmask instead of (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more win compile fixes Created 6 years, 6 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 | Annotate | Revision Log
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"
11 #include "chrome/browser/extensions/pending_extension_manager.h" 11 #include "chrome/browser/extensions/pending_extension_manager.h"
12 #include "chrome/browser/extensions/shared_module_service.h" 12 #include "chrome/browser/extensions/shared_module_service.h"
13 #include "chrome/common/extensions/features/feature_channel.h" 13 #include "chrome/common/extensions/features/feature_channel.h"
14 #include "extensions/browser/extension_registry.h" 14 #include "extensions/browser/extension_registry.h"
15 #include "extensions/browser/install_flag.h"
15 #include "extensions/common/extension_builder.h" 16 #include "extensions/common/extension_builder.h"
16 #include "extensions/common/id_util.h" 17 #include "extensions/common/id_util.h"
17 #include "extensions/common/value_builder.h" 18 #include "extensions/common/value_builder.h"
18 #include "sync/api/string_ordinal.h" 19 #include "sync/api/string_ordinal.h"
19 20
20 namespace extensions { 21 namespace extensions {
21 22
22 namespace { 23 namespace {
23 24
24 // Return an extension with |id| which imports a module with the given 25 // Return an extension with |id| which imports a module with the given
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 testing::AssertionResult SharedModuleServiceUnitTest::InstallExtension( 66 testing::AssertionResult SharedModuleServiceUnitTest::InstallExtension(
66 const Extension* extension) { 67 const Extension* extension) {
67 // Verify the extension is not already installed. 68 // Verify the extension is not already installed.
68 if (registry()->GetExtensionById(extension->id(), 69 if (registry()->GetExtensionById(extension->id(),
69 ExtensionRegistry::ENABLED)) { 70 ExtensionRegistry::ENABLED)) {
70 return testing::AssertionFailure() << "Extension already installed."; 71 return testing::AssertionFailure() << "Extension already installed.";
71 } 72 }
72 73
73 // Notify the service that the extension is installed. This adds it to the 74 // Notify the service that the extension is installed. This adds it to the
74 // registry, notifies interested parties, etc. 75 // registry, notifies interested parties, etc.
75 service_->OnExtensionInstalled(extension, 76 service_->OnExtensionInstalled(
76 syncer::StringOrdinal(), 77 extension, syncer::StringOrdinal(), kInstallFlagInstallImmediately);
77 false, // No requirement errors.
78 NOT_BLACKLISTED,
79 false, // Not ephemeral.
80 false); // Don't wait for idle.
81 78
82 // Verify that the extension is now installed. 79 // Verify that the extension is now installed.
83 if (!registry()->GetExtensionById(extension->id(), 80 if (!registry()->GetExtensionById(extension->id(),
84 ExtensionRegistry::ENABLED)) { 81 ExtensionRegistry::ENABLED)) {
85 return testing::AssertionFailure() << "Could not install extension."; 82 return testing::AssertionFailure() << "Could not install extension.";
86 } 83 }
87 84
88 return testing::AssertionSuccess(); 85 return testing::AssertionSuccess();
89 } 86 }
90 87
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 CreateExtensionImportingModule(shared_module->id(), whitelisted_id); 170 CreateExtensionImportingModule(shared_module->id(), whitelisted_id);
174 EXPECT_TRUE(InstallExtension(whitelisted_extension)); 171 EXPECT_TRUE(InstallExtension(whitelisted_extension));
175 172
176 // 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.
177 scoped_refptr<Extension> nonwhitelisted_extension = 174 scoped_refptr<Extension> nonwhitelisted_extension =
178 CreateExtensionImportingModule(shared_module->id(), nonwhitelisted_id); 175 CreateExtensionImportingModule(shared_module->id(), nonwhitelisted_id);
179 EXPECT_FALSE(InstallExtension(nonwhitelisted_extension)); 176 EXPECT_FALSE(InstallExtension(nonwhitelisted_extension));
180 } 177 }
181 178
182 } // namespace extensions 179 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/test_extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698