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

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

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test for IsSafeRedirectTarget Created 7 years, 10 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 net::URLRequest* request, 65 net::URLRequest* request,
66 net::NetworkDelegate* network_delegate) const OVERRIDE { 66 net::NetworkDelegate* network_delegate) const OVERRIDE {
67 return NULL; 67 return NULL;
68 } 68 }
69 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE { 69 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE {
70 return false; 70 return false;
71 } 71 }
72 virtual bool IsHandledURL(const GURL& url) const OVERRIDE { 72 virtual bool IsHandledURL(const GURL& url) const OVERRIDE {
73 return false; 73 return false;
74 } 74 }
75 virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE {
76 return true;
77 }
75 }; 78 };
76 79
77 void AssertWillHandleIO( 80 void AssertWillHandleIO(
78 const std::string& scheme, 81 const std::string& scheme,
79 bool expected, 82 bool expected,
80 ProtocolHandlerRegistry::JobInterceptorFactory* interceptor) { 83 ProtocolHandlerRegistry::JobInterceptorFactory* interceptor) {
81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
82 interceptor->Chain(scoped_ptr<net::URLRequestJobFactory>( 85 interceptor->Chain(scoped_ptr<net::URLRequestJobFactory>(
83 new FakeURLRequestJobFactory())); 86 new FakeURLRequestJobFactory()));
84 ASSERT_EQ(expected, interceptor->IsHandledProtocol(scheme)); 87 ASSERT_EQ(expected, interceptor->IsHandledProtocol(scheme));
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 915
913 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { 916 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) {
914 RecreateRegistry(false); 917 RecreateRegistry(false);
915 registry()->AddPredefinedHandler(CreateProtocolHandler( 918 registry()->AddPredefinedHandler(CreateProtocolHandler(
916 "test", GURL("http://test.com/%s"), "Test")); 919 "test", GURL("http://test.com/%s"), "Test"));
917 registry()->InitProtocolSettings(); 920 registry()->InitProtocolSettings();
918 std::vector<std::string> protocols; 921 std::vector<std::string> protocols;
919 registry()->GetRegisteredProtocols(&protocols); 922 registry()->GetRegisteredProtocols(&protocols);
920 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); 923 ASSERT_EQ(static_cast<size_t>(1), protocols.size());
921 } 924 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698