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

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

Issue 407093011: Allow URLRequests from one context to have different NetworkDelegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new tests Created 6 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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 18 matching lines...) Expand all
29 29
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 net::URLRequest request(url, net::DEFAULT_PRIORITY, NULL, &context); 39 scoped_ptr<net::URLRequest> request(context.CreateRequest(
40 url, net::DEFAULT_PRIORITY, NULL, NULL));
40 scoped_refptr<net::URLRequestJob> job = 41 scoped_refptr<net::URLRequestJob> job =
41 interceptor->MaybeCreateJobWithProtocolHandler( 42 interceptor->MaybeCreateJobWithProtocolHandler(
42 url.scheme(), &request, context.network_delegate()); 43 url.scheme(), request.get(), context.network_delegate());
43 ASSERT_TRUE(job.get() != NULL); 44 ASSERT_TRUE(job.get() != NULL);
44 } 45 }
45 46
46 void AssertIntercepted( 47 void AssertIntercepted(
47 const GURL& url, 48 const GURL& url,
48 net::URLRequestJobFactory* interceptor) { 49 net::URLRequestJobFactory* interceptor) {
49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
50 BrowserThread::PostTask(BrowserThread::IO, 51 BrowserThread::PostTask(BrowserThread::IO,
51 FROM_HERE, 52 FROM_HERE,
52 base::Bind(AssertInterceptedIO, 53 base::Bind(AssertInterceptedIO,
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 // added to pref. 1116 // added to pref.
1116 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); 1117 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2);
1117 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); 1118 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4);
1118 1119
1119 registry()->RemoveIgnoredHandler(p2u1); 1120 registry()->RemoveIgnoredHandler(p2u1);
1120 1121
1121 // p2u1 installed by user and policy, so it is removed from pref alone. 1122 // p2u1 installed by user and policy, so it is removed from pref alone.
1122 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); 1123 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1);
1123 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); 1124 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4);
1124 } 1125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698