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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 int buf_size, | 97 int buf_size, |
98 int *bytes_read) OVERRIDE; | 98 int *bytes_read) OVERRIDE; |
99 virtual void Kill() OVERRIDE; | 99 virtual void Kill() OVERRIDE; |
100 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 100 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
101 virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; | 101 virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; |
102 virtual int GetResponseCode() const OVERRIDE; | 102 virtual int GetResponseCode() const OVERRIDE; |
103 virtual bool IsRedirectResponse(GURL* location, | 103 virtual bool IsRedirectResponse(GURL* location, |
104 int* http_status_code) OVERRIDE; | 104 int* http_status_code) OVERRIDE; |
105 | 105 |
106 protected: | 106 protected: |
| 107 // Override to specify whether the next read done from this job will |
| 108 // return IO pending. This controls whether or not the WAITING state will |
| 109 // transition back to WAITING or to DATA_AVAILABLE after an asynchronous |
| 110 // read is processed. |
| 111 virtual bool NextReadAsync(); |
| 112 |
107 // This is what operation we are going to do next when this job is handled. | 113 // This is what operation we are going to do next when this job is handled. |
108 // When the stage is DONE, this job will not be put on the queue. | 114 // When the stage is DONE, this job will not be put on the queue. |
109 enum Stage { WAITING, DATA_AVAILABLE, ALL_DATA, DONE }; | 115 enum Stage { WAITING, DATA_AVAILABLE, ALL_DATA, DONE }; |
110 | 116 |
111 virtual ~URLRequestTestJob(); | 117 virtual ~URLRequestTestJob(); |
112 | 118 |
113 // Call to process the next opeation, usually sending a notification, and | 119 // Call to process the next opeation, usually sending a notification, and |
114 // advancing the stage if necessary. THIS MAY DELETE THE OBJECT. | 120 // advancing the stage if necessary. THIS MAY DELETE THE OBJECT. |
115 void ProcessNextOperation(); | 121 void ProcessNextOperation(); |
116 | 122 |
(...skipping 21 matching lines...) Expand all Loading... |
138 // Holds the buffer for an asynchronous ReadRawData call | 144 // Holds the buffer for an asynchronous ReadRawData call |
139 IOBuffer* async_buf_; | 145 IOBuffer* async_buf_; |
140 int async_buf_size_; | 146 int async_buf_size_; |
141 | 147 |
142 base::WeakPtrFactory<URLRequestTestJob> weak_factory_; | 148 base::WeakPtrFactory<URLRequestTestJob> weak_factory_; |
143 }; | 149 }; |
144 | 150 |
145 } // namespace net | 151 } // namespace net |
146 | 152 |
147 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ | 153 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ |
OLD | NEW |