OLD | NEW |
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 "chrome/browser/extensions/extension_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #include "content/public/browser/notification_registrar.h" | 86 #include "content/public/browser/notification_registrar.h" |
87 #include "content/public/browser/notification_service.h" | 87 #include "content/public/browser/notification_service.h" |
88 #include "content/public/browser/plugin_service.h" | 88 #include "content/public/browser/plugin_service.h" |
89 #include "content/public/browser/render_process_host.h" | 89 #include "content/public/browser/render_process_host.h" |
90 #include "content/public/browser/storage_partition.h" | 90 #include "content/public/browser/storage_partition.h" |
91 #include "content/public/common/content_constants.h" | 91 #include "content/public/common/content_constants.h" |
92 #include "content/public/test/test_utils.h" | 92 #include "content/public/test/test_utils.h" |
93 #include "extensions/browser/extension_registry.h" | 93 #include "extensions/browser/extension_registry.h" |
94 #include "extensions/browser/extension_system.h" | 94 #include "extensions/browser/extension_system.h" |
95 #include "extensions/browser/external_provider_interface.h" | 95 #include "extensions/browser/external_provider_interface.h" |
| 96 #include "extensions/browser/install_flag.h" |
96 #include "extensions/browser/management_policy.h" | 97 #include "extensions/browser/management_policy.h" |
97 #include "extensions/browser/pref_names.h" | 98 #include "extensions/browser/pref_names.h" |
98 #include "extensions/browser/test_management_policy.h" | 99 #include "extensions/browser/test_management_policy.h" |
99 #include "extensions/common/constants.h" | 100 #include "extensions/common/constants.h" |
100 #include "extensions/common/extension.h" | 101 #include "extensions/common/extension.h" |
101 #include "extensions/common/extension_builder.h" | 102 #include "extensions/common/extension_builder.h" |
102 #include "extensions/common/extension_l10n_util.h" | 103 #include "extensions/common/extension_l10n_util.h" |
103 #include "extensions/common/extension_resource.h" | 104 #include "extensions/common/extension_resource.h" |
104 #include "extensions/common/manifest_constants.h" | 105 #include "extensions/common/manifest_constants.h" |
105 #include "extensions/common/manifest_handlers/background_info.h" | 106 #include "extensions/common/manifest_handlers/background_info.h" |
(...skipping 6827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6933 std::set<std::string> id_set; | 6934 std::set<std::string> id_set; |
6934 id_set.insert(id); | 6935 id_set.insert(id); |
6935 extensions::ExtensionNotificationObserver notifications( | 6936 extensions::ExtensionNotificationObserver notifications( |
6936 content::NotificationService::AllSources(), id_set); | 6937 content::NotificationService::AllSources(), id_set); |
6937 | 6938 |
6938 // Installation should be allowed but the extension should never have been | 6939 // Installation should be allowed but the extension should never have been |
6939 // loaded and it should be blacklisted in prefs. | 6940 // loaded and it should be blacklisted in prefs. |
6940 service_->OnExtensionInstalled( | 6941 service_->OnExtensionInstalled( |
6941 extension.get(), | 6942 extension.get(), |
6942 syncer::StringOrdinal(), | 6943 syncer::StringOrdinal(), |
6943 false /* has requirement errors */, | 6944 (extensions::kInstallFlagIsBlacklistedForMalware | |
6944 extensions::BLACKLISTED_MALWARE, | 6945 extensions::kInstallFlagInstallImmediately)); |
6945 false /* is ephemeral */, | |
6946 false /* wait for idle */); | |
6947 base::RunLoop().RunUntilIdle(); | 6946 base::RunLoop().RunUntilIdle(); |
6948 | 6947 |
6949 // Extension was installed but not loaded. | 6948 // Extension was installed but not loaded. |
6950 EXPECT_TRUE(notifications.CheckNotifications( | 6949 EXPECT_TRUE(notifications.CheckNotifications( |
6951 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED)); | 6950 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED)); |
6952 EXPECT_TRUE(service_->GetInstalledExtension(id)); | 6951 EXPECT_TRUE(service_->GetInstalledExtension(id)); |
6953 | 6952 |
6954 EXPECT_FALSE(registry_->enabled_extensions().Contains(id)); | 6953 EXPECT_FALSE(registry_->enabled_extensions().Contains(id)); |
6955 EXPECT_TRUE(registry_->blacklisted_extensions().Contains(id)); | 6954 EXPECT_TRUE(registry_->blacklisted_extensions().Contains(id)); |
6956 | 6955 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7035 | 7034 |
7036 service_->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 7035 service_->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
7037 content::Source<Profile>(profile_.get()), | 7036 content::Source<Profile>(profile_.get()), |
7038 content::NotificationService::NoDetails()); | 7037 content::NotificationService::NoDetails()); |
7039 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 7038 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
7040 EXPECT_EQ(0u, registry_->enabled_extensions().size()); | 7039 EXPECT_EQ(0u, registry_->enabled_extensions().size()); |
7041 EXPECT_EQ(0u, registry_->disabled_extensions().size()); | 7040 EXPECT_EQ(0u, registry_->disabled_extensions().size()); |
7042 EXPECT_EQ(0u, registry_->terminated_extensions().size()); | 7041 EXPECT_EQ(0u, registry_->terminated_extensions().size()); |
7043 EXPECT_EQ(0u, registry_->blacklisted_extensions().size()); | 7042 EXPECT_EQ(0u, registry_->blacklisted_extensions().size()); |
7044 } | 7043 } |
OLD | NEW |