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

Side by Side Diff: chrome/browser/extensions/extension_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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "content/public/browser/notification_registrar.h" 77 #include "content/public/browser/notification_registrar.h"
78 #include "content/public/browser/notification_service.h" 78 #include "content/public/browser/notification_service.h"
79 #include "content/public/browser/plugin_service.h" 79 #include "content/public/browser/plugin_service.h"
80 #include "content/public/browser/render_process_host.h" 80 #include "content/public/browser/render_process_host.h"
81 #include "content/public/browser/storage_partition.h" 81 #include "content/public/browser/storage_partition.h"
82 #include "content/public/common/content_constants.h" 82 #include "content/public/common/content_constants.h"
83 #include "content/public/test/test_utils.h" 83 #include "content/public/test/test_utils.h"
84 #include "extensions/browser/extension_registry.h" 84 #include "extensions/browser/extension_registry.h"
85 #include "extensions/browser/extension_system.h" 85 #include "extensions/browser/extension_system.h"
86 #include "extensions/browser/external_provider_interface.h" 86 #include "extensions/browser/external_provider_interface.h"
87 #include "extensions/browser/install_flag.h"
87 #include "extensions/browser/management_policy.h" 88 #include "extensions/browser/management_policy.h"
88 #include "extensions/browser/pref_names.h" 89 #include "extensions/browser/pref_names.h"
89 #include "extensions/browser/test_management_policy.h" 90 #include "extensions/browser/test_management_policy.h"
90 #include "extensions/common/constants.h" 91 #include "extensions/common/constants.h"
91 #include "extensions/common/extension.h" 92 #include "extensions/common/extension.h"
92 #include "extensions/common/extension_builder.h" 93 #include "extensions/common/extension_builder.h"
93 #include "extensions/common/extension_l10n_util.h" 94 #include "extensions/common/extension_l10n_util.h"
94 #include "extensions/common/extension_resource.h" 95 #include "extensions/common/extension_resource.h"
95 #include "extensions/common/feature_switch.h" 96 #include "extensions/common/feature_switch.h"
96 #include "extensions/common/manifest_constants.h" 97 #include "extensions/common/manifest_constants.h"
(...skipping 6696 matching lines...) Expand 10 before | Expand all | Expand 10 after
6793 ASSERT_TRUE(extension.get()); 6794 ASSERT_TRUE(extension.get());
6794 const std::string& id = extension->id(); 6795 const std::string& id = extension->id();
6795 6796
6796 std::set<std::string> id_set; 6797 std::set<std::string> id_set;
6797 id_set.insert(id); 6798 id_set.insert(id);
6798 extensions::ExtensionNotificationObserver notifications( 6799 extensions::ExtensionNotificationObserver notifications(
6799 content::NotificationService::AllSources(), id_set); 6800 content::NotificationService::AllSources(), id_set);
6800 6801
6801 // Installation should be allowed but the extension should never have been 6802 // Installation should be allowed but the extension should never have been
6802 // loaded and it should be blacklisted in prefs. 6803 // loaded and it should be blacklisted in prefs.
6803 service()->OnExtensionInstalled(extension.get(), 6804 service()->OnExtensionInstalled(
6804 syncer::StringOrdinal(), 6805 extension.get(),
6805 false /* has requirement errors */, 6806 syncer::StringOrdinal(),
6806 extensions::BLACKLISTED_MALWARE, 6807 (extensions::kInstallFlagIsBlacklistedForMalware |
6807 false /* is ephemeral */, 6808 extensions::kInstallFlagInstallImmediately));
6808 false /* wait for idle */);
6809 base::RunLoop().RunUntilIdle(); 6809 base::RunLoop().RunUntilIdle();
6810 6810
6811 // Extension was installed but not loaded. 6811 // Extension was installed but not loaded.
6812 EXPECT_TRUE(notifications.CheckNotifications( 6812 EXPECT_TRUE(notifications.CheckNotifications(
6813 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED)); 6813 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED));
6814 EXPECT_TRUE(service()->GetInstalledExtension(id)); 6814 EXPECT_TRUE(service()->GetInstalledExtension(id));
6815 6815
6816 EXPECT_FALSE(registry()->enabled_extensions().Contains(id)); 6816 EXPECT_FALSE(registry()->enabled_extensions().Contains(id));
6817 EXPECT_TRUE(registry()->blacklisted_extensions().Contains(id)); 6817 EXPECT_TRUE(registry()->blacklisted_extensions().Contains(id));
6818 6818
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
6897 6897
6898 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 6898 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
6899 content::Source<Profile>(profile()), 6899 content::Source<Profile>(profile()),
6900 content::NotificationService::NoDetails()); 6900 content::NotificationService::NoDetails());
6901 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 6901 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
6902 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 6902 EXPECT_EQ(0u, registry()->enabled_extensions().size());
6903 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 6903 EXPECT_EQ(0u, registry()->disabled_extensions().size());
6904 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 6904 EXPECT_EQ(0u, registry()->terminated_extensions().size());
6905 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 6905 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
6906 } 6906 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/shared_module_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698