| 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 |
| 73 net::URLRequestJob* MaybeInterceptRedirect( |
| 74 net::URLRequest* request, |
| 75 net::NetworkDelegate* network_delegate, |
| 76 const GURL& location) const override { |
| 77 return NULL; |
| 78 } |
| 79 |
| 80 net::URLRequestJob* MaybeInterceptResponse( |
| 81 net::URLRequest* request, |
| 82 net::NetworkDelegate* network_delegate) const override { |
| 83 return NULL; |
| 84 } |
| 85 |
| 72 bool IsHandledProtocol(const std::string& scheme) const override { | 86 bool IsHandledProtocol(const std::string& scheme) const override { |
| 73 return false; | 87 return false; |
| 74 } | 88 } |
| 75 bool IsHandledURL(const GURL& url) const override { return false; } | 89 bool IsHandledURL(const GURL& url) const override { return false; } |
| 76 bool IsSafeRedirectTarget(const GURL& location) const override { | 90 bool IsSafeRedirectTarget(const GURL& location) const override { |
| 77 return true; | 91 return true; |
| 78 } | 92 } |
| 79 }; | 93 }; |
| 80 | 94 |
| 81 void AssertWillHandleIO( | 95 void AssertWillHandleIO( |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 // added to pref. | 1122 // added to pref. |
| 1109 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); | 1123 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); |
| 1110 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1124 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
| 1111 | 1125 |
| 1112 registry()->RemoveIgnoredHandler(p2u1); | 1126 registry()->RemoveIgnoredHandler(p2u1); |
| 1113 | 1127 |
| 1114 // p2u1 installed by user and policy, so it is removed from pref alone. | 1128 // p2u1 installed by user and policy, so it is removed from pref alone. |
| 1115 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); | 1129 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); |
| 1116 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1130 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
| 1117 } | 1131 } |
| OLD | NEW |