| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/extensions/extension_permission_set.h" | 5 #include "chrome/common/extensions/extension_permission_set.h" |
| 6 | 6 |
| 7 #include "base/json/json_value_serializer.h" | 7 #include "base/json/json_value_serializer.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 expected_apis.insert(ExtensionAPIPermission::kTab); | 338 expected_apis.insert(ExtensionAPIPermission::kTab); |
| 339 expected_apis.insert(ExtensionAPIPermission::kProxy); | 339 expected_apis.insert(ExtensionAPIPermission::kProxy); |
| 340 expected_apis.insert(ExtensionAPIPermission::kClipboardWrite); | 340 expected_apis.insert(ExtensionAPIPermission::kClipboardWrite); |
| 341 expected_apis.insert(ExtensionAPIPermission::kPlugin); | 341 expected_apis.insert(ExtensionAPIPermission::kPlugin); |
| 342 | 342 |
| 343 AddPattern(&explicit_hosts2, "http://*.example.com/*"); | 343 AddPattern(&explicit_hosts2, "http://*.example.com/*"); |
| 344 AddPattern(&scriptable_hosts2, "http://*.google.com/*"); | 344 AddPattern(&scriptable_hosts2, "http://*.google.com/*"); |
| 345 AddPattern(&expected_explicit_hosts, "http://*.example.com/*"); | 345 AddPattern(&expected_explicit_hosts, "http://*.example.com/*"); |
| 346 AddPattern(&expected_scriptable_hosts, "http://*.google.com/*"); | 346 AddPattern(&expected_scriptable_hosts, "http://*.google.com/*"); |
| 347 | 347 |
| 348 effective_hosts.ClearPatterns(); | 348 URLPatternSet::CreateUnion( |
| 349 AddPattern(&effective_hosts, "<all_urls>"); | 349 explicit_hosts2, scriptable_hosts2, &effective_hosts); |
| 350 | 350 |
| 351 set2 = new ExtensionPermissionSet(apis2, explicit_hosts2, scriptable_hosts2); | 351 set2 = new ExtensionPermissionSet(apis2, explicit_hosts2, scriptable_hosts2); |
| 352 union_set = ExtensionPermissionSet::CreateUnion(set1.get(), set2.get()); | 352 union_set = ExtensionPermissionSet::CreateUnion(set1.get(), set2.get()); |
| 353 | 353 |
| 354 EXPECT_FALSE(set1->Contains(*set2)); | 354 EXPECT_FALSE(set1->Contains(*set2)); |
| 355 EXPECT_FALSE(set1->Contains(*union_set)); | 355 EXPECT_FALSE(set1->Contains(*union_set)); |
| 356 EXPECT_FALSE(set2->Contains(*set1)); | 356 EXPECT_FALSE(set2->Contains(*set1)); |
| 357 EXPECT_FALSE(set2->Contains(*union_set)); | 357 EXPECT_FALSE(set2->Contains(*union_set)); |
| 358 EXPECT_TRUE(union_set->Contains(*set1)); | 358 EXPECT_TRUE(union_set->Contains(*set1)); |
| 359 EXPECT_TRUE(union_set->Contains(*set2)); | 359 EXPECT_TRUE(union_set->Contains(*set2)); |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 AddPattern(&non_empty_extent, "http://www.google.com/*"); | 1091 AddPattern(&non_empty_extent, "http://www.google.com/*"); |
| 1092 | 1092 |
| 1093 perm_set = new ExtensionPermissionSet( | 1093 perm_set = new ExtensionPermissionSet( |
| 1094 empty_apis, non_empty_extent, empty_extent); | 1094 empty_apis, non_empty_extent, empty_extent); |
| 1095 EXPECT_FALSE(perm_set->IsEmpty()); | 1095 EXPECT_FALSE(perm_set->IsEmpty()); |
| 1096 | 1096 |
| 1097 perm_set = new ExtensionPermissionSet( | 1097 perm_set = new ExtensionPermissionSet( |
| 1098 empty_apis, empty_extent, non_empty_extent); | 1098 empty_apis, empty_extent, non_empty_extent); |
| 1099 EXPECT_FALSE(perm_set->IsEmpty()); | 1099 EXPECT_FALSE(perm_set->IsEmpty()); |
| 1100 } | 1100 } |
| OLD | NEW |