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

Side by Side Diff: chrome/browser/automation/url_request_slow_download_job.h

Issue 18390: Change URLRequest to use a ref-counted buffer for actual IO.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/automation/url_request_slow_download_job.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 6 // downloads that pause after the first
7 7
8 #ifndef CHROME_BROWSER_AUTOMATION_URL_REQUEST_SLOW_DOWNLOAD_JOB_H__ 8 #ifndef CHROME_BROWSER_AUTOMATION_URL_REQUEST_SLOW_DOWNLOAD_JOB_H__
9 #define CHROME_BROWSER_AUTOMATION_URL_REQUEST_SLOW_DOWNLOAD_JOB_H__ 9 #define CHROME_BROWSER_AUTOMATION_URL_REQUEST_SLOW_DOWNLOAD_JOB_H__
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "net/url_request/url_request_job.h" 13 #include "net/url_request/url_request_job.h"
14 14
15 class URLRequestSlowDownloadJob : public URLRequestJob { 15 class URLRequestSlowDownloadJob : public URLRequestJob {
16 public: 16 public:
17 URLRequestSlowDownloadJob(URLRequest* request); 17 URLRequestSlowDownloadJob(URLRequest* request);
18 virtual ~URLRequestSlowDownloadJob() { } 18 virtual ~URLRequestSlowDownloadJob() { }
19 19
20 // Timer callback, used to check to see if we should finish our download and 20 // Timer callback, used to check to see if we should finish our download and
21 // send the second chunk. 21 // send the second chunk.
22 void CheckDoneStatus(); 22 void CheckDoneStatus();
23 23
24 // URLRequestJob methods 24 // URLRequestJob methods
25 virtual void Start(); 25 virtual void Start();
26 virtual bool GetMimeType(std::string* mime_type); 26 virtual bool GetMimeType(std::string* mime_type);
27 virtual void GetResponseInfo(net::HttpResponseInfo* info); 27 virtual void GetResponseInfo(net::HttpResponseInfo* info);
28 virtual bool ReadRawData(char* buf, int buf_size, int *bytes_read); 28 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read);
29 29
30 static URLRequestJob* Factory(URLRequest* request, 30 static URLRequestJob* Factory(URLRequest* request,
31 const std::string& scheme); 31 const std::string& scheme);
32 32
33 // Test URLs. 33 // Test URLs.
34 static const wchar_t kUnknownSizeUrl[]; 34 static const wchar_t kUnknownSizeUrl[];
35 static const wchar_t kKnownSizeUrl[]; 35 static const wchar_t kKnownSizeUrl[];
36 static const wchar_t kFinishDownloadUrl[]; 36 static const wchar_t kFinishDownloadUrl[];
37 37
38 // For UI tests: adds the testing URLs to the URLRequestFilter. 38 // For UI tests: adds the testing URLs to the URLRequestFilter.
39 static void AddUITestUrls(); 39 static void AddUITestUrls();
40 40
41 private: 41 private:
42 // Mark all pending requests to be finished. We keep track of pending 42 // Mark all pending requests to be finished. We keep track of pending
43 // requests in |kPendingRequests|. 43 // requests in |kPendingRequests|.
44 static void FinishPendingRequests(); 44 static void FinishPendingRequests();
45 static std::vector<URLRequestSlowDownloadJob*> kPendingRequests; 45 static std::vector<URLRequestSlowDownloadJob*> kPendingRequests;
46 46
47 void StartAsync(); 47 void StartAsync();
48 48
49 void set_should_finish_download() { should_finish_download_ = true; } 49 void set_should_finish_download() { should_finish_download_ = true; }
50 50
51 int first_download_size_remaining_; 51 int first_download_size_remaining_;
52 bool should_finish_download_; 52 bool should_finish_download_;
53 bool should_send_second_chunk_; 53 bool should_send_second_chunk_;
54 }; 54 };
55 55
56 #endif // CHROME_BROWSER_AUTOMATION_URL_REQUEST_SLOW_DOWNLOAD_JOB_H__ 56 #endif // CHROME_BROWSER_AUTOMATION_URL_REQUEST_SLOW_DOWNLOAD_JOB_H__
57 57
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/url_request_slow_download_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698