| 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 <string> | 10 #include <string> |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 std::string resp_status = t->status; | 204 std::string resp_status = t->status; |
| 205 std::string resp_headers = t->response_headers; | 205 std::string resp_headers = t->response_headers; |
| 206 std::string resp_data = t->data; | 206 std::string resp_data = t->data; |
| 207 if (t->handler) | 207 if (t->handler) |
| 208 (t->handler)(request, &resp_status, &resp_headers, &resp_data); | 208 (t->handler)(request, &resp_status, &resp_headers, &resp_data); |
| 209 | 209 |
| 210 std::string header_data = | 210 std::string header_data = |
| 211 StringPrintf("%s\n%s\n", resp_status.c_str(), resp_headers.c_str()); | 211 StringPrintf("%s\n%s\n", resp_status.c_str(), resp_headers.c_str()); |
| 212 std::replace(header_data.begin(), header_data.end(), '\n', '\0'); | 212 std::replace(header_data.begin(), header_data.end(), '\n', '\0'); |
| 213 | 213 |
| 214 response_.request_time = Time::Now(); | 214 response_.request_time = base::Time::Now(); |
| 215 response_.response_time = Time::Now(); | 215 response_.response_time = base::Time::Now(); |
| 216 response_.headers = new net::HttpResponseHeaders(header_data); | 216 response_.headers = new net::HttpResponseHeaders(header_data); |
| 217 response_.ssl_info.cert_status = t->cert_status; | 217 response_.ssl_info.cert_status = t->cert_status; |
| 218 data_ = resp_data; | 218 data_ = resp_data; |
| 219 test_mode_ = t->test_mode; | 219 test_mode_ = t->test_mode; |
| 220 | 220 |
| 221 if (test_mode_ & TEST_MODE_SYNC_NET_START) | 221 if (test_mode_ & TEST_MODE_SYNC_NET_START) |
| 222 return net::OK; | 222 return net::OK; |
| 223 | 223 |
| 224 CallbackLater(callback, net::OK); | 224 CallbackLater(callback, net::OK); |
| 225 return net::ERR_IO_PENDING; | 225 return net::ERR_IO_PENDING; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 }; | 305 }; |
| 306 | 306 |
| 307 | 307 |
| 308 //----------------------------------------------------------------------------- | 308 //----------------------------------------------------------------------------- |
| 309 // helpers | 309 // helpers |
| 310 | 310 |
| 311 // read the transaction completely | 311 // read the transaction completely |
| 312 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 312 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
| 313 | 313 |
| 314 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 314 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
| OLD | NEW |