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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 granted_permissions->scriptable_hosts()); | 343 granted_permissions->scriptable_hosts()); |
344 | 344 |
345 URLPatternSet::CreateUnion(ehost_perm_set1_, shost_perm_set1_, | 345 URLPatternSet::CreateUnion(ehost_perm_set1_, shost_perm_set1_, |
346 &effective_permissions_); | 346 &effective_permissions_); |
347 EXPECT_EQ(effective_permissions_, granted_permissions->effective_hosts()); | 347 EXPECT_EQ(effective_permissions_, granted_permissions->effective_hosts()); |
348 | 348 |
349 // Add the rest of the permissions. | 349 // Add the rest of the permissions. |
350 permissions = new PermissionSet( | 350 permissions = new PermissionSet( |
351 api_perm_set2_, ehost_perm_set2_, shost_perm_set2_); | 351 api_perm_set2_, ehost_perm_set2_, shost_perm_set2_); |
352 | 352 |
353 std::set_union(expected_apis.begin(), expected_apis.end(), | 353 APIPermissionSet::Union(expected_apis, api_perm_set2_, &api_permissions_); |
354 api_perm_set2_.begin(), api_perm_set2_.end(), | |
355 std::inserter(api_permissions_, api_permissions_.begin())); | |
356 | 354 |
357 prefs()->AddGrantedPermissions(extension_id_, permissions.get()); | 355 prefs()->AddGrantedPermissions(extension_id_, permissions.get()); |
358 granted_permissions = prefs()->GetGrantedPermissions(extension_id_); | 356 granted_permissions = prefs()->GetGrantedPermissions(extension_id_); |
359 EXPECT_TRUE(granted_permissions.get()); | 357 EXPECT_TRUE(granted_permissions.get()); |
360 EXPECT_FALSE(granted_permissions->IsEmpty()); | 358 EXPECT_FALSE(granted_permissions->IsEmpty()); |
361 EXPECT_EQ(api_permissions_, granted_permissions->apis()); | 359 EXPECT_EQ(api_permissions_, granted_permissions->apis()); |
362 EXPECT_EQ(ehost_permissions_, | 360 EXPECT_EQ(ehost_permissions_, |
363 granted_permissions->explicit_hosts()); | 361 granted_permissions->explicit_hosts()); |
364 EXPECT_EQ(shost_permissions_, | 362 EXPECT_EQ(shost_permissions_, |
365 granted_permissions->scriptable_hosts()); | 363 granted_permissions->scriptable_hosts()); |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 EXPECT_EQ(string16(), error16); | 1255 EXPECT_EQ(string16(), error16); |
1258 EXPECT_TRUE(prefs()->UserMayModifySettings(extension_.get(), &error16)); | 1256 EXPECT_TRUE(prefs()->UserMayModifySettings(extension_.get(), &error16)); |
1259 EXPECT_EQ(string16(), error16); | 1257 EXPECT_EQ(string16(), error16); |
1260 EXPECT_FALSE(prefs()->MustRemainEnabled(extension_.get(), &error16)); | 1258 EXPECT_FALSE(prefs()->MustRemainEnabled(extension_.get(), &error16)); |
1261 EXPECT_EQ(string16(), error16); | 1259 EXPECT_EQ(string16(), error16); |
1262 } | 1260 } |
1263 }; | 1261 }; |
1264 TEST_F(ExtensionPrefsNotRequiredExtension, NotRequiredExtension) {} | 1262 TEST_F(ExtensionPrefsNotRequiredExtension, NotRequiredExtension) {} |
1265 | 1263 |
1266 } // namespace extensions | 1264 } // namespace extensions |
OLD | NEW |