| 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 <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 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2754 base::FilePath path = data_dir().AppendASCII("good.crx"); | 2754 base::FilePath path = data_dir().AppendASCII("good.crx"); |
| 2755 | 2755 |
| 2756 const Extension* good = InstallCRX(path, INSTALL_NEW); | 2756 const Extension* good = InstallCRX(path, INSTALL_NEW); |
| 2757 ASSERT_EQ("1.0.0.0", good->VersionString()); | 2757 ASSERT_EQ("1.0.0.0", good->VersionString()); |
| 2758 ASSERT_EQ(good_crx, good->id()); | 2758 ASSERT_EQ(good_crx, good->id()); |
| 2759 | 2759 |
| 2760 // Disable it and allow it to run in incognito. These settings should carry | 2760 // Disable it and allow it to run in incognito. These settings should carry |
| 2761 // over to the updated version. | 2761 // over to the updated version. |
| 2762 service()->DisableExtension(good->id(), Extension::DISABLE_USER_ACTION); | 2762 service()->DisableExtension(good->id(), Extension::DISABLE_USER_ACTION); |
| 2763 extensions::util::SetIsIncognitoEnabled(good->id(), profile(), true); | 2763 extensions::util::SetIsIncognitoEnabled(good->id(), profile(), true); |
| 2764 ExtensionPrefs::Get(profile()) | |
| 2765 ->SetDidExtensionEscalatePermissions(good, true); | |
| 2766 | 2764 |
| 2767 path = data_dir().AppendASCII("good2.crx"); | 2765 path = data_dir().AppendASCII("good2.crx"); |
| 2768 UpdateExtension(good_crx, path, INSTALLED); | 2766 UpdateExtension(good_crx, path, INSTALLED); |
| 2769 ASSERT_EQ(1u, registry()->disabled_extensions().size()); | 2767 ASSERT_EQ(1u, registry()->disabled_extensions().size()); |
| 2770 const Extension* good2 = service()->GetExtensionById(good_crx, true); | 2768 const Extension* good2 = service()->GetExtensionById(good_crx, true); |
| 2771 ASSERT_EQ("1.0.0.1", good2->version()->GetString()); | 2769 ASSERT_EQ("1.0.0.1", good2->version()->GetString()); |
| 2772 EXPECT_TRUE(extensions::util::IsIncognitoEnabled(good2->id(), profile())); | 2770 EXPECT_TRUE(extensions::util::IsIncognitoEnabled(good2->id(), profile())); |
| 2773 EXPECT_TRUE(ExtensionPrefs::Get(profile()) | 2771 EXPECT_EQ(Extension::DISABLE_USER_ACTION, |
| 2774 ->DidExtensionEscalatePermissions(good2->id())); | 2772 ExtensionPrefs::Get(profile())->GetDisableReasons(good2->id())); |
| 2775 } | 2773 } |
| 2776 | 2774 |
| 2777 // Tests that updating preserves extension location. | 2775 // Tests that updating preserves extension location. |
| 2778 TEST_F(ExtensionServiceTest, UpdateExtensionPreservesLocation) { | 2776 TEST_F(ExtensionServiceTest, UpdateExtensionPreservesLocation) { |
| 2779 InitializeEmptyExtensionService(); | 2777 InitializeEmptyExtensionService(); |
| 2780 | 2778 |
| 2781 base::FilePath path = data_dir().AppendASCII("good.crx"); | 2779 base::FilePath path = data_dir().AppendASCII("good.crx"); |
| 2782 | 2780 |
| 2783 const Extension* good = | 2781 const Extension* good = |
| 2784 InstallCRXWithLocation(path, Manifest::EXTERNAL_PREF, INSTALL_NEW); | 2782 InstallCRXWithLocation(path, Manifest::EXTERNAL_PREF, INSTALL_NEW); |
| (...skipping 5282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8067 | 8065 |
| 8068 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 8066 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
| 8069 content::Source<Profile>(profile()), | 8067 content::Source<Profile>(profile()), |
| 8070 content::NotificationService::NoDetails()); | 8068 content::NotificationService::NoDetails()); |
| 8071 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 8069 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
| 8072 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 8070 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 8073 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 8071 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
| 8074 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 8072 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
| 8075 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 8073 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
| 8076 } | 8074 } |
| OLD | NEW |