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