Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Unified Diff: chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc

Issue 8371023: Calls to rph updating existing handlers are ignored. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/custom_handlers/protocol_handler_registry.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« no previous file with comments | « chrome/browser/custom_handlers/protocol_handler_registry.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698