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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 net::URLRequest* request, | 66 net::URLRequest* request, |
67 net::NetworkDelegate* network_delegate) const OVERRIDE { | 67 net::NetworkDelegate* network_delegate) const OVERRIDE { |
68 return NULL; | 68 return NULL; |
69 } | 69 } |
70 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE { | 70 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE { |
71 return false; | 71 return false; |
72 } | 72 } |
73 virtual bool IsHandledURL(const GURL& url) const OVERRIDE { | 73 virtual bool IsHandledURL(const GURL& url) const OVERRIDE { |
74 return false; | 74 return false; |
75 } | 75 } |
76 virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE { | |
77 return true; | |
78 } | |
79 }; | 76 }; |
80 | 77 |
81 void AssertWillHandleIO( | 78 void AssertWillHandleIO( |
82 const std::string& scheme, | 79 const std::string& scheme, |
83 bool expected, | 80 bool expected, |
84 ProtocolHandlerRegistry::JobInterceptorFactory* interceptor) { | 81 ProtocolHandlerRegistry::JobInterceptorFactory* interceptor) { |
85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
86 interceptor->Chain(scoped_ptr<net::URLRequestJobFactory>( | 83 interceptor->Chain(scoped_ptr<net::URLRequestJobFactory>( |
87 new FakeURLRequestJobFactory())); | 84 new FakeURLRequestJobFactory())); |
88 ASSERT_EQ(expected, interceptor->IsHandledProtocol(scheme)); | 85 ASSERT_EQ(expected, interceptor->IsHandledProtocol(scheme)); |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 | 913 |
917 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { | 914 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { |
918 RecreateRegistry(false); | 915 RecreateRegistry(false); |
919 registry()->AddPredefinedHandler(CreateProtocolHandler( | 916 registry()->AddPredefinedHandler(CreateProtocolHandler( |
920 "test", GURL("http://test.com/%s"), "Test")); | 917 "test", GURL("http://test.com/%s"), "Test")); |
921 registry()->InitProtocolSettings(); | 918 registry()->InitProtocolSettings(); |
922 std::vector<std::string> protocols; | 919 std::vector<std::string> protocols; |
923 registry()->GetRegisteredProtocols(&protocols); | 920 registry()->GetRegisteredProtocols(&protocols); |
924 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); | 921 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); |
925 } | 922 } |
OLD | NEW |