Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: net/test/url_request/url_request_hanging_read_job.h

Issue 2676033002: Give URLRequestJob::GetResponseCode a better default implementation. (Closed)
Patch Set: Add headers Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_ 5 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_
6 #define NET_TEST_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_ 6 #define NET_TEST_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "net/url_request/url_request_job.h" 10 #include "net/url_request/url_request_job.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 class URLRequest; 14 class URLRequest;
15 15
16 // A URLRequestJob that hangs when try to read response body. 16 // A URLRequestJob that hangs when try to read response body.
17 class URLRequestHangingReadJob : public URLRequestJob { 17 class URLRequestHangingReadJob : public URLRequestJob {
18 public: 18 public:
19 URLRequestHangingReadJob(URLRequest* request, 19 URLRequestHangingReadJob(URLRequest* request,
20 NetworkDelegate* network_delegate); 20 NetworkDelegate* network_delegate);
21 21
22 void Start() override; 22 void Start() override;
23 int ReadRawData(IOBuffer* buf, int buf_size) override; 23 int ReadRawData(IOBuffer* buf, int buf_size) override;
24 int GetResponseCode() const override;
25 void GetResponseInfo(HttpResponseInfo* info) override; 24 void GetResponseInfo(HttpResponseInfo* info) override;
26 25
27 // Adds the testing URLs to the URLRequestFilter. 26 // Adds the testing URLs to the URLRequestFilter.
28 static void AddUrlHandler(); 27 static void AddUrlHandler();
29 28
30 static GURL GetMockHttpUrl(); 29 static GURL GetMockHttpUrl();
31 static GURL GetMockHttpsUrl(); 30 static GURL GetMockHttpsUrl();
32 31
33 private: 32 private:
34 void GetResponseInfoConst(HttpResponseInfo* info) const; 33 void GetResponseInfoConst(HttpResponseInfo* info) const;
35 ~URLRequestHangingReadJob() override; 34 ~URLRequestHangingReadJob() override;
36 35
37 void StartAsync(); 36 void StartAsync();
38 37
39 const int content_length_; 38 const int content_length_;
40 base::WeakPtrFactory<URLRequestHangingReadJob> weak_factory_; 39 base::WeakPtrFactory<URLRequestHangingReadJob> weak_factory_;
41 40
42 DISALLOW_COPY_AND_ASSIGN(URLRequestHangingReadJob); 41 DISALLOW_COPY_AND_ASSIGN(URLRequestHangingReadJob);
43 }; 42 };
44 43
45 } // namespace net 44 } // namespace net
46 45
47 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_ 46 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_
OLDNEW
« no previous file with comments | « net/test/url_request/url_request_failed_job.cc ('k') | net/test/url_request/url_request_hanging_read_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698