OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/json/json_file_value_serializer.h" | 6 #include "base/json/json_file_value_serializer.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 // Platform apps. | 728 // Platform apps. |
729 skip.insert(APIPermission::kFileSystem); | 729 skip.insert(APIPermission::kFileSystem); |
730 skip.insert(APIPermission::kSocket); | 730 skip.insert(APIPermission::kSocket); |
731 | 731 |
732 PermissionsInfo* info = PermissionsInfo::GetInstance(); | 732 PermissionsInfo* info = PermissionsInfo::GetInstance(); |
733 APIPermissionSet permissions = info->GetAll(); | 733 APIPermissionSet permissions = info->GetAll(); |
734 for (APIPermissionSet::const_iterator i = permissions.begin(); | 734 for (APIPermissionSet::const_iterator i = permissions.begin(); |
735 i != permissions.end(); ++i) { | 735 i != permissions.end(); ++i) { |
736 const APIPermissionInfo* permission_info = i->info(); | 736 const APIPermissionInfo* permission_info = i->info(); |
737 EXPECT_TRUE(permission_info != NULL); | 737 EXPECT_TRUE(permission_info != NULL); |
738 | |
739 // Always skip permissions that cannot be in the manifest. | |
740 const APIPermission* permission = permission_info->CreateAPIPermission(); | |
741 if (permission->ManifestEntryForbidden()) { | |
742 continue; | |
743 } | |
744 delete permission; | |
745 | |
746 if (skip.count(i->id())) { | 738 if (skip.count(i->id())) { |
747 EXPECT_EQ(PermissionMessage::kNone, permission_info->message_id()) | 739 EXPECT_EQ(PermissionMessage::kNone, permission_info->message_id()) |
748 << "unexpected message_id for " << permission_info->name(); | 740 << "unexpected message_id for " << permission_info->name(); |
749 } else { | 741 } else { |
750 EXPECT_NE(PermissionMessage::kNone, permission_info->message_id()) | 742 EXPECT_NE(PermissionMessage::kNone, permission_info->message_id()) |
751 << "missing message_id for " << permission_info->name(); | 743 << "missing message_id for " << permission_info->name(); |
752 } | 744 } |
753 } | 745 } |
754 } | 746 } |
755 | 747 |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 apis.insert(APIPermission::kWebRequest); | 1343 apis.insert(APIPermission::kWebRequest); |
1352 apis.insert(APIPermission::kFileBrowserHandler); | 1344 apis.insert(APIPermission::kFileBrowserHandler); |
1353 EXPECT_EQ(2U, apis.size()); | 1345 EXPECT_EQ(2U, apis.size()); |
1354 | 1346 |
1355 scoped_refptr<PermissionSet> perm_set; | 1347 scoped_refptr<PermissionSet> perm_set; |
1356 perm_set = new PermissionSet(apis, empty_extent, empty_extent); | 1348 perm_set = new PermissionSet(apis, empty_extent, empty_extent); |
1357 EXPECT_EQ(4U, perm_set->apis().size()); | 1349 EXPECT_EQ(4U, perm_set->apis().size()); |
1358 } | 1350 } |
1359 | 1351 |
1360 } // namespace extensions | 1352 } // namespace extensions |
OLD | NEW |