| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #include "net/test/url_request/url_request_hanging_read_job.h" | 5 #include "net/test/url_request/url_request_hanging_read_job.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 weak_factory_.GetWeakPtr())); | 58 weak_factory_.GetWeakPtr())); |
| 59 } | 59 } |
| 60 | 60 |
| 61 URLRequestHangingReadJob::~URLRequestHangingReadJob() {} | 61 URLRequestHangingReadJob::~URLRequestHangingReadJob() {} |
| 62 | 62 |
| 63 int URLRequestHangingReadJob::ReadRawData(IOBuffer* buf, int buf_size) { | 63 int URLRequestHangingReadJob::ReadRawData(IOBuffer* buf, int buf_size) { |
| 64 // Make read hang. It never completes. | 64 // Make read hang. It never completes. |
| 65 return ERR_IO_PENDING; | 65 return ERR_IO_PENDING; |
| 66 } | 66 } |
| 67 | 67 |
| 68 int URLRequestHangingReadJob::GetResponseCode() const { | |
| 69 HttpResponseInfo info; | |
| 70 GetResponseInfoConst(&info); | |
| 71 return info.headers->response_code(); | |
| 72 } | |
| 73 | |
| 74 // Public virtual version. | 68 // Public virtual version. |
| 75 void URLRequestHangingReadJob::GetResponseInfo(HttpResponseInfo* info) { | 69 void URLRequestHangingReadJob::GetResponseInfo(HttpResponseInfo* info) { |
| 76 // Forward to private const version. | 70 // Forward to private const version. |
| 77 GetResponseInfoConst(info); | 71 GetResponseInfoConst(info); |
| 78 } | 72 } |
| 79 | 73 |
| 80 // Private const version. | 74 // Private const version. |
| 81 void URLRequestHangingReadJob::GetResponseInfoConst( | 75 void URLRequestHangingReadJob::GetResponseInfoConst( |
| 82 HttpResponseInfo* info) const { | 76 HttpResponseInfo* info) const { |
| 83 // Send back mock headers. | 77 // Send back mock headers. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 112 GURL URLRequestHangingReadJob::GetMockHttpUrl() { | 106 GURL URLRequestHangingReadJob::GetMockHttpUrl() { |
| 113 return GetMockUrl("http", kMockHostname); | 107 return GetMockUrl("http", kMockHostname); |
| 114 } | 108 } |
| 115 | 109 |
| 116 // static | 110 // static |
| 117 GURL URLRequestHangingReadJob::GetMockHttpsUrl() { | 111 GURL URLRequestHangingReadJob::GetMockHttpsUrl() { |
| 118 return GetMockUrl("https", kMockHostname); | 112 return GetMockUrl("https", kMockHostname); |
| 119 } | 113 } |
| 120 | 114 |
| 121 } // namespace net | 115 } // namespace net |
| OLD | NEW |