OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 // Intercepts requests for the given protocol. | 249 // Intercepts requests for the given protocol. |
250 void HandleScheme(const std::string& scheme) { | 250 void HandleScheme(const std::string& scheme) { |
251 DCHECK(scheme_.empty()); | 251 DCHECK(scheme_.empty()); |
252 DCHECK(!old_factory_); | 252 DCHECK(!old_factory_); |
253 scheme_ = scheme; | 253 scheme_ = scheme; |
254 old_factory_ = net::URLRequest::RegisterProtocolFactory( | 254 old_factory_ = net::URLRequest::RegisterProtocolFactory( |
255 scheme_, &ResourceDispatcherHostTest::Factory); | 255 scheme_, &ResourceDispatcherHostTest::Factory); |
256 } | 256 } |
257 | 257 |
258 // Our own URLRequestJob factory. | 258 // Our own net::URLRequestJob factory. |
259 static URLRequestJob* Factory(net::URLRequest* request, | 259 static net::URLRequestJob* Factory(net::URLRequest* request, |
260 const std::string& scheme) { | 260 const std::string& scheme) { |
261 if (test_fixture_->response_headers_.empty()) { | 261 if (test_fixture_->response_headers_.empty()) { |
262 return new URLRequestTestJob(request); | 262 return new URLRequestTestJob(request); |
263 } else { | 263 } else { |
264 return new URLRequestTestJob(request, test_fixture_->response_headers_, | 264 return new URLRequestTestJob(request, test_fixture_->response_headers_, |
265 test_fixture_->response_data_, false); | 265 test_fixture_->response_data_, false); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 MessageLoopForIO message_loop_; | 269 MessageLoopForIO message_loop_; |
270 BrowserThread ui_thread_; | 270 BrowserThread ui_thread_; |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 EXPECT_TRUE(request_info_->replace_extension_localization_templates()); | 1027 EXPECT_TRUE(request_info_->replace_extension_localization_templates()); |
1028 } | 1028 } |
1029 | 1029 |
1030 TEST_F(ApplyExtensionLocalizationFilterTest, GoodSchemeWrongResourceType) { | 1030 TEST_F(ApplyExtensionLocalizationFilterTest, GoodSchemeWrongResourceType) { |
1031 resource_type_ = ResourceType::MAIN_FRAME; | 1031 resource_type_ = ResourceType::MAIN_FRAME; |
1032 ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_, | 1032 ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_, |
1033 resource_type_, request_info_.get()); | 1033 resource_type_, request_info_.get()); |
1034 | 1034 |
1035 EXPECT_FALSE(request_info_->replace_extension_localization_templates()); | 1035 EXPECT_FALSE(request_info_->replace_extension_localization_templates()); |
1036 } | 1036 } |
OLD | NEW |