| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 public: | 111 public: |
| 112 FakeProtocolClientWorker(ShellIntegration::DefaultWebClientObserver* observer, | 112 FakeProtocolClientWorker(ShellIntegration::DefaultWebClientObserver* observer, |
| 113 const std::string& protocol, | 113 const std::string& protocol, |
| 114 bool force_failure) | 114 bool force_failure) |
| 115 : ShellIntegration::DefaultProtocolClientWorker(observer, protocol), | 115 : ShellIntegration::DefaultProtocolClientWorker(observer, protocol), |
| 116 force_failure_(force_failure) {} | 116 force_failure_(force_failure) {} |
| 117 | 117 |
| 118 private: | 118 private: |
| 119 virtual ~FakeProtocolClientWorker() {} | 119 virtual ~FakeProtocolClientWorker() {} |
| 120 | 120 |
| 121 virtual ShellIntegration::DefaultWebClientState CheckIsDefault() { | 121 virtual ShellIntegration::DefaultWebClientState CheckIsDefault() OVERRIDE { |
| 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(bool interactive_permitted) {} | 129 virtual bool SetAsDefault(bool interactive_permitted) OVERRIDE { |
| 130 return true; |
| 131 } |
| 130 | 132 |
| 131 private: | 133 private: |
| 132 bool force_failure_; | 134 bool force_failure_; |
| 133 }; | 135 }; |
| 134 | 136 |
| 135 ProtocolHandlerRegistry::DefaultClientObserver* | 137 ProtocolHandlerRegistry::DefaultClientObserver* |
| 136 FakeDelegate::CreateShellObserver(ProtocolHandlerRegistry* registry) { | 138 FakeDelegate::CreateShellObserver(ProtocolHandlerRegistry* registry) { |
| 137 return new FakeClientObserver(registry, this); | 139 return new FakeClientObserver(registry, this); |
| 138 } | 140 } |
| 139 | 141 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 ASSERT_EQ(ph3.url().GetOrigin() == ph2.url().GetOrigin(), | 835 ASSERT_EQ(ph3.url().GetOrigin() == ph2.url().GetOrigin(), |
| 834 ph3.IsSameOrigin(ph2)); | 836 ph3.IsSameOrigin(ph2)); |
| 835 } | 837 } |
| 836 | 838 |
| 837 TEST_F(ProtocolHandlerRegistryTest, TestInstallDefaultHandler) { | 839 TEST_F(ProtocolHandlerRegistryTest, TestInstallDefaultHandler) { |
| 838 ReloadProtocolHandlerRegistryAndInstallDefaultHandler(); | 840 ReloadProtocolHandlerRegistryAndInstallDefaultHandler(); |
| 839 std::vector<std::string> protocols; | 841 std::vector<std::string> protocols; |
| 840 registry()->GetRegisteredProtocols(&protocols); | 842 registry()->GetRegisteredProtocols(&protocols); |
| 841 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); | 843 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); |
| 842 } | 844 } |
| OLD | NEW |