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

Side by Side Diff: content/browser/net/url_request_slow_download_job.h

Issue 8381024: more content exports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't link installer_unittests, setup against content Created 9 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/browser/notification_service_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This class simulates a slow download. This used in a UI test to test the 4 // This class simulates a slow download. This used in a UI test to test the
5 // download manager. Requests to |kUnknownSizeUrl| and |kKnownSizeUrl| start 5 // download manager. Requests to |kUnknownSizeUrl| and |kKnownSizeUrl| start
6 // downloads that pause after the first N bytes, to be completed by sending a 6 // downloads that pause after the first N bytes, to be completed by sending a
7 // request to |kFinishDownloadUrl|. 7 // request to |kFinishDownloadUrl|.
8 8
9 #ifndef CONTENT_BROWSER_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ 9 #ifndef CONTENT_BROWSER_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_
10 #define CONTENT_BROWSER_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ 10 #define CONTENT_BROWSER_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_
(...skipping 25 matching lines...) Expand all
36 virtual void Start(); 36 virtual void Start();
37 virtual bool GetMimeType(std::string* mime_type) const; 37 virtual bool GetMimeType(std::string* mime_type) const;
38 virtual void GetResponseInfo(net::HttpResponseInfo* info); 38 virtual void GetResponseInfo(net::HttpResponseInfo* info);
39 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); 39 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read);
40 40
41 static net::URLRequestJob* Factory(net::URLRequest* request, 41 static net::URLRequestJob* Factory(net::URLRequest* request,
42 const std::string& scheme); 42 const std::string& scheme);
43 43
44 // Returns the current number of URLRequestSlowDownloadJobs that have 44 // Returns the current number of URLRequestSlowDownloadJobs that have
45 // not yet completed. 45 // not yet completed.
46 static size_t NumberOutstandingRequests(); 46 CONTENT_EXPORT static size_t NumberOutstandingRequests();
47 47
48 // Adds the testing URLs to the net::URLRequestFilter. 48 // Adds the testing URLs to the net::URLRequestFilter.
49 CONTENT_EXPORT static void AddUrlHandler(); 49 CONTENT_EXPORT static void AddUrlHandler();
50 50
51 private: 51 private:
52 explicit URLRequestSlowDownloadJob(net::URLRequest* request); 52 explicit URLRequestSlowDownloadJob(net::URLRequest* request);
53 virtual ~URLRequestSlowDownloadJob(); 53 virtual ~URLRequestSlowDownloadJob();
54 54
55 void GetResponseInfoConst(net::HttpResponseInfo* info) const; 55 void GetResponseInfoConst(net::HttpResponseInfo* info) const;
56 56
57 // Mark all pending requests to be finished. We keep track of pending 57 // Mark all pending requests to be finished. We keep track of pending
58 // requests in |pending_requests_|. 58 // requests in |pending_requests_|.
59 static void FinishPendingRequests(); 59 static void FinishPendingRequests();
60 static std::set<URLRequestSlowDownloadJob*> pending_requests_; 60 static std::set<URLRequestSlowDownloadJob*> pending_requests_;
61 61
62 void StartAsync(); 62 void StartAsync();
63 63
64 void set_should_finish_download() { should_finish_download_ = true; } 64 void set_should_finish_download() { should_finish_download_ = true; }
65 65
66 int first_download_size_remaining_; 66 int first_download_size_remaining_;
67 bool should_finish_download_; 67 bool should_finish_download_;
68 scoped_refptr<net::IOBuffer> buffer_; 68 scoped_refptr<net::IOBuffer> buffer_;
69 int buffer_size_; 69 int buffer_size_;
70 70
71 ScopedRunnableMethodFactory<URLRequestSlowDownloadJob> method_factory_; 71 ScopedRunnableMethodFactory<URLRequestSlowDownloadJob> method_factory_;
72 }; 72 };
73 73
74 #endif // CONTENT_BROWSER_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ 74 #endif // CONTENT_BROWSER_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/browser/notification_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698