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 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 explicit URLRequestTestJob(URLRequest* request); | 42 explicit URLRequestTestJob(URLRequest* request); |
43 | 43 |
44 // Constructs a job to return one of the canned responses depending on the | 44 // Constructs a job to return one of the canned responses depending on the |
45 // request url, optionally with auto advance enabled. | 45 // request url, optionally with auto advance enabled. |
46 URLRequestTestJob(URLRequest* request, bool auto_advance); | 46 URLRequestTestJob(URLRequest* request, bool auto_advance); |
47 | 47 |
48 // Constructs a job to return the given response regardless of the request | 48 // Constructs a job to return the given response regardless of the request |
49 // url. The headers should include the HTTP status line and be formatted as | 49 // url. The headers should include the HTTP status line and be formatted as |
50 // expected by HttpResponseHeaders. | 50 // expected by HttpResponseHeaders. |
51 URLRequestTestJob(URLRequest* request, | 51 URLRequestTestJob(URLRequest* request, |
| 52 net::NetworkDelegate* network_delegate, |
52 const std::string& response_headers, | 53 const std::string& response_headers, |
53 const std::string& response_data, | 54 const std::string& response_data, |
54 bool auto_advance); | 55 bool auto_advance); |
55 | 56 |
56 // The three canned URLs this handler will respond to without having been | 57 // The three canned URLs this handler will respond to without having been |
57 // explicitly initialized with response headers and data. | 58 // explicitly initialized with response headers and data. |
58 // FIXME(brettw): we should probably also have a redirect one | 59 // FIXME(brettw): we should probably also have a redirect one |
59 static GURL test_url_1(); | 60 static GURL test_url_1(); |
60 static GURL test_url_2(); | 61 static GURL test_url_2(); |
61 static GURL test_url_3(); | 62 static GURL test_url_3(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Holds the buffer for an asynchronous ReadRawData call | 144 // Holds the buffer for an asynchronous ReadRawData call |
144 IOBuffer* async_buf_; | 145 IOBuffer* async_buf_; |
145 int async_buf_size_; | 146 int async_buf_size_; |
146 | 147 |
147 base::WeakPtrFactory<URLRequestTestJob> weak_factory_; | 148 base::WeakPtrFactory<URLRequestTestJob> weak_factory_; |
148 }; | 149 }; |
149 | 150 |
150 } // namespace net | 151 } // namespace net |
151 | 152 |
152 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ | 153 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ |
OLD | NEW |