Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 16 matching lines...) Expand all
27 using content::BrowserThread; 27 using content::BrowserThread;
28 28
29 namespace { 29 namespace {
30 30
31 void AssertInterceptedIO( 31 void AssertInterceptedIO(
32 const GURL& url, 32 const GURL& url,
33 net::URLRequestJobFactory::Interceptor* interceptor) { 33 net::URLRequestJobFactory::Interceptor* interceptor) {
34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
35 net::URLRequestContext context; 35 net::URLRequestContext context;
36 net::URLRequest request(url, NULL, &context); 36 net::URLRequest request(url, NULL, &context);
37 scoped_refptr<net::URLRequestJob> job = interceptor->MaybeIntercept(&request); 37 scoped_refptr<net::URLRequestJob> job = interceptor->MaybeIntercept(
38 &request, context.network_delegate());
38 ASSERT_TRUE(job.get() != NULL); 39 ASSERT_TRUE(job.get() != NULL);
39 } 40 }
40 41
41 void AssertIntercepted( 42 void AssertIntercepted(
42 const GURL& url, 43 const GURL& url,
43 net::URLRequestJobFactory::Interceptor* interceptor) { 44 net::URLRequestJobFactory::Interceptor* interceptor) {
44 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
45 BrowserThread::PostTask(BrowserThread::IO, 46 BrowserThread::PostTask(BrowserThread::IO,
46 FROM_HERE, 47 FROM_HERE,
47 base::Bind(AssertInterceptedIO, 48 base::Bind(AssertInterceptedIO,
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 886
886 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { 887 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) {
887 RecreateRegistry(false); 888 RecreateRegistry(false);
888 registry()->AddPredefinedHandler(CreateProtocolHandler( 889 registry()->AddPredefinedHandler(CreateProtocolHandler(
889 "test", GURL("http://test.com/%s"), "Test")); 890 "test", GURL("http://test.com/%s"), "Test"));
890 registry()->InitProtocolSettings(); 891 registry()->InitProtocolSettings();
891 std::vector<std::string> protocols; 892 std::vector<std::string> protocols;
892 registry()->GetRegisteredProtocols(&protocols); 893 registry()->GetRegisteredProtocols(&protocols);
893 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); 894 ASSERT_EQ(static_cast<size_t>(1), protocols.size());
894 } 895 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698