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

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

Issue 671663002: Standardize usage of virtual/override/final in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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. 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_TEST_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ 9 #ifndef CONTENT_TEST_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_
10 #define CONTENT_TEST_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ 10 #define CONTENT_TEST_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_
(...skipping 17 matching lines...) Expand all
28 28
29 // Download sizes. 29 // Download sizes.
30 static const int kFirstDownloadSize; 30 static const int kFirstDownloadSize;
31 static const int kSecondDownloadSize; 31 static const int kSecondDownloadSize;
32 32
33 // Timer callback, used to check to see if we should finish our download and 33 // Timer callback, used to check to see if we should finish our download and
34 // send the second chunk. 34 // send the second chunk.
35 void CheckDoneStatus(); 35 void CheckDoneStatus();
36 36
37 // net::URLRequestJob methods 37 // net::URLRequestJob methods
38 virtual void Start() override; 38 void Start() override;
39 virtual bool GetMimeType(std::string* mime_type) const override; 39 bool GetMimeType(std::string* mime_type) const override;
40 virtual void GetResponseInfo(net::HttpResponseInfo* info) override; 40 void GetResponseInfo(net::HttpResponseInfo* info) override;
41 virtual bool ReadRawData(net::IOBuffer* buf, 41 bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
42 int buf_size,
43 int *bytes_read) override;
44 42
45 static net::URLRequestJob* Factory(net::URLRequest* request, 43 static net::URLRequestJob* Factory(net::URLRequest* request,
46 net::NetworkDelegate* network_delegate, 44 net::NetworkDelegate* network_delegate,
47 const std::string& scheme); 45 const std::string& scheme);
48 46
49 // Returns the current number of URLRequestSlowDownloadJobs that have 47 // Returns the current number of URLRequestSlowDownloadJobs that have
50 // not yet completed. 48 // not yet completed.
51 static size_t NumberOutstandingRequests(); 49 static size_t NumberOutstandingRequests();
52 50
53 // Adds the testing URLs to the net::URLRequestFilter. 51 // Adds the testing URLs to the net::URLRequestFilter.
54 static void AddUrlHandler(); 52 static void AddUrlHandler();
55 53
56 private: 54 private:
57 URLRequestSlowDownloadJob(net::URLRequest* request, 55 URLRequestSlowDownloadJob(net::URLRequest* request,
58 net::NetworkDelegate* network_delegate); 56 net::NetworkDelegate* network_delegate);
59 virtual ~URLRequestSlowDownloadJob(); 57 ~URLRequestSlowDownloadJob() override;
60 58
61 // Enum indicating where we are in the read after a call to 59 // Enum indicating where we are in the read after a call to
62 // FillBufferHelper. 60 // FillBufferHelper.
63 enum ReadStatus { 61 enum ReadStatus {
64 // The buffer was filled with data and may be returned. 62 // The buffer was filled with data and may be returned.
65 BUFFER_FILLED, 63 BUFFER_FILLED,
66 64
67 // No data was added to the buffer because kFinishDownloadUrl has 65 // No data was added to the buffer because kFinishDownloadUrl has
68 // not yet been seen and we've already returned the first chunk. 66 // not yet been seen and we've already returned the first chunk.
69 REQUEST_BLOCKED, 67 REQUEST_BLOCKED,
(...skipping 26 matching lines...) Expand all
96 bool should_finish_download_; 94 bool should_finish_download_;
97 scoped_refptr<net::IOBuffer> buffer_; 95 scoped_refptr<net::IOBuffer> buffer_;
98 int buffer_size_; 96 int buffer_size_;
99 97
100 base::WeakPtrFactory<URLRequestSlowDownloadJob> weak_factory_; 98 base::WeakPtrFactory<URLRequestSlowDownloadJob> weak_factory_;
101 }; 99 };
102 100
103 } // namespace content 101 } // namespace content
104 102
105 #endif // CONTENT_TEST_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ 103 #endif // CONTENT_TEST_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_
OLDNEW
« no previous file with comments | « content/test/net/url_request_abort_on_end_job.h ('k') | content/test/plugin/plugin_arguments_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698