| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // MaybeCreateJobWithProtocolHandler() indicates whether the | 62 // MaybeCreateJobWithProtocolHandler() indicates whether the |
| 63 // ProtocolHandlerRegistry properly handled a job creation request. | 63 // ProtocolHandlerRegistry properly handled a job creation request. |
| 64 class FakeURLRequestJobFactory : public net::URLRequestJobFactory { | 64 class FakeURLRequestJobFactory : public net::URLRequestJobFactory { |
| 65 // net::URLRequestJobFactory implementation: | 65 // net::URLRequestJobFactory implementation: |
| 66 net::URLRequestJob* MaybeCreateJobWithProtocolHandler( | 66 net::URLRequestJob* MaybeCreateJobWithProtocolHandler( |
| 67 const std::string& scheme, | 67 const std::string& scheme, |
| 68 net::URLRequest* request, | 68 net::URLRequest* request, |
| 69 net::NetworkDelegate* network_delegate) const override { | 69 net::NetworkDelegate* network_delegate) const override { |
| 70 return NULL; | 70 return NULL; |
| 71 } | 71 } |
| 72 net::URLRequestJob* MaybeInterceptResponse( |
| 73 net::URLRequest* request, |
| 74 net::NetworkDelegate* network_delegate) const override { |
| 75 return NULL; |
| 76 } |
| 77 net::URLRequestJob* MaybeInterceptRedirect( |
| 78 net::URLRequest* request, |
| 79 net::NetworkDelegate* network_delegate, |
| 80 const GURL& location) const override { |
| 81 return NULL; |
| 82 } |
| 72 bool IsHandledProtocol(const std::string& scheme) const override { | 83 bool IsHandledProtocol(const std::string& scheme) const override { |
| 73 return false; | 84 return false; |
| 74 } | 85 } |
| 75 bool IsHandledURL(const GURL& url) const override { return false; } | 86 bool IsHandledURL(const GURL& url) const override { return false; } |
| 76 bool IsSafeRedirectTarget(const GURL& location) const override { | 87 bool IsSafeRedirectTarget(const GURL& location) const override { |
| 77 return true; | 88 return true; |
| 78 } | 89 } |
| 79 }; | 90 }; |
| 80 | 91 |
| 81 void AssertWillHandleIO( | 92 void AssertWillHandleIO( |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 // added to pref. | 1121 // added to pref. |
| 1111 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); | 1122 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); |
| 1112 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1123 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
| 1113 | 1124 |
| 1114 registry()->RemoveIgnoredHandler(p2u1); | 1125 registry()->RemoveIgnoredHandler(p2u1); |
| 1115 | 1126 |
| 1116 // p2u1 installed by user and policy, so it is removed from pref alone. | 1127 // p2u1 installed by user and policy, so it is removed from pref alone. |
| 1117 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); | 1128 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); |
| 1118 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1129 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
| 1119 } | 1130 } |
| OLD | NEW |