| 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 19 matching lines...) Expand all Loading... |
| 30 using content::BrowserThread; | 30 using content::BrowserThread; |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 void AssertInterceptedIO( | 34 void AssertInterceptedIO( |
| 35 const GURL& url, | 35 const GURL& url, |
| 36 net::URLRequestJobFactory* interceptor) { | 36 net::URLRequestJobFactory* interceptor) { |
| 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 38 net::URLRequestContext context; | 38 net::URLRequestContext context; |
| 39 scoped_ptr<net::URLRequest> request(context.CreateRequest( | 39 scoped_ptr<net::URLRequest> request(context.CreateRequest( |
| 40 url, net::DEFAULT_PRIORITY, NULL, NULL)); | 40 url, net::DEFAULT_PRIORITY, NULL)); |
| 41 scoped_refptr<net::URLRequestJob> job = | 41 scoped_refptr<net::URLRequestJob> job = |
| 42 interceptor->MaybeCreateJobWithProtocolHandler( | 42 interceptor->MaybeCreateJobWithProtocolHandler( |
| 43 url.scheme(), request.get(), context.network_delegate()); | 43 url.scheme(), request.get(), context.network_delegate()); |
| 44 ASSERT_TRUE(job.get() != NULL); | 44 ASSERT_TRUE(job.get() != NULL); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void AssertIntercepted( | 47 void AssertIntercepted( |
| 48 const GURL& url, | 48 const GURL& url, |
| 49 net::URLRequestJobFactory* interceptor) { | 49 net::URLRequestJobFactory* interceptor) { |
| 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 // added to pref. | 1122 // added to pref. |
| 1123 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); | 1123 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); |
| 1124 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1124 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
| 1125 | 1125 |
| 1126 registry()->RemoveIgnoredHandler(p2u1); | 1126 registry()->RemoveIgnoredHandler(p2u1); |
| 1127 | 1127 |
| 1128 // 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. |
| 1129 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); | 1129 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); |
| 1130 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1130 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
| 1131 } | 1131 } |
| OLD | NEW |