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

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

Issue 1439953006: Reland: URLRequestJob: change ReadRawData contract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address David's comment Created 5 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This class simulates a slow download. Requests to |kUnknownSizeUrl| and 4 // This class simulates a slow download. Requests to |kUnknownSizeUrl| and
5 // |kKnownSizeUrl| start downloads that pause after the first N bytes, to be 5 // |kKnownSizeUrl| start downloads that pause after the first N bytes, to be
6 // completed by sending a request to |kFinishDownloadUrl|. 6 // completed by sending a request to |kFinishDownloadUrl|.
7 7
8 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ 8 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_
9 #define NET_TEST_URL_REQUEST_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ 9 #define NET_TEST_URL_REQUEST_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_
10 10
(...skipping 19 matching lines...) Expand all
30 static const int kSecondDownloadSize; 30 static const int kSecondDownloadSize;
31 31
32 // Timer callback, used to check to see if we should finish our download and 32 // Timer callback, used to check to see if we should finish our download and
33 // send the second chunk. 33 // send the second chunk.
34 void CheckDoneStatus(); 34 void CheckDoneStatus();
35 35
36 // URLRequestJob methods 36 // URLRequestJob methods
37 void Start() override; 37 void Start() override;
38 bool GetMimeType(std::string* mime_type) const override; 38 bool GetMimeType(std::string* mime_type) const override;
39 void GetResponseInfo(HttpResponseInfo* info) override; 39 void GetResponseInfo(HttpResponseInfo* info) override;
40 bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override; 40 int ReadRawData(IOBuffer* buf, int buf_size) override;
41 41
42 // Returns the current number of URLRequestSlowDownloadJobs that have 42 // Returns the current number of URLRequestSlowDownloadJobs that have
43 // not yet completed. 43 // not yet completed.
44 static size_t NumberOutstandingRequests(); 44 static size_t NumberOutstandingRequests();
45 45
46 // Adds the testing URLs to the URLRequestFilter. 46 // Adds the testing URLs to the URLRequestFilter.
47 static void AddUrlHandler(); 47 static void AddUrlHandler();
48 48
49 private: 49 private:
50 class Interceptor; 50 class Interceptor;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bool should_finish_download_; 89 bool should_finish_download_;
90 scoped_refptr<IOBuffer> buffer_; 90 scoped_refptr<IOBuffer> buffer_;
91 int buffer_size_; 91 int buffer_size_;
92 92
93 base::WeakPtrFactory<URLRequestSlowDownloadJob> weak_factory_; 93 base::WeakPtrFactory<URLRequestSlowDownloadJob> weak_factory_;
94 }; 94 };
95 95
96 } // namespace content 96 } // namespace content
97 97
98 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ 98 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_
OLDNEW
« no previous file with comments | « net/test/url_request/url_request_mock_data_job.cc ('k') | net/test/url_request/url_request_slow_download_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698