| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/custom_handlers/protocol_handler_registry.h" | 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 virtual ~FakeProtocolClientWorker() {} | 119 virtual ~FakeProtocolClientWorker() {} |
| 120 | 120 |
| 121 virtual ShellIntegration::DefaultWebClientState CheckIsDefault() { | 121 virtual ShellIntegration::DefaultWebClientState CheckIsDefault() { |
| 122 if (force_failure_) { | 122 if (force_failure_) { |
| 123 return ShellIntegration::NOT_DEFAULT_WEB_CLIENT; | 123 return ShellIntegration::NOT_DEFAULT_WEB_CLIENT; |
| 124 } else { | 124 } else { |
| 125 return ShellIntegration::IS_DEFAULT_WEB_CLIENT; | 125 return ShellIntegration::IS_DEFAULT_WEB_CLIENT; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 virtual void SetAsDefault() {} | 129 virtual void SetAsDefault(bool interactive_permitted) {} |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 bool force_failure_; | 132 bool force_failure_; |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 ProtocolHandlerRegistry::DefaultClientObserver* | 135 ProtocolHandlerRegistry::DefaultClientObserver* |
| 136 FakeDelegate::CreateShellObserver(ProtocolHandlerRegistry* registry) { | 136 FakeDelegate::CreateShellObserver(ProtocolHandlerRegistry* registry) { |
| 137 return new FakeClientObserver(registry, this); | 137 return new FakeClientObserver(registry, this); |
| 138 } | 138 } |
| 139 | 139 |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 ASSERT_EQ(ph3.url().GetOrigin() == ph2.url().GetOrigin(), | 805 ASSERT_EQ(ph3.url().GetOrigin() == ph2.url().GetOrigin(), |
| 806 ph3.IsSameOrigin(ph2)); | 806 ph3.IsSameOrigin(ph2)); |
| 807 } | 807 } |
| 808 | 808 |
| 809 TEST_F(ProtocolHandlerRegistryTest, TestInstallDefaultHandler) { | 809 TEST_F(ProtocolHandlerRegistryTest, TestInstallDefaultHandler) { |
| 810 ReloadProtocolHandlerRegistryAndInstallDefaultHandler(); | 810 ReloadProtocolHandlerRegistryAndInstallDefaultHandler(); |
| 811 std::vector<std::string> protocols; | 811 std::vector<std::string> protocols; |
| 812 registry()->GetRegisteredProtocols(&protocols); | 812 registry()->GetRegisteredProtocols(&protocols); |
| 813 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); | 813 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); |
| 814 } | 814 } |
| OLD | NEW |