| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/permissions_based_management_policy_provider
.h" | 5 #include "chrome/browser/extensions/permissions_based_management_policy_provider
.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 manifest_dict.Set(manifest_keys::kPermissions, | 67 manifest_dict.Set(manifest_keys::kPermissions, |
| 68 required_permissions->DeepCopy()); | 68 required_permissions->DeepCopy()); |
| 69 } | 69 } |
| 70 if (optional_permissions) { | 70 if (optional_permissions) { |
| 71 manifest_dict.Set(manifest_keys::kOptionalPermissions, | 71 manifest_dict.Set(manifest_keys::kOptionalPermissions, |
| 72 optional_permissions->DeepCopy()); | 72 optional_permissions->DeepCopy()); |
| 73 } | 73 } |
| 74 std::string error; | 74 std::string error; |
| 75 scoped_refptr<const Extension> extension = Extension::Create( | 75 scoped_refptr<const Extension> extension = Extension::Create( |
| 76 base::FilePath(), location, manifest_dict, Extension::NO_FLAGS, &error); | 76 base::FilePath(), location, manifest_dict, Extension::NO_FLAGS, &error); |
| 77 CHECK(extension.get()) << error; | 77 CHECK(extension.get()); |
| 78 return extension; | 78 return extension; |
| 79 } | 79 } |
| 80 | 80 |
| 81 protected: | 81 protected: |
| 82 std::vector<std::unique_ptr<APIPermissionInfo>> perm_list_; | 82 std::vector<std::unique_ptr<APIPermissionInfo>> perm_list_; |
| 83 | 83 |
| 84 std::unique_ptr<TestingPrefServiceSimple> pref_service_; | 84 std::unique_ptr<TestingPrefServiceSimple> pref_service_; |
| 85 std::unique_ptr<ExtensionManagement> settings_; | 85 std::unique_ptr<ExtensionManagement> settings_; |
| 86 | 86 |
| 87 PermissionsBasedManagementPolicyProvider provider_; | 87 PermissionsBasedManagementPolicyProvider provider_; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 pref.ClearBlockedPermissions("*"); | 158 pref.ClearBlockedPermissions("*"); |
| 159 pref.AddBlockedPermission("*", | 159 pref.AddBlockedPermission("*", |
| 160 GetAPIPermissionName(APIPermission::kDownloads)); | 160 GetAPIPermissionName(APIPermission::kDownloads)); |
| 161 } | 161 } |
| 162 error16.clear(); | 162 error16.clear(); |
| 163 EXPECT_FALSE(provider_.UserMayLoad(extension.get(), &error16)); | 163 EXPECT_FALSE(provider_.UserMayLoad(extension.get(), &error16)); |
| 164 EXPECT_FALSE(error16.empty()); | 164 EXPECT_FALSE(error16.empty()); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace extensions | 167 } // namespace extensions |
| OLD | NEW |