OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 5 #ifndef NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
6 #define NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 6 #define NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
7 | 7 |
8 #include "net/http/http_transaction.h" | 8 #include "net/http/http_transaction.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 virtual int RestartIgnoringLastError(net::CompletionCallback* callback) { | 233 virtual int RestartIgnoringLastError(net::CompletionCallback* callback) { |
234 return net::ERR_FAILED; | 234 return net::ERR_FAILED; |
235 } | 235 } |
236 | 236 |
237 virtual int RestartWithAuth(const std::wstring& username, | 237 virtual int RestartWithAuth(const std::wstring& username, |
238 const std::wstring& password, | 238 const std::wstring& password, |
239 net::CompletionCallback* callback) { | 239 net::CompletionCallback* callback) { |
240 return net::ERR_FAILED; | 240 return net::ERR_FAILED; |
241 } | 241 } |
242 | 242 |
| 243 virtual bool IsReadyToRestartForAuth() { |
| 244 return false; |
| 245 } |
| 246 |
243 virtual int Read(net::IOBuffer* buf, int buf_len, | 247 virtual int Read(net::IOBuffer* buf, int buf_len, |
244 net::CompletionCallback* callback) { | 248 net::CompletionCallback* callback) { |
245 int data_len = static_cast<int>(data_.size()); | 249 int data_len = static_cast<int>(data_.size()); |
246 int num = std::min(buf_len, data_len - data_cursor_); | 250 int num = std::min(buf_len, data_len - data_cursor_); |
247 if (num) { | 251 if (num) { |
248 memcpy(buf->data(), data_.data() + data_cursor_, num); | 252 memcpy(buf->data(), data_.data() + data_cursor_, num); |
249 data_cursor_ += num; | 253 data_cursor_ += num; |
250 } | 254 } |
251 if (test_mode_ & TEST_MODE_SYNC_NET_READ) | 255 if (test_mode_ & TEST_MODE_SYNC_NET_READ) |
252 return num; | 256 return num; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 }; | 311 }; |
308 | 312 |
309 | 313 |
310 //----------------------------------------------------------------------------- | 314 //----------------------------------------------------------------------------- |
311 // helpers | 315 // helpers |
312 | 316 |
313 // read the transaction completely | 317 // read the transaction completely |
314 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 318 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
315 | 319 |
316 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 320 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
OLD | NEW |