| 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.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 6052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6063 service_->CheckForExternalUpdates(); | 6063 service_->CheckForExternalUpdates(); |
| 6064 observer.Wait(); | 6064 observer.Wait(); |
| 6065 EXPECT_TRUE(service_->external_install_manager()->HasExternalInstallError()); | 6065 EXPECT_TRUE(service_->external_install_manager()->HasExternalInstallError()); |
| 6066 | 6066 |
| 6067 // We check both enabled and disabled, since these are "eventually exclusive" | 6067 // We check both enabled and disabled, since these are "eventually exclusive" |
| 6068 // sets. | 6068 // sets. |
| 6069 EXPECT_TRUE(registry()->disabled_extensions().GetByID(updates_from_webstore)); | 6069 EXPECT_TRUE(registry()->disabled_extensions().GetByID(updates_from_webstore)); |
| 6070 EXPECT_FALSE(registry()->enabled_extensions().GetByID(updates_from_webstore)); | 6070 EXPECT_FALSE(registry()->enabled_extensions().GetByID(updates_from_webstore)); |
| 6071 | 6071 |
| 6072 // Click the negative response. | 6072 // Click the negative response. |
| 6073 service_->external_install_manager()->error_for_testing()->InstallUIAbort( | 6073 service_->external_install_manager() |
| 6074 true); | 6074 ->error_for_testing() |
| 6075 ->OnInstallPromptDone(ExtensionInstallPrompt::Result::USER_CANCELED); |
| 6075 // The Extension should be uninstalled. | 6076 // The Extension should be uninstalled. |
| 6076 EXPECT_FALSE(registry()->GetExtensionById(updates_from_webstore, | 6077 EXPECT_FALSE(registry()->GetExtensionById(updates_from_webstore, |
| 6077 ExtensionRegistry::EVERYTHING)); | 6078 ExtensionRegistry::EVERYTHING)); |
| 6078 // The error should be removed. | 6079 // The error should be removed. |
| 6079 EXPECT_FALSE(service_->external_install_manager()->HasExternalInstallError()); | 6080 EXPECT_FALSE(service_->external_install_manager()->HasExternalInstallError()); |
| 6080 } | 6081 } |
| 6081 | 6082 |
| 6082 // Test that clicking to keep the extension on an external install warning | 6083 // Test that clicking to keep the extension on an external install warning |
| 6083 // re-enables the extension. | 6084 // re-enables the extension. |
| 6084 TEST_F(ExtensionServiceTest, ExternalInstallClickToKeep) { | 6085 TEST_F(ExtensionServiceTest, ExternalInstallClickToKeep) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 6105 service_->CheckForExternalUpdates(); | 6106 service_->CheckForExternalUpdates(); |
| 6106 observer.Wait(); | 6107 observer.Wait(); |
| 6107 EXPECT_TRUE(service_->external_install_manager()->HasExternalInstallError()); | 6108 EXPECT_TRUE(service_->external_install_manager()->HasExternalInstallError()); |
| 6108 | 6109 |
| 6109 // We check both enabled and disabled, since these are "eventually exclusive" | 6110 // We check both enabled and disabled, since these are "eventually exclusive" |
| 6110 // sets. | 6111 // sets. |
| 6111 EXPECT_TRUE(registry()->disabled_extensions().GetByID(updates_from_webstore)); | 6112 EXPECT_TRUE(registry()->disabled_extensions().GetByID(updates_from_webstore)); |
| 6112 EXPECT_FALSE(registry()->enabled_extensions().GetByID(updates_from_webstore)); | 6113 EXPECT_FALSE(registry()->enabled_extensions().GetByID(updates_from_webstore)); |
| 6113 | 6114 |
| 6114 // Accept the extension. | 6115 // Accept the extension. |
| 6115 service_->external_install_manager()->error_for_testing()->InstallUIProceed(); | 6116 service_->external_install_manager() |
| 6117 ->error_for_testing() |
| 6118 ->OnInstallPromptDone(ExtensionInstallPrompt::Result::ACCEPTED); |
| 6116 | 6119 |
| 6117 // It should be enabled again. | 6120 // It should be enabled again. |
| 6118 EXPECT_TRUE(registry()->enabled_extensions().GetByID(updates_from_webstore)); | 6121 EXPECT_TRUE(registry()->enabled_extensions().GetByID(updates_from_webstore)); |
| 6119 EXPECT_FALSE( | 6122 EXPECT_FALSE( |
| 6120 registry()->disabled_extensions().GetByID(updates_from_webstore)); | 6123 registry()->disabled_extensions().GetByID(updates_from_webstore)); |
| 6121 | 6124 |
| 6122 // The error should be removed. | 6125 // The error should be removed. |
| 6123 EXPECT_FALSE(service_->external_install_manager()->HasExternalInstallError()); | 6126 EXPECT_FALSE(service_->external_install_manager()->HasExternalInstallError()); |
| 6124 } | 6127 } |
| 6125 | 6128 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6174 | 6177 |
| 6175 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 6178 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
| 6176 content::Source<Profile>(profile()), | 6179 content::Source<Profile>(profile()), |
| 6177 content::NotificationService::NoDetails()); | 6180 content::NotificationService::NoDetails()); |
| 6178 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 6181 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
| 6179 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 6182 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 6180 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 6183 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
| 6181 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 6184 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
| 6182 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 6185 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
| 6183 } | 6186 } |
| OLD | NEW |