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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 force_failure_(force_failure) {} | 147 force_failure_(force_failure) {} |
148 | 148 |
149 private: | 149 private: |
150 ~FakeProtocolClientWorker() override = default; | 150 ~FakeProtocolClientWorker() override = default; |
151 | 151 |
152 shell_integration::DefaultWebClientState CheckIsDefaultImpl() override { | 152 shell_integration::DefaultWebClientState CheckIsDefaultImpl() override { |
153 return force_failure_ ? shell_integration::NOT_DEFAULT | 153 return force_failure_ ? shell_integration::NOT_DEFAULT |
154 : shell_integration::IS_DEFAULT; | 154 : shell_integration::IS_DEFAULT; |
155 } | 155 } |
156 | 156 |
157 void SetAsDefaultImpl() override {} | 157 void SetAsDefaultImpl(const base::Closure& on_finished_callback) override { |
| 158 on_finished_callback.Run(); |
| 159 } |
158 | 160 |
159 private: | 161 private: |
160 bool force_failure_; | 162 bool force_failure_; |
161 }; | 163 }; |
162 | 164 |
163 class FakeDelegate : public ProtocolHandlerRegistry::Delegate { | 165 class FakeDelegate : public ProtocolHandlerRegistry::Delegate { |
164 public: | 166 public: |
165 FakeDelegate() : force_os_failure_(false) {} | 167 FakeDelegate() : force_os_failure_(false) {} |
166 ~FakeDelegate() override {} | 168 ~FakeDelegate() override {} |
167 void RegisterExternalHandler(const std::string& protocol) override { | 169 void RegisterExternalHandler(const std::string& protocol) override { |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 // added to pref. | 1079 // added to pref. |
1078 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); | 1080 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); |
1079 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1081 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
1080 | 1082 |
1081 registry()->RemoveIgnoredHandler(p2u1); | 1083 registry()->RemoveIgnoredHandler(p2u1); |
1082 | 1084 |
1083 // p2u1 installed by user and policy, so it is removed from pref alone. | 1085 // p2u1 installed by user and policy, so it is removed from pref alone. |
1084 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); | 1086 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); |
1085 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1087 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
1086 } | 1088 } |
OLD | NEW |