OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/test/url_request/url_request_mock_data_job.h" | 5 #include "net/test/url_request/url_request_mock_data_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 int URLRequestMockDataJob::ReadRawData(IOBuffer* buf, int buf_size) { | 122 int URLRequestMockDataJob::ReadRawData(IOBuffer* buf, int buf_size) { |
123 int bytes_read = | 123 int bytes_read = |
124 std::min(static_cast<size_t>(buf_size), data_.length() - data_offset_); | 124 std::min(static_cast<size_t>(buf_size), data_.length() - data_offset_); |
125 memcpy(buf->data(), data_.c_str() + data_offset_, bytes_read); | 125 memcpy(buf->data(), data_.c_str() + data_offset_, bytes_read); |
126 data_offset_ += bytes_read; | 126 data_offset_ += bytes_read; |
127 return bytes_read; | 127 return bytes_read; |
128 } | 128 } |
129 | 129 |
130 void URLRequestMockDataJob::ContinueWithCertificate( | 130 void URLRequestMockDataJob::ContinueWithCertificate( |
131 X509Certificate* client_cert, | 131 scoped_refptr<X509Certificate> client_cert, |
132 SSLPrivateKey* client_private_key) { | 132 scoped_refptr<SSLPrivateKey> client_private_key) { |
133 DCHECK(request_client_certificate_); | 133 DCHECK(request_client_certificate_); |
134 NotifyHeadersComplete(); | 134 NotifyHeadersComplete(); |
135 } | 135 } |
136 | 136 |
137 // Public virtual version. | 137 // Public virtual version. |
138 void URLRequestMockDataJob::GetResponseInfo(HttpResponseInfo* info) { | 138 void URLRequestMockDataJob::GetResponseInfo(HttpResponseInfo* info) { |
139 // Forward to private const version. | 139 // Forward to private const version. |
140 GetResponseInfoConst(info); | 140 GetResponseInfoConst(info); |
141 } | 141 } |
142 | 142 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 // static | 209 // static |
210 GURL URLRequestMockDataJob::GetMockHttpsUrlForHostname( | 210 GURL URLRequestMockDataJob::GetMockHttpsUrlForHostname( |
211 const std::string& hostname, | 211 const std::string& hostname, |
212 const std::string& data, | 212 const std::string& data, |
213 int repeat_count) { | 213 int repeat_count) { |
214 return GetMockUrl("https", hostname, data, repeat_count, false); | 214 return GetMockUrl("https", hostname, data, repeat_count, false); |
215 } | 215 } |
216 | 216 |
217 } // namespace net | 217 } // namespace net |
OLD | NEW |