| 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/json/json_file_value_serializer.h" | 6 #include "base/json/json_file_value_serializer.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 // Make sure the extension's active permissions reflect the change. | 159 // Make sure the extension's active permissions reflect the change. |
| 160 scoped_refptr<PermissionSet> active_permissions = | 160 scoped_refptr<PermissionSet> active_permissions = |
| 161 PermissionSet::CreateUnion(default_permissions.get(), delta.get()); | 161 PermissionSet::CreateUnion(default_permissions.get(), delta.get()); |
| 162 ASSERT_EQ(*active_permissions.get(), | 162 ASSERT_EQ(*active_permissions.get(), |
| 163 *extension->GetActivePermissions().get()); | 163 *extension->GetActivePermissions().get()); |
| 164 | 164 |
| 165 // Verify that the new granted and active permissions were also stored | 165 // Verify that the new granted and active permissions were also stored |
| 166 // in the extension preferences. In this case, the granted permissions should | 166 // in the extension preferences. In this case, the granted permissions should |
| 167 // be equal to the active permissions. | 167 // be equal to the active permissions. |
| 168 ExtensionPrefs* prefs = service_->extension_prefs(); | 168 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get()); |
| 169 scoped_refptr<PermissionSet> granted_permissions = | 169 scoped_refptr<PermissionSet> granted_permissions = |
| 170 active_permissions; | 170 active_permissions; |
| 171 | 171 |
| 172 scoped_refptr<PermissionSet> from_prefs = | 172 scoped_refptr<PermissionSet> from_prefs = |
| 173 prefs->GetActivePermissions(extension->id()); | 173 prefs->GetActivePermissions(extension->id()); |
| 174 ASSERT_EQ(*active_permissions.get(), *from_prefs.get()); | 174 ASSERT_EQ(*active_permissions.get(), *from_prefs.get()); |
| 175 | 175 |
| 176 from_prefs = prefs->GetGrantedPermissions(extension->id()); | 176 from_prefs = prefs->GetGrantedPermissions(extension->id()); |
| 177 ASSERT_EQ(*active_permissions.get(), *from_prefs.get()); | 177 ASSERT_EQ(*active_permissions.get(), *from_prefs.get()); |
| 178 | 178 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 201 // Verify that the extension prefs hold the new active permissions and the | 201 // Verify that the extension prefs hold the new active permissions and the |
| 202 // same granted permissions. | 202 // same granted permissions. |
| 203 from_prefs = prefs->GetActivePermissions(extension->id()); | 203 from_prefs = prefs->GetActivePermissions(extension->id()); |
| 204 ASSERT_EQ(*active_permissions.get(), *from_prefs.get()); | 204 ASSERT_EQ(*active_permissions.get(), *from_prefs.get()); |
| 205 | 205 |
| 206 from_prefs = prefs->GetGrantedPermissions(extension->id()); | 206 from_prefs = prefs->GetGrantedPermissions(extension->id()); |
| 207 ASSERT_EQ(*granted_permissions.get(), *from_prefs.get()); | 207 ASSERT_EQ(*granted_permissions.get(), *from_prefs.get()); |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace extensions | 210 } // namespace extensions |
| OLD | NEW |