| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 net::TestNetworkDelegate* network_delegate() { return &network_delegate_; } | 970 net::TestNetworkDelegate* network_delegate() { return &network_delegate_; } |
| 971 | 971 |
| 972 void EnsureSchemeIsAllowed(const std::string& scheme) { | 972 void EnsureSchemeIsAllowed(const std::string& scheme) { |
| 973 ChildProcessSecurityPolicyImpl* policy = | 973 ChildProcessSecurityPolicyImpl* policy = |
| 974 ChildProcessSecurityPolicyImpl::GetInstance(); | 974 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 975 if (!policy->IsWebSafeScheme(scheme)) | 975 if (!policy->IsWebSafeScheme(scheme)) |
| 976 policy->RegisterWebSafeScheme(scheme); | 976 policy->RegisterWebSafeScheme(scheme); |
| 977 } | 977 } |
| 978 | 978 |
| 979 // Sets a particular response for any request from now on. To switch back to | 979 // Sets a particular response for any request from now on. To switch back to |
| 980 // the default bahavior, pass an empty |headers|. |headers| should be raw- | 980 // the default bahavior, pass an empty |headers|. |headers| should be CR[LF] |
| 981 // formatted (NULLs instead of EOLs). | 981 // terminated. |
| 982 void SetResponse(const std::string& headers, const std::string& data) { | 982 void SetResponse(const std::string& headers, const std::string& data) { |
| 983 response_headers_ = net::HttpUtil::AssembleRawHeaders(headers.data(), | 983 response_headers_ = headers; |
| 984 headers.size()); | |
| 985 response_data_ = data; | 984 response_data_ = data; |
| 986 } | 985 } |
| 987 void SetResponse(const std::string& headers) { | 986 void SetResponse(const std::string& headers) { |
| 988 SetResponse(headers, std::string()); | 987 SetResponse(headers, std::string()); |
| 989 } | 988 } |
| 990 | 989 |
| 991 void SendDataReceivedACKs(bool send_acks) { | 990 void SendDataReceivedACKs(bool send_acks) { |
| 992 send_data_received_acks_ = send_acks; | 991 send_data_received_acks_ = send_acks; |
| 993 } | 992 } |
| 994 | 993 |
| (...skipping 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3541 return nullptr; | 3540 return nullptr; |
| 3542 } | 3541 } |
| 3543 | 3542 |
| 3544 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( | 3543 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( |
| 3545 net::URLRequest* request, | 3544 net::URLRequest* request, |
| 3546 net::NetworkDelegate* network_delegate) const { | 3545 net::NetworkDelegate* network_delegate) const { |
| 3547 return nullptr; | 3546 return nullptr; |
| 3548 } | 3547 } |
| 3549 | 3548 |
| 3550 } // namespace content | 3549 } // namespace content |
| OLD | NEW |