| 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 #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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "net/http/http_transaction.h" | 9 #include "net/http/http_transaction.h" |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/string16.h" | 15 #include "base/string16.h" |
| 16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
| 17 #include "net/base/load_flags.h" | 17 #include "net/base/load_flags.h" |
| 18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 #include "net/base/test_completion_callback.h" | 19 #include "net/base/test_completion_callback.h" |
| 20 #include "net/disk_cache/disk_cache.h" | 20 #include "net/disk_cache/disk_cache.h" |
| 21 #include "net/http/http_cache.h" | 21 #include "net/http/http_cache.h" |
| 22 #include "net/http/http_request_info.h" | 22 #include "net/http/http_request_info.h" |
| 23 #include "net/http/http_response_headers.h" | 23 #include "net/http/http_response_headers.h" |
| 24 #include "net/http/http_response_info.h" | 24 #include "net/http/http_response_info.h" |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 class AuthData; |
| 27 class IOBuffer; | 28 class IOBuffer; |
| 28 } | 29 } |
| 29 | 30 |
| 30 //----------------------------------------------------------------------------- | 31 //----------------------------------------------------------------------------- |
| 31 // mock transaction data | 32 // mock transaction data |
| 32 | 33 |
| 33 // these flags may be combined to form the test_mode field | 34 // these flags may be combined to form the test_mode field |
| 34 enum { | 35 enum { |
| 35 TEST_MODE_NORMAL = 0, | 36 TEST_MODE_NORMAL = 0, |
| 36 TEST_MODE_SYNC_NET_START = 1 << 0, | 37 TEST_MODE_SYNC_NET_START = 1 << 0, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 56 const char* request_headers; | 57 const char* request_headers; |
| 57 int load_flags; | 58 int load_flags; |
| 58 const char* status; | 59 const char* status; |
| 59 const char* response_headers; | 60 const char* response_headers; |
| 60 // If |response_time| is unspecified, the current time will be used. | 61 // If |response_time| is unspecified, the current time will be used. |
| 61 base::Time response_time; | 62 base::Time response_time; |
| 62 const char* data; | 63 const char* data; |
| 63 int test_mode; | 64 int test_mode; |
| 64 MockTransactionHandler handler; | 65 MockTransactionHandler handler; |
| 65 int cert_status; | 66 int cert_status; |
| 67 string16 tls_username; |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 extern const MockTransaction kSimpleGET_Transaction; | 70 extern const MockTransaction kSimpleGET_Transaction; |
| 69 extern const MockTransaction kSimplePOST_Transaction; | 71 extern const MockTransaction kSimplePOST_Transaction; |
| 70 extern const MockTransaction kTypicalGET_Transaction; | 72 extern const MockTransaction kTypicalGET_Transaction; |
| 71 extern const MockTransaction kETagGET_Transaction; | 73 extern const MockTransaction kETagGET_Transaction; |
| 72 extern const MockTransaction kRangeGET_Transaction; | 74 extern const MockTransaction kRangeGET_Transaction; |
| 73 | 75 |
| 74 // returns the mock transaction for the given URL | 76 // returns the mock transaction for the given URL |
| 75 const MockTransaction* FindMockTransaction(const GURL& url); | 77 const MockTransaction* FindMockTransaction(const GURL& url); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 160 |
| 159 virtual int Start(const net::HttpRequestInfo* request, | 161 virtual int Start(const net::HttpRequestInfo* request, |
| 160 net::CompletionCallback* callback, | 162 net::CompletionCallback* callback, |
| 161 const net::BoundNetLog& net_log); | 163 const net::BoundNetLog& net_log); |
| 162 | 164 |
| 163 virtual int RestartIgnoringLastError(net::CompletionCallback* callback); | 165 virtual int RestartIgnoringLastError(net::CompletionCallback* callback); |
| 164 | 166 |
| 165 virtual int RestartWithCertificate(net::X509Certificate* client_cert, | 167 virtual int RestartWithCertificate(net::X509Certificate* client_cert, |
| 166 net::CompletionCallback* callback); | 168 net::CompletionCallback* callback); |
| 167 | 169 |
| 170 virtual void SetTLSLoginAuthData(net::AuthData* auth_data); |
| 171 |
| 172 virtual int RestartWithTLSLogin(net::CompletionCallback* callback); |
| 173 |
| 168 virtual int RestartWithAuth(const string16& username, | 174 virtual int RestartWithAuth(const string16& username, |
| 169 const string16& password, | 175 const string16& password, |
| 170 net::CompletionCallback* callback); | 176 net::CompletionCallback* callback); |
| 171 | 177 |
| 172 virtual bool IsReadyToRestartForAuth(); | 178 virtual bool IsReadyToRestartForAuth(); |
| 173 | 179 |
| 174 virtual int Read(net::IOBuffer* buf, int buf_len, | 180 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 175 net::CompletionCallback* callback); | 181 net::CompletionCallback* callback); |
| 176 | 182 |
| 177 virtual void StopCaching(); | 183 virtual void StopCaching(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 int transaction_count_; | 216 int transaction_count_; |
| 211 }; | 217 }; |
| 212 | 218 |
| 213 //----------------------------------------------------------------------------- | 219 //----------------------------------------------------------------------------- |
| 214 // helpers | 220 // helpers |
| 215 | 221 |
| 216 // read the transaction completely | 222 // read the transaction completely |
| 217 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 223 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
| 218 | 224 |
| 219 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 225 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
| OLD | NEW |