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 <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 Loading... |
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 Loading... |
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 |
OLD | NEW |