OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 std::vector<std::string> output; | 181 std::vector<std::string> output; |
182 registry_->GetRegisteredProtocols(&output); | 182 registry_->GetRegisteredProtocols(&output); |
183 called_ = true; | 183 called_ = true; |
184 } | 184 } |
185 | 185 |
186 ProtocolHandlerRegistry* registry_; | 186 ProtocolHandlerRegistry* registry_; |
187 bool called_; | 187 bool called_; |
188 NotificationRegistrar notification_registrar_; | 188 NotificationRegistrar notification_registrar_; |
189 }; | 189 }; |
190 | 190 |
191 class ProtocolHandlerRegistryTest : public testing::Test { | 191 class ProtocolHandlerRegistryTest : public TestingBrowserProcessTest { |
192 protected: | 192 protected: |
193 ProtocolHandlerRegistryTest() | 193 ProtocolHandlerRegistryTest() |
194 : test_protocol_handler_(CreateProtocolHandler("test", "test")) {} | 194 : test_protocol_handler_(CreateProtocolHandler("test", "test")) {} |
195 | 195 |
196 FakeDelegate* delegate() const { return delegate_; } | 196 FakeDelegate* delegate() const { return delegate_; } |
197 TestingProfile* profile() const { return profile_.get(); } | 197 TestingProfile* profile() const { return profile_.get(); } |
198 PrefService* pref_service() const { return profile_->GetPrefs(); } | 198 PrefService* pref_service() const { return profile_->GetPrefs(); } |
199 ProtocolHandlerRegistry* registry() const { return registry_.get(); } | 199 ProtocolHandlerRegistry* registry() const { return registry_.get(); } |
200 const ProtocolHandler& test_protocol_handler() const { | 200 const ProtocolHandler& test_protocol_handler() const { |
201 return test_protocol_handler_; | 201 return test_protocol_handler_; |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 } | 666 } |
667 | 667 |
668 TEST_F(ProtocolHandlerRegistryTest, TestLoadEnabledGetsPropogatedToIO) { | 668 TEST_F(ProtocolHandlerRegistryTest, TestLoadEnabledGetsPropogatedToIO) { |
669 registry()->Disable(); | 669 registry()->Disable(); |
670 ReloadProtocolHandlerRegistry(); | 670 ReloadProtocolHandlerRegistry(); |
671 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 671 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
672 NewRunnableFunction(QuitUILoop)); | 672 NewRunnableFunction(QuitUILoop)); |
673 MessageLoop::current()->Run(); | 673 MessageLoop::current()->Run(); |
674 ASSERT_FALSE(enabled_io()); | 674 ASSERT_FALSE(enabled_io()); |
675 } | 675 } |
OLD | NEW |