OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Optionally, you can also construct test jobs that advance automatically | 37 // Optionally, you can also construct test jobs that advance automatically |
38 // without having to call ProcessOnePendingMessage. | 38 // without having to call ProcessOnePendingMessage. |
39 class NET_TEST URLRequestTestJob : public URLRequestJob { | 39 class NET_TEST URLRequestTestJob : public URLRequestJob { |
40 public: | 40 public: |
41 // Constructs a job to return one of the canned responses depending on the | 41 // Constructs a job to return one of the canned responses depending on the |
42 // request url, with auto advance disabled. | 42 // request url, with auto advance disabled. |
43 explicit URLRequestTestJob(URLRequest* request); | 43 explicit URLRequestTestJob(URLRequest* request); |
44 | 44 |
45 // Constructs a job to return one of the canned responses depending on the | 45 // Constructs a job to return one of the canned responses depending on the |
46 // request url, optionally with auto advance enabled. | 46 // request url, optionally with auto advance enabled. |
47 explicit URLRequestTestJob(URLRequest* request, bool auto_advance); | 47 URLRequestTestJob(URLRequest* request, bool auto_advance); |
48 | 48 |
49 // Constructs a job to return the given response regardless of the request | 49 // Constructs a job to return the given response regardless of the request |
50 // url. The headers should include the HTTP status line and be formatted as | 50 // url. The headers should include the HTTP status line and be formatted as |
51 // expected by HttpResponseHeaders. | 51 // expected by HttpResponseHeaders. |
52 explicit URLRequestTestJob(URLRequest* request, | 52 URLRequestTestJob(URLRequest* request, |
53 const std::string& response_headers, | 53 const std::string& response_headers, |
54 const std::string& response_data, | 54 const std::string& response_data, |
55 bool auto_advance); | 55 bool auto_advance); |
56 | 56 |
57 // 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 |
58 // explicitly initialized with response headers and data. | 58 // explicitly initialized with response headers and data. |
59 // FIXME(brettw): we should probably also have a redirect one | 59 // FIXME(brettw): we should probably also have a redirect one |
60 static GURL test_url_1(); | 60 static GURL test_url_1(); |
61 static GURL test_url_2(); | 61 static GURL test_url_2(); |
62 static GURL test_url_3(); | 62 static GURL test_url_3(); |
63 static GURL test_url_error(); | 63 static GURL test_url_error(); |
64 | 64 |
65 // The data that corresponds to each of the URLs above | 65 // The data that corresponds to each of the URLs above |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // Holds the buffer for an asynchronous ReadRawData call | 135 // Holds the buffer for an asynchronous ReadRawData call |
136 IOBuffer* async_buf_; | 136 IOBuffer* async_buf_; |
137 int async_buf_size_; | 137 int async_buf_size_; |
138 | 138 |
139 ScopedRunnableMethodFactory<URLRequestTestJob> method_factory_; | 139 ScopedRunnableMethodFactory<URLRequestTestJob> method_factory_; |
140 }; | 140 }; |
141 | 141 |
142 } // namespace net | 142 } // namespace net |
143 | 143 |
144 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ | 144 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ |
OLD | NEW |