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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 granted_permissions->scriptable_hosts()); | 339 granted_permissions->scriptable_hosts()); |
340 | 340 |
341 URLPatternSet::CreateUnion(ehost_perm_set1_, shost_perm_set1_, | 341 URLPatternSet::CreateUnion(ehost_perm_set1_, shost_perm_set1_, |
342 &effective_permissions_); | 342 &effective_permissions_); |
343 EXPECT_EQ(effective_permissions_, granted_permissions->effective_hosts()); | 343 EXPECT_EQ(effective_permissions_, granted_permissions->effective_hosts()); |
344 | 344 |
345 // Add the rest of the permissions. | 345 // Add the rest of the permissions. |
346 permissions = new PermissionSet( | 346 permissions = new PermissionSet( |
347 api_perm_set2_, ehost_perm_set2_, shost_perm_set2_); | 347 api_perm_set2_, ehost_perm_set2_, shost_perm_set2_); |
348 | 348 |
349 std::set_union(expected_apis.begin(), expected_apis.end(), | 349 APIPermissionSet::Union(expected_apis, api_perm_set2_, &api_permissions_); |
350 api_perm_set2_.begin(), api_perm_set2_.end(), | |
351 std::inserter(api_permissions_, api_permissions_.begin())); | |
352 | 350 |
353 prefs()->AddGrantedPermissions(extension_id_, permissions.get()); | 351 prefs()->AddGrantedPermissions(extension_id_, permissions.get()); |
354 granted_permissions = prefs()->GetGrantedPermissions(extension_id_); | 352 granted_permissions = prefs()->GetGrantedPermissions(extension_id_); |
355 EXPECT_TRUE(granted_permissions.get()); | 353 EXPECT_TRUE(granted_permissions.get()); |
356 EXPECT_FALSE(granted_permissions->IsEmpty()); | 354 EXPECT_FALSE(granted_permissions->IsEmpty()); |
357 EXPECT_EQ(api_permissions_, granted_permissions->apis()); | 355 EXPECT_EQ(api_permissions_, granted_permissions->apis()); |
358 EXPECT_EQ(ehost_permissions_, | 356 EXPECT_EQ(ehost_permissions_, |
359 granted_permissions->explicit_hosts()); | 357 granted_permissions->explicit_hosts()); |
360 EXPECT_EQ(shost_permissions_, | 358 EXPECT_EQ(shost_permissions_, |
361 granted_permissions->scriptable_hosts()); | 359 granted_permissions->scriptable_hosts()); |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 EXPECT_EQ(string16(), error16); | 1251 EXPECT_EQ(string16(), error16); |
1254 EXPECT_TRUE(prefs()->UserMayModifySettings(extension_.get(), &error16)); | 1252 EXPECT_TRUE(prefs()->UserMayModifySettings(extension_.get(), &error16)); |
1255 EXPECT_EQ(string16(), error16); | 1253 EXPECT_EQ(string16(), error16); |
1256 EXPECT_FALSE(prefs()->MustRemainEnabled(extension_.get(), &error16)); | 1254 EXPECT_FALSE(prefs()->MustRemainEnabled(extension_.get(), &error16)); |
1257 EXPECT_EQ(string16(), error16); | 1255 EXPECT_EQ(string16(), error16); |
1258 } | 1256 } |
1259 }; | 1257 }; |
1260 TEST_F(ExtensionPrefsNotRequiredExtension, NotRequiredExtension) {} | 1258 TEST_F(ExtensionPrefsNotRequiredExtension, NotRequiredExtension) {} |
1261 | 1259 |
1262 } // namespace extensions | 1260 } // namespace extensions |
OLD | NEW |