| 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 "extension_prefs_unittest.h" | 5 #include "extension_prefs_unittest.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 granted_permissions->scriptable_hosts()); | 247 granted_permissions->scriptable_hosts()); |
| 248 | 248 |
| 249 URLPatternSet::CreateUnion(ehost_perm_set1_, shost_perm_set1_, | 249 URLPatternSet::CreateUnion(ehost_perm_set1_, shost_perm_set1_, |
| 250 &effective_permissions_); | 250 &effective_permissions_); |
| 251 EXPECT_EQ(effective_permissions_, granted_permissions->effective_hosts()); | 251 EXPECT_EQ(effective_permissions_, granted_permissions->effective_hosts()); |
| 252 | 252 |
| 253 // Add the rest of the permissions. | 253 // Add the rest of the permissions. |
| 254 permissions = new PermissionSet( | 254 permissions = new PermissionSet( |
| 255 api_perm_set2_, ehost_perm_set2_, shost_perm_set2_); | 255 api_perm_set2_, ehost_perm_set2_, shost_perm_set2_); |
| 256 | 256 |
| 257 std::set_union(expected_apis.begin(), expected_apis.end(), | 257 APIPermissionSet::Union(expected_apis, api_perm_set2_, &api_permissions_); |
| 258 api_perm_set2_.begin(), api_perm_set2_.end(), | |
| 259 std::inserter(api_permissions_, api_permissions_.begin())); | |
| 260 | 258 |
| 261 prefs()->AddGrantedPermissions(extension_id_, permissions.get()); | 259 prefs()->AddGrantedPermissions(extension_id_, permissions.get()); |
| 262 granted_permissions = prefs()->GetGrantedPermissions(extension_id_); | 260 granted_permissions = prefs()->GetGrantedPermissions(extension_id_); |
| 263 EXPECT_TRUE(granted_permissions.get()); | 261 EXPECT_TRUE(granted_permissions.get()); |
| 264 EXPECT_FALSE(granted_permissions->IsEmpty()); | 262 EXPECT_FALSE(granted_permissions->IsEmpty()); |
| 265 EXPECT_EQ(api_permissions_, granted_permissions->apis()); | 263 EXPECT_EQ(api_permissions_, granted_permissions->apis()); |
| 266 EXPECT_EQ(ehost_permissions_, | 264 EXPECT_EQ(ehost_permissions_, |
| 267 granted_permissions->explicit_hosts()); | 265 granted_permissions->explicit_hosts()); |
| 268 EXPECT_EQ(shost_permissions_, | 266 EXPECT_EQ(shost_permissions_, |
| 269 granted_permissions->scriptable_hosts()); | 267 granted_permissions->scriptable_hosts()); |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 EXPECT_EQ(string16(), error16); | 1159 EXPECT_EQ(string16(), error16); |
| 1162 EXPECT_TRUE(prefs()->UserMayModifySettings(extension_.get(), &error16)); | 1160 EXPECT_TRUE(prefs()->UserMayModifySettings(extension_.get(), &error16)); |
| 1163 EXPECT_EQ(string16(), error16); | 1161 EXPECT_EQ(string16(), error16); |
| 1164 EXPECT_FALSE(prefs()->MustRemainEnabled(extension_.get(), &error16)); | 1162 EXPECT_FALSE(prefs()->MustRemainEnabled(extension_.get(), &error16)); |
| 1165 EXPECT_EQ(string16(), error16); | 1163 EXPECT_EQ(string16(), error16); |
| 1166 } | 1164 } |
| 1167 }; | 1165 }; |
| 1168 TEST_F(ExtensionPrefsNotRequiredExtension, NotRequiredExtension) {} | 1166 TEST_F(ExtensionPrefsNotRequiredExtension, NotRequiredExtension) {} |
| 1169 | 1167 |
| 1170 } // namespace extensions | 1168 } // namespace extensions |
| OLD | NEW |