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. 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_ |
11 #pragma once | |
12 | 11 |
13 #include <set> | 12 #include <set> |
14 #include <string> | 13 #include <string> |
15 | 14 |
16 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
17 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
18 #include "net/url_request/url_request_job.h" | 17 #include "net/url_request/url_request_job.h" |
19 | 18 |
20 class URLRequestSlowDownloadJob : public net::URLRequestJob { | 19 class URLRequestSlowDownloadJob : public net::URLRequestJob { |
21 public: | 20 public: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 86 |
88 int bytes_already_sent_; | 87 int bytes_already_sent_; |
89 bool should_finish_download_; | 88 bool should_finish_download_; |
90 scoped_refptr<net::IOBuffer> buffer_; | 89 scoped_refptr<net::IOBuffer> buffer_; |
91 int buffer_size_; | 90 int buffer_size_; |
92 | 91 |
93 base::WeakPtrFactory<URLRequestSlowDownloadJob> weak_factory_; | 92 base::WeakPtrFactory<URLRequestSlowDownloadJob> weak_factory_; |
94 }; | 93 }; |
95 | 94 |
96 #endif // CONTENT_TEST_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ | 95 #endif // CONTENT_TEST_NET_URL_REQUEST_SLOW_DOWNLOAD_JOB_H_ |
OLD | NEW |