| 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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 class TestMessageLoop : public base::MessageLoop { | 283 class TestMessageLoop : public base::MessageLoop { |
| 284 public: | 284 public: |
| 285 TestMessageLoop() : base::MessageLoop(base::MessageLoop::TYPE_DEFAULT) {} | 285 TestMessageLoop() : base::MessageLoop(base::MessageLoop::TYPE_DEFAULT) {} |
| 286 virtual ~TestMessageLoop() {} | 286 virtual ~TestMessageLoop() {} |
| 287 virtual bool IsType(base::MessageLoop::Type type) const OVERRIDE { | 287 virtual bool IsType(base::MessageLoop::Type type) const OVERRIDE { |
| 288 switch (type) { | 288 switch (type) { |
| 289 case base::MessageLoop::TYPE_UI: | 289 case base::MessageLoop::TYPE_UI: |
| 290 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 290 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
| 291 case base::MessageLoop::TYPE_IO: | 291 case base::MessageLoop::TYPE_IO: |
| 292 return BrowserThread::CurrentlyOn(BrowserThread::IO); | 292 return BrowserThread::CurrentlyOn(BrowserThread::IO); |
| 293 #if defined(OS_ANDROID) |
| 294 case base::MessageLoop::TYPE_JAVA: // fall-through |
| 295 #endif // defined(OS_ANDROID) |
| 293 case base::MessageLoop::TYPE_DEFAULT: | 296 case base::MessageLoop::TYPE_DEFAULT: |
| 294 return !BrowserThread::CurrentlyOn(BrowserThread::UI) && | 297 return !BrowserThread::CurrentlyOn(BrowserThread::UI) && |
| 295 !BrowserThread::CurrentlyOn(BrowserThread::IO); | 298 !BrowserThread::CurrentlyOn(BrowserThread::IO); |
| 296 } | 299 } |
| 297 return false; | 300 return false; |
| 298 } | 301 } |
| 299 }; | 302 }; |
| 300 | 303 |
| 301 } // namespace | 304 } // namespace |
| 302 | 305 |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 | 919 |
| 917 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { | 920 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { |
| 918 RecreateRegistry(false); | 921 RecreateRegistry(false); |
| 919 registry()->AddPredefinedHandler(CreateProtocolHandler( | 922 registry()->AddPredefinedHandler(CreateProtocolHandler( |
| 920 "test", GURL("http://test.com/%s"), "Test")); | 923 "test", GURL("http://test.com/%s"), "Test")); |
| 921 registry()->InitProtocolSettings(); | 924 registry()->InitProtocolSettings(); |
| 922 std::vector<std::string> protocols; | 925 std::vector<std::string> protocols; |
| 923 registry()->GetRegisteredProtocols(&protocols); | 926 registry()->GetRegisteredProtocols(&protocols); |
| 924 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); | 927 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); |
| 925 } | 928 } |
| OLD | NEW |