| OLD | NEW |
| 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 |
| 11 #include <stddef.h> |
| 12 |
| 11 #include <set> | 13 #include <set> |
| 12 #include <string> | 14 #include <string> |
| 13 | 15 |
| 14 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 15 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 16 #include "net/url_request/url_request_job.h" | 18 #include "net/url_request/url_request_job.h" |
| 17 | 19 |
| 18 namespace net { | 20 namespace net { |
| 19 | 21 |
| 20 class URLRequestSlowDownloadJob : public URLRequestJob { | 22 class URLRequestSlowDownloadJob : public URLRequestJob { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 bool should_finish_download_; | 91 bool should_finish_download_; |
| 90 scoped_refptr<IOBuffer> buffer_; | 92 scoped_refptr<IOBuffer> buffer_; |
| 91 int buffer_size_; | 93 int buffer_size_; |
| 92 | 94 |
| 93 base::WeakPtrFactory<URLRequestSlowDownloadJob> weak_factory_; | 95 base::WeakPtrFactory<URLRequestSlowDownloadJob> weak_factory_; |
| 94 }; | 96 }; |
| 95 | 97 |
| 96 } // namespace content | 98 } // namespace content |
| 97 | 99 |
| 98 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ | 100 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ |
| OLD | NEW |