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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 300693005: Make URLRequestFilter use URLRequestInterceptors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge Created 6 years, 6 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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Filters requests to the hosts in |urls| and redirects them to the test data 212 // Filters requests to the hosts in |urls| and redirects them to the test data
213 // dir through URLRequestMockHTTPJobs. 213 // dir through URLRequestMockHTTPJobs.
214 void RedirectHostsToTestData(const char* const urls[], size_t size) { 214 void RedirectHostsToTestData(const char* const urls[], size_t size) {
215 // Map the given hosts to the test data dir. 215 // Map the given hosts to the test data dir.
216 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); 216 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
217 base::FilePath base_path; 217 base::FilePath base_path;
218 PathService::Get(chrome::DIR_TEST_DATA, &base_path); 218 PathService::Get(chrome::DIR_TEST_DATA, &base_path);
219 for (size_t i = 0; i < size; ++i) { 219 for (size_t i = 0; i < size; ++i) {
220 const GURL url(urls[i]); 220 const GURL url(urls[i]);
221 EXPECT_TRUE(url.is_valid()); 221 EXPECT_TRUE(url.is_valid());
222 filter->AddUrlProtocolHandler(url, 222 filter->AddUrlInterceptor(
223 URLRequestMockHTTPJob::CreateProtocolHandler(base_path)); 223 url, URLRequestMockHTTPJob::CreateInterceptor(base_path));
224 } 224 }
225 } 225 }
226 226
227 // Remove filters for requests to the hosts in |urls|. 227 // Remove filters for requests to the hosts in |urls|.
228 void UndoRedirectHostsToTestData(const char* const urls[], size_t size) { 228 void UndoRedirectHostsToTestData(const char* const urls[], size_t size) {
229 // Map the given hosts to the test data dir. 229 // Map the given hosts to the test data dir.
230 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); 230 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
231 for (size_t i = 0; i < size; ++i) { 231 for (size_t i = 0; i < size; ++i) {
232 const GURL url(urls[i]); 232 const GURL url(urls[i]);
233 EXPECT_TRUE(url.is_valid()); 233 EXPECT_TRUE(url.is_valid());
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 PrefService* prefs = browser()->profile()->GetPrefs(); 2971 PrefService* prefs = browser()->profile()->GetPrefs();
2972 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( 2972 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed(
2973 prefs, "host.name")); 2973 prefs, "host.name"));
2974 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( 2974 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed(
2975 prefs, "other.host.name")); 2975 prefs, "other.host.name"));
2976 } 2976 }
2977 2977
2978 #endif // !defined(CHROME_OS) 2978 #endif // !defined(CHROME_OS)
2979 2979
2980 } // namespace policy 2980 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/test_request_interceptor.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698