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

Side by Side Diff: chrome/browser/extensions/permissions_based_management_policy_provider_unittest.cc

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Fix SupervisedUserWhitelistInstaller Created 3 years, 8 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
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // |optional_permissions|. 58 // |optional_permissions|.
59 scoped_refptr<const Extension> CreateExtensionWithPermission( 59 scoped_refptr<const Extension> CreateExtensionWithPermission(
60 Manifest::Location location, 60 Manifest::Location location,
61 const base::ListValue* required_permissions, 61 const base::ListValue* required_permissions,
62 const base::ListValue* optional_permissions) { 62 const base::ListValue* optional_permissions) {
63 base::DictionaryValue manifest_dict; 63 base::DictionaryValue manifest_dict;
64 manifest_dict.SetString(manifest_keys::kName, "test"); 64 manifest_dict.SetString(manifest_keys::kName, "test");
65 manifest_dict.SetString(manifest_keys::kVersion, "0.1"); 65 manifest_dict.SetString(manifest_keys::kVersion, "0.1");
66 if (required_permissions) { 66 if (required_permissions) {
67 manifest_dict.Set(manifest_keys::kPermissions, 67 manifest_dict.Set(manifest_keys::kPermissions,
68 required_permissions->DeepCopy()); 68 required_permissions->CreateDeepCopy());
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->CreateDeepCopy());
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()) << error;
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_;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698