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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 { "devtools", true }, | 759 { "devtools", true }, |
760 { "extension", true }, | 760 { "extension", true }, |
761 { "i18n", true }, | 761 { "i18n", true }, |
762 { "pageAction", true }, | 762 { "pageAction", true }, |
763 { "pageActions", true }, | 763 { "pageActions", true }, |
764 { "test", true }, | 764 { "test", true }, |
765 // Some negative tests. | 765 // Some negative tests. |
766 { "bookmarks", false }, | 766 { "bookmarks", false }, |
767 { "cookies", false }, | 767 { "cookies", false }, |
768 { "history", false }, | 768 { "history", false }, |
769 { "tabs.onUpdated", false }, | |
770 // Make sure we find the module name after stripping '.' and '/'. | 769 // Make sure we find the module name after stripping '.' and '/'. |
771 { "browserAction/abcd/onClick", true }, | 770 { "browserAction/abcd/onClick", true }, |
772 { "browserAction.abcd.onClick", true }, | 771 { "browserAction.abcd.onClick", true }, |
773 // Test Tabs functions. | 772 // Test Tabs functions. |
774 { "tabs.create", true}, | 773 { "tabs.create", true}, |
775 { "tabs.update", true}, | 774 { "tabs.update", true}, |
776 { "tabs.getSelected", false}, | 775 { "tabs.getSelected", true}, |
| 776 { "tabs.onUpdated", true }, |
777 }; | 777 }; |
778 | 778 |
779 scoped_refptr<PermissionSet> empty = new PermissionSet(); | 779 scoped_refptr<PermissionSet> empty = new PermissionSet(); |
780 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) { | 780 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) { |
781 EXPECT_EQ(kTests[i].expect_success, | 781 EXPECT_EQ(kTests[i].expect_success, |
782 empty->HasAccessToFunction(kTests[i].permission_name)); | 782 empty->HasAccessToFunction(kTests[i].permission_name)) |
| 783 << "Permission being tested: " << kTests[i].permission_name; |
783 } | 784 } |
784 } | 785 } |
785 | 786 |
786 // Tests the default permissions (empty API permission set). | 787 // Tests the default permissions (empty API permission set). |
787 TEST(PermissionsTest, DefaultAnyAPIAccess) { | 788 TEST(PermissionsTest, DefaultAnyAPIAccess) { |
788 const struct { | 789 const struct { |
789 const char* api_name; | 790 const char* api_name; |
790 bool expect_success; | 791 bool expect_success; |
791 } kTests[] = { | 792 } kTests[] = { |
792 // Negative test. | 793 // Negative test. |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 apis.insert(APIPermission::kWebRequest); | 1267 apis.insert(APIPermission::kWebRequest); |
1267 apis.insert(APIPermission::kFileBrowserHandler); | 1268 apis.insert(APIPermission::kFileBrowserHandler); |
1268 EXPECT_EQ(2U, apis.size()); | 1269 EXPECT_EQ(2U, apis.size()); |
1269 | 1270 |
1270 scoped_refptr<PermissionSet> perm_set; | 1271 scoped_refptr<PermissionSet> perm_set; |
1271 perm_set = new PermissionSet(apis, empty_extent, empty_extent); | 1272 perm_set = new PermissionSet(apis, empty_extent, empty_extent); |
1272 EXPECT_EQ(4U, perm_set->apis().size()); | 1273 EXPECT_EQ(4U, perm_set->apis().size()); |
1273 } | 1274 } |
1274 | 1275 |
1275 } // namespace extensions | 1276 } // namespace extensions |
OLD | NEW |