| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // the caller having to call ProcessOnePendingMessage. Auto advance depends | 85 // the caller having to call ProcessOnePendingMessage. Auto advance depends |
| 86 // on having a message loop running. The default is to not auto advance. | 86 // on having a message loop running. The default is to not auto advance. |
| 87 // Should not be altered after the job has started. | 87 // Should not be altered after the job has started. |
| 88 bool auto_advance() { return auto_advance_; } | 88 bool auto_advance() { return auto_advance_; } |
| 89 void set_auto_advance(bool auto_advance) { auto_advance_ = auto_advance; } | 89 void set_auto_advance(bool auto_advance) { auto_advance_ = auto_advance; } |
| 90 | 90 |
| 91 // Factory method for protocol factory registration if callers don't subclass | 91 // Factory method for protocol factory registration if callers don't subclass |
| 92 static URLRequest::ProtocolFactory Factory; | 92 static URLRequest::ProtocolFactory Factory; |
| 93 | 93 |
| 94 // Job functions | 94 // Job functions |
| 95 virtual void Start(); | 95 virtual void Start() OVERRIDE; |
| 96 virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read); | 96 virtual bool ReadRawData(IOBuffer* buf, |
| 97 virtual void Kill(); | 97 int buf_size, |
| 98 virtual bool GetMimeType(std::string* mime_type) const; | 98 int *bytes_read) OVERRIDE; |
| 99 virtual void GetResponseInfo(HttpResponseInfo* info); | 99 virtual void Kill() OVERRIDE; |
| 100 virtual int GetResponseCode() const; | 100 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
| 101 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | 101 virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; |
| 102 virtual int GetResponseCode() const OVERRIDE; |
| 103 virtual bool IsRedirectResponse(GURL* location, |
| 104 int* http_status_code) OVERRIDE; |
| 102 | 105 |
| 103 protected: | 106 protected: |
| 104 // This is what operation we are going to do next when this job is handled. | 107 // This is what operation we are going to do next when this job is handled. |
| 105 // When the stage is DONE, this job will not be put on the queue. | 108 // When the stage is DONE, this job will not be put on the queue. |
| 106 enum Stage { WAITING, DATA_AVAILABLE, ALL_DATA, DONE }; | 109 enum Stage { WAITING, DATA_AVAILABLE, ALL_DATA, DONE }; |
| 107 | 110 |
| 108 virtual ~URLRequestTestJob(); | 111 virtual ~URLRequestTestJob(); |
| 109 | 112 |
| 110 // Call to process the next opeation, usually sending a notification, and | 113 // Call to process the next opeation, usually sending a notification, and |
| 111 // advancing the stage if necessary. THIS MAY DELETE THE OBJECT. | 114 // advancing the stage if necessary. THIS MAY DELETE THE OBJECT. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 135 // Holds the buffer for an asynchronous ReadRawData call | 138 // Holds the buffer for an asynchronous ReadRawData call |
| 136 IOBuffer* async_buf_; | 139 IOBuffer* async_buf_; |
| 137 int async_buf_size_; | 140 int async_buf_size_; |
| 138 | 141 |
| 139 ScopedRunnableMethodFactory<URLRequestTestJob> method_factory_; | 142 ScopedRunnableMethodFactory<URLRequestTestJob> method_factory_; |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 } // namespace net | 145 } // namespace net |
| 143 | 146 |
| 144 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ | 147 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ |
| OLD | NEW |