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

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

Issue 311113006: Collapsing the permission for "kTabs" and "kHostsAll" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the code style nits. Created 6 years, 6 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
« no previous file with comments | « chrome/common/extensions/permissions/chrome_permission_message_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 "chrome://favicon/")); 857 "chrome://favicon/"));
858 scoped_refptr<PermissionSet> permissions( 858 scoped_refptr<PermissionSet> permissions(
859 new PermissionSet(api_permissions, ManifestPermissionSet(), 859 new PermissionSet(api_permissions, ManifestPermissionSet(),
860 hosts, URLPatternSet())); 860 hosts, URLPatternSet()));
861 PermissionMessages messages = 861 PermissionMessages messages =
862 PermissionMessageProvider::Get()->GetPermissionMessages( 862 PermissionMessageProvider::Get()->GetPermissionMessages(
863 permissions, Manifest::TYPE_EXTENSION); 863 permissions, Manifest::TYPE_EXTENSION);
864 EXPECT_EQ(1u, messages.size()); 864 EXPECT_EQ(1u, messages.size());
865 EXPECT_EQ(PermissionMessage::kBrowsingHistory, messages[0].id()); 865 EXPECT_EQ(PermissionMessage::kBrowsingHistory, messages[0].id());
866 } 866 }
867 {
868 APIPermissionSet api_permissions;
869 URLPatternSet hosts;
870 hosts.AddPattern(URLPattern(URLPattern::SCHEME_CHROMEUI, "*://*/*"));
871 api_permissions.insert(APIPermission::kTab);
872 scoped_refptr<PermissionSet> permissions(new PermissionSet(
873 api_permissions, ManifestPermissionSet(), hosts, URLPatternSet()));
874 PermissionMessages messages =
875 PermissionMessageProvider::Get()->GetPermissionMessages(
876 permissions, Manifest::TYPE_EXTENSION);
877 EXPECT_EQ(1u, messages.size());
878 EXPECT_EQ(PermissionMessage::kHostsAll, messages[0].id());
879 }
867 } 880 }
868 881
869 TEST(PermissionsTest, MergedFileSystemPermissionComparison) { 882 TEST(PermissionsTest, MergedFileSystemPermissionComparison) {
870 APIPermissionSet write_api_permissions; 883 APIPermissionSet write_api_permissions;
871 write_api_permissions.insert(APIPermission::kFileSystemWrite); 884 write_api_permissions.insert(APIPermission::kFileSystemWrite);
872 scoped_refptr<PermissionSet> write_permissions( 885 scoped_refptr<PermissionSet> write_permissions(
873 new PermissionSet(write_api_permissions, ManifestPermissionSet(), 886 new PermissionSet(write_api_permissions, ManifestPermissionSet(),
874 URLPatternSet(), URLPatternSet())); 887 URLPatternSet(), URLPatternSet()));
875 888
876 APIPermissionSet directory_api_permissions; 889 APIPermissionSet directory_api_permissions;
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 scoped_refptr<const PermissionSet> permissions_dwr( 1598 scoped_refptr<const PermissionSet> permissions_dwr(
1586 extension_dwr->permissions_data()->active_permissions()); 1599 extension_dwr->permissions_data()->active_permissions());
1587 1600
1588 EXPECT_FALSE(PermissionMessageProvider::Get()-> 1601 EXPECT_FALSE(PermissionMessageProvider::Get()->
1589 IsPrivilegeIncrease(permissions.get(), 1602 IsPrivilegeIncrease(permissions.get(),
1590 permissions_dwr.get(), 1603 permissions_dwr.get(),
1591 extension->GetType())); 1604 extension->GetType()));
1592 } 1605 }
1593 1606
1594 } // namespace extensions 1607 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/chrome_permission_message_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698