Index: extensions/browser/extension_registry_unittest.cc |
diff --git a/extensions/browser/extension_registry_unittest.cc b/extensions/browser/extension_registry_unittest.cc |
index 4243dea4f39fc0703500463f5f4d306d2ec0df64..c73b51c513adf12a1ec36a242ff0f353889a3710 100644 |
--- a/extensions/browser/extension_registry_unittest.cc |
+++ b/extensions/browser/extension_registry_unittest.cc |
@@ -98,5 +98,72 @@ TEST_F(ExtensionRegistryTest, AddExtensionToRegistryTwice) { |
EXPECT_EQ(0u, registry.blacklisted_extensions().size()); |
} |
+TEST_F(ExtensionRegistryTest, GetExtensionById) { |
Yoyo Zhou
2014/01/07 02:26:13
Add at least one test that has a bitmask with more
|
+ ExtensionRegistry registry; |
+ |
+ // Trying to get an extension fails cleanly when the sets are empty. |
+ EXPECT_FALSE( |
+ registry.GetExtensionById("id", ExtensionRegistry::INCLUDE_EVERYTHING)); |
+ |
+ scoped_refptr<Extension> enabled = CreateExtensionWithID("enabled"); |
+ scoped_refptr<Extension> disabled = CreateExtensionWithID("disabled"); |
+ scoped_refptr<Extension> terminated = CreateExtensionWithID("terminated"); |
+ scoped_refptr<Extension> blacklisted = CreateExtensionWithID("blacklisted"); |
+ |
+ // Add an extension to each set. |
+ registry.AddEnabled(enabled); |
+ registry.AddDisabled(disabled); |
+ registry.AddTerminated(terminated); |
+ registry.AddBlacklisted(blacklisted); |
+ |
+ // Enabled is part of everything and the enabled list. |
+ EXPECT_TRUE(registry.GetExtensionById( |
+ "enabled", ExtensionRegistry::INCLUDE_EVERYTHING)); |
+ EXPECT_TRUE(registry.GetExtensionById( |
+ "enabled", ExtensionRegistry::INCLUDE_ENABLED)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "enabled", ExtensionRegistry::INCLUDE_DISABLED)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "enabled", ExtensionRegistry::INCLUDE_TERMINATED)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "enabled", ExtensionRegistry::INCLUDE_BLACKLISTED)); |
+ |
+ // Disabled is part of everything and the disabled list. |
+ EXPECT_TRUE(registry.GetExtensionById( |
+ "disabled", ExtensionRegistry::INCLUDE_EVERYTHING)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "disabled", ExtensionRegistry::INCLUDE_ENABLED)); |
+ EXPECT_TRUE(registry.GetExtensionById( |
+ "disabled", ExtensionRegistry::INCLUDE_DISABLED)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "disabled", ExtensionRegistry::INCLUDE_TERMINATED)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "disabled", ExtensionRegistry::INCLUDE_BLACKLISTED)); |
+ |
+ // Terminated is part of everything and the terminated list. |
+ EXPECT_TRUE(registry.GetExtensionById( |
+ "terminated", ExtensionRegistry::INCLUDE_EVERYTHING)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "terminated", ExtensionRegistry::INCLUDE_ENABLED)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "terminated", ExtensionRegistry::INCLUDE_DISABLED)); |
+ EXPECT_TRUE(registry.GetExtensionById( |
+ "terminated", ExtensionRegistry::INCLUDE_TERMINATED)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "terminated", ExtensionRegistry::INCLUDE_BLACKLISTED)); |
+ |
+ // Blacklisted is part of everything and the blacklisted list. |
+ EXPECT_TRUE(registry.GetExtensionById( |
+ "blacklisted", ExtensionRegistry::INCLUDE_EVERYTHING)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "blacklisted", ExtensionRegistry::INCLUDE_ENABLED)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "blacklisted", ExtensionRegistry::INCLUDE_DISABLED)); |
+ EXPECT_FALSE(registry.GetExtensionById( |
+ "blacklisted", ExtensionRegistry::INCLUDE_TERMINATED)); |
+ EXPECT_TRUE(registry.GetExtensionById( |
+ "blacklisted", ExtensionRegistry::INCLUDE_BLACKLISTED)); |
+} |
+ |
} // namespace |
} // namespace extensions |