| 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 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); | 1704 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); |
| 1705 | 1705 |
| 1706 APIPermissionSet expected_api_perms; | 1706 APIPermissionSet expected_api_perms; |
| 1707 URLPatternSet expected_host_perms; | 1707 URLPatternSet expected_host_perms; |
| 1708 | 1708 |
| 1709 // Make sure there aren't any granted permissions before the | 1709 // Make sure there aren't any granted permissions before the |
| 1710 // extension is installed. | 1710 // extension is installed. |
| 1711 EXPECT_FALSE(prefs->GetGrantedPermissions(permissions_crx).get()); | 1711 EXPECT_FALSE(prefs->GetGrantedPermissions(permissions_crx).get()); |
| 1712 | 1712 |
| 1713 const Extension* extension = PackAndInstallCRX( | 1713 const Extension* extension = PackAndInstallCRX( |
| 1714 path, pem_path, INSTALL_NEW, Extension::WAS_INSTALLED_BY_DEFAULT); | 1714 path, pem_path, INSTALL_NEW, Extension::WAS_INSTALLED_BY_DEFAULT, |
| 1715 Manifest::Location::INTERNAL); |
| 1715 | 1716 |
| 1716 EXPECT_EQ(0u, GetErrors().size()); | 1717 EXPECT_EQ(0u, GetErrors().size()); |
| 1717 ASSERT_EQ(1u, registry()->enabled_extensions().size()); | 1718 ASSERT_EQ(1u, registry()->enabled_extensions().size()); |
| 1718 EXPECT_EQ(permissions_crx, extension->id()); | 1719 EXPECT_EQ(permissions_crx, extension->id()); |
| 1719 | 1720 |
| 1720 // Verify that the valid API permissions have been recognized. | 1721 // Verify that the valid API permissions have been recognized. |
| 1721 expected_api_perms.insert(APIPermission::kTab); | 1722 expected_api_perms.insert(APIPermission::kTab); |
| 1722 | 1723 |
| 1723 std::unique_ptr<const PermissionSet> known_perms = | 1724 std::unique_ptr<const PermissionSet> known_perms = |
| 1724 prefs->GetGrantedPermissions(extension->id()); | 1725 prefs->GetGrantedPermissions(extension->id()); |
| (...skipping 5225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6950 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); | 6951 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); |
| 6951 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); | 6952 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); |
| 6952 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6953 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
| 6953 | 6954 |
| 6954 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); | 6955 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); |
| 6955 UpdateExtension(id, v2_path, ENABLED); | 6956 UpdateExtension(id, v2_path, ENABLED); |
| 6956 | 6957 |
| 6957 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); | 6958 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); |
| 6958 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6959 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
| 6959 } | 6960 } |
| OLD | NEW |