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

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

Issue 2458093003: Add DCHECKs to validate ProfileIOData's list of protocols.
Patch Set: Merge remote-tracking branch 'origin/master' into detect_unregistered_schemes Created 4 years, 1 month 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
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 26df993e8235b375b9c8698f2ba13a0421066eea..75e6bec5be331385d13e93b4a90c1757f56365ff 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -192,10 +192,6 @@ class FakeDelegate : public ProtocolHandlerRegistry::Delegate {
const std::string& protocol,
ProtocolHandlerRegistry* registry) override;
- bool IsExternalHandlerRegistered(const std::string& protocol) override {
- return registered_protocols_.find(protocol) != registered_protocols_.end();
- }
-
bool IsFakeRegisteredWithOS(const std::string& protocol) {
return os_registered_protocols_.find(protocol) !=
os_registered_protocols_.end();
@@ -215,6 +211,10 @@ class FakeDelegate : public ProtocolHandlerRegistry::Delegate {
bool force_os_failure() { return force_os_failure_; }
+ bool IsExternalHandlerRegistered(const std::string& protocol) {
+ return registered_protocols_.find(protocol) != registered_protocols_.end();
+ }
+
private:
std::set<std::string> registered_protocols_;
std::set<std::string> os_registered_protocols_;
@@ -443,13 +443,17 @@ TEST_F(ProtocolHandlerRegistryTest, ClearDefaultMakesProtocolNotHandled) {
TEST_F(ProtocolHandlerRegistryTest, DisableDeregistersProtocolHandlers) {
ASSERT_FALSE(delegate()->IsExternalHandlerRegistered("test"));
+ ASSERT_TRUE(delegate()->CanSchemeBeOverridden("test"));
registry()->OnAcceptRegisterProtocolHandler(test_protocol_handler());
ASSERT_TRUE(delegate()->IsExternalHandlerRegistered("test"));
+ ASSERT_FALSE(delegate()->CanSchemeBeOverridden("test"));
registry()->Disable();
ASSERT_FALSE(delegate()->IsExternalHandlerRegistered("test"));
+ ASSERT_TRUE(delegate()->CanSchemeBeOverridden("test"));
registry()->Enable();
ASSERT_TRUE(delegate()->IsExternalHandlerRegistered("test"));
+ ASSERT_FALSE(delegate()->CanSchemeBeOverridden("test"));
}
TEST_F(ProtocolHandlerRegistryTest, IgnoreProtocolHandler) {
« no previous file with comments | « chrome/browser/custom_handlers/protocol_handler_registry.cc ('k') | chrome/browser/net/chrome_url_request_context_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698