Index: chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc |
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc |
index 9c767d07b0c77db0255e482eaf3a3073897ec4af..b02be862141e8ac9edcf28ca59d25ebf72afdd9a 100644 |
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc |
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc |
@@ -465,6 +465,38 @@ TEST_F(ProtocolHandlerRegistryTest, TestIsEquivalentRegistered) { |
ASSERT_TRUE(registry()->HasRegisteredEquivalent(ph2)); |
} |
+TEST_F(ProtocolHandlerRegistryTest, TestSilentlyRegisterHandler) { |
+ ProtocolHandler ph1 = CreateProtocolHandler("test", GURL("http://test/%s"), |
+ "test1"); |
+ ProtocolHandler ph2 = CreateProtocolHandler("test", GURL("http://test/%s"), |
+ "test2"); |
+ ProtocolHandler ph3 = CreateProtocolHandler("ignore", GURL("http://test/%s"), |
+ "ignore1"); |
+ ProtocolHandler ph4 = CreateProtocolHandler("ignore", GURL("http://test/%s"), |
+ "ignore2"); |
+ |
+ ASSERT_FALSE(registry()->SilentlyHandleRegisterHandlerRequest(ph1)); |
+ ASSERT_FALSE(registry()->IsRegistered(ph1)); |
+ |
+ registry()->OnAcceptRegisterProtocolHandler(ph1); |
+ ASSERT_TRUE(registry()->IsRegistered(ph1)); |
+ |
+ ASSERT_TRUE(registry()->SilentlyHandleRegisterHandlerRequest(ph2)); |
+ ASSERT_FALSE(registry()->IsRegistered(ph1)); |
+ ASSERT_TRUE(registry()->IsRegistered(ph2)); |
+ |
+ ASSERT_FALSE(registry()->SilentlyHandleRegisterHandlerRequest(ph3)); |
+ ASSERT_FALSE(registry()->IsRegistered(ph3)); |
+ |
+ registry()->OnIgnoreRegisterProtocolHandler(ph3); |
+ ASSERT_FALSE(registry()->IsRegistered(ph3)); |
+ ASSERT_TRUE(registry()->IsIgnored(ph3)); |
+ |
+ ASSERT_TRUE(registry()->SilentlyHandleRegisterHandlerRequest(ph4)); |
+ ASSERT_FALSE(registry()->IsRegistered(ph4)); |
+ ASSERT_TRUE(registry()->HasIgnoredEquivalent(ph4)); |
+} |
+ |
TEST_F(ProtocolHandlerRegistryTest, TestRemoveHandlerRemovesDefault) { |
ProtocolHandler ph1 = CreateProtocolHandler("test", "test1"); |
ProtocolHandler ph2 = CreateProtocolHandler("test", "test2"); |