OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "net/base/net_export.h" |
| 11 #include "net/url_request/url_request_job.h" |
| 12 |
| 13 namespace net { |
| 14 |
| 15 class URLRequest; |
| 16 |
| 17 // A URLRequestJob that hangs when try to read response body. |
| 18 class URLRequestHangingReadJob : public URLRequestJob { |
| 19 public: |
| 20 URLRequestHangingReadJob(URLRequest* request, |
| 21 NetworkDelegate* network_delegate); |
| 22 |
| 23 void Start() override; |
| 24 int ReadRawData(IOBuffer* buf, int buf_size) override; |
| 25 int GetResponseCode() const override; |
| 26 void GetResponseInfo(HttpResponseInfo* info) override; |
| 27 |
| 28 // Adds the testing URLs to the URLRequestFilter. |
| 29 static void AddUrlHandler(); |
| 30 |
| 31 static GURL GetMockHttpUrl(); |
| 32 static GURL GetMockHttpsUrl(); |
| 33 |
| 34 private: |
| 35 void GetResponseInfoConst(HttpResponseInfo* info) const; |
| 36 ~URLRequestHangingReadJob() override; |
| 37 |
| 38 void StartAsync(); |
| 39 |
| 40 const int content_length_; |
| 41 base::WeakPtrFactory<URLRequestHangingReadJob> weak_factory_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(URLRequestHangingReadJob); |
| 44 }; |
| 45 |
| 46 } // namespace net |
| 47 |
| 48 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ |
OLD | NEW |