| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // to harness our tests so all threads use the same loop allowing us to | 279 // to harness our tests so all threads use the same loop allowing us to |
| 280 // guarantee all messages are processed.) By overriding the IsType method | 280 // guarantee all messages are processed.) By overriding the IsType method |
| 281 // we basically ignore the supplied message loop type, and instead infer | 281 // we basically ignore the supplied message loop type, and instead infer |
| 282 // our type based on the current thread. GO DEPENDENCY INJECTION! | 282 // our type based on the current thread. GO DEPENDENCY INJECTION! |
| 283 class TestMessageLoop : public base::MessageLoop { | 283 class TestMessageLoop : public base::MessageLoop { |
| 284 public: | 284 public: |
| 285 TestMessageLoop() {} | 285 TestMessageLoop() {} |
| 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 #if defined(TOOLKIT_GTK) | |
| 290 case base::MessageLoop::TYPE_GPU: | |
| 291 #endif | |
| 292 case base::MessageLoop::TYPE_UI: | 289 case base::MessageLoop::TYPE_UI: |
| 293 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 290 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
| 294 case base::MessageLoop::TYPE_IO: | 291 case base::MessageLoop::TYPE_IO: |
| 295 return BrowserThread::CurrentlyOn(BrowserThread::IO); | 292 return BrowserThread::CurrentlyOn(BrowserThread::IO); |
| 296 #if defined(OS_ANDROID) | 293 #if defined(OS_ANDROID) |
| 297 case base::MessageLoop::TYPE_JAVA: // fall-through | 294 case base::MessageLoop::TYPE_JAVA: // fall-through |
| 298 #endif // defined(OS_ANDROID) | 295 #endif // defined(OS_ANDROID) |
| 299 case base::MessageLoop::TYPE_CUSTOM: | 296 case base::MessageLoop::TYPE_CUSTOM: |
| 300 case base::MessageLoop::TYPE_DEFAULT: | 297 case base::MessageLoop::TYPE_DEFAULT: |
| 301 return !BrowserThread::CurrentlyOn(BrowserThread::UI) && | 298 return !BrowserThread::CurrentlyOn(BrowserThread::UI) && |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 | 920 |
| 924 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { | 921 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { |
| 925 RecreateRegistry(false); | 922 RecreateRegistry(false); |
| 926 registry()->AddPredefinedHandler(CreateProtocolHandler( | 923 registry()->AddPredefinedHandler(CreateProtocolHandler( |
| 927 "test", GURL("http://test.com/%s"), "Test")); | 924 "test", GURL("http://test.com/%s"), "Test")); |
| 928 registry()->InitProtocolSettings(); | 925 registry()->InitProtocolSettings(); |
| 929 std::vector<std::string> protocols; | 926 std::vector<std::string> protocols; |
| 930 registry()->GetRegisteredProtocols(&protocols); | 927 registry()->GetRegisteredProtocols(&protocols); |
| 931 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); | 928 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); |
| 932 } | 929 } |
| OLD | NEW |