Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: chrome/common/extensions/permissions/permission_set_unittest.cc

Issue 10920070: Remove permission warnings from most tabs and windows APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 { "devtools", true }, 761 { "devtools", true },
762 { "extension", true }, 762 { "extension", true },
763 { "i18n", true }, 763 { "i18n", true },
764 { "pageAction", true }, 764 { "pageAction", true },
765 { "pageActions", true }, 765 { "pageActions", true },
766 { "test", true }, 766 { "test", true },
767 // Some negative tests. 767 // Some negative tests.
768 { "bookmarks", false }, 768 { "bookmarks", false },
769 { "cookies", false }, 769 { "cookies", false },
770 { "history", false }, 770 { "history", false },
771 { "tabs.onUpdated", false },
772 // Make sure we find the module name after stripping '.' and '/'. 771 // Make sure we find the module name after stripping '.' and '/'.
773 { "browserAction/abcd/onClick", true }, 772 { "browserAction/abcd/onClick", true },
774 { "browserAction.abcd.onClick", true }, 773 { "browserAction.abcd.onClick", true },
775 // Test Tabs functions. 774 // Test Tabs functions.
776 { "tabs.create", true}, 775 { "tabs.create", true},
777 { "tabs.update", true}, 776 { "tabs.update", true},
778 { "tabs.getSelected", false}, 777 { "tabs.getSelected", true},
778 { "tabs.onUpdated", true },
779 }; 779 };
780 780
781 scoped_refptr<PermissionSet> empty = new PermissionSet(); 781 scoped_refptr<PermissionSet> empty = new PermissionSet();
782 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) { 782 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) {
783 EXPECT_EQ(kTests[i].expect_success, 783 EXPECT_EQ(kTests[i].expect_success,
784 empty->HasAccessToFunction(kTests[i].permission_name)); 784 empty->HasAccessToFunction(kTests[i].permission_name))
785 << "Permission being tested: " << kTests[i].permission_name;
785 } 786 }
786 } 787 }
787 788
788 // Tests the default permissions (empty API permission set). 789 // Tests the default permissions (empty API permission set).
789 TEST(PermissionsTest, DefaultAnyAPIAccess) { 790 TEST(PermissionsTest, DefaultAnyAPIAccess) {
790 const struct { 791 const struct {
791 const char* api_name; 792 const char* api_name;
792 bool expect_success; 793 bool expect_success;
793 } kTests[] = { 794 } kTests[] = {
794 // Negative test. 795 // Negative test.
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 apis.insert(APIPermission::kWebRequest); 1269 apis.insert(APIPermission::kWebRequest);
1269 apis.insert(APIPermission::kFileBrowserHandler); 1270 apis.insert(APIPermission::kFileBrowserHandler);
1270 EXPECT_EQ(2U, apis.size()); 1271 EXPECT_EQ(2U, apis.size());
1271 1272
1272 scoped_refptr<PermissionSet> perm_set; 1273 scoped_refptr<PermissionSet> perm_set;
1273 perm_set = new PermissionSet(apis, empty_extent, empty_extent); 1274 perm_set = new PermissionSet(apis, empty_extent, empty_extent);
1274 EXPECT_EQ(4U, perm_set->apis().size()); 1275 EXPECT_EQ(4U, perm_set->apis().size());
1275 } 1276 }
1276 1277
1277 } // namespace extensions 1278 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698