| 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 // | 4 // |
| 5 // A URLRequestMockHTTPJob class that inserts a time delay in processing. | 5 // A URLRequestMockHTTPJob class that inserts a time delay in processing. |
| 6 | 6 |
| 7 #ifndef CONTENT_TEST_NET_URL_REQUEST_SLOW_HTTP_JOB_H_ | 7 #ifndef CONTENT_TEST_NET_URL_REQUEST_SLOW_HTTP_JOB_H_ |
| 8 #define CONTENT_TEST_NET_URL_REQUEST_SLOW_HTTP_JOB_H_ | 8 #define CONTENT_TEST_NET_URL_REQUEST_SLOW_HTTP_JOB_H_ |
| 9 | 9 |
| 10 #include "base/timer.h" | 10 #include "base/timer.h" |
| 11 #include "content/test/net/url_request_mock_http_job.h" | 11 #include "content/test/net/url_request_mock_http_job.h" |
| 12 | 12 |
| 13 class URLRequestSlowHTTPJob : public URLRequestMockHTTPJob { | 13 class URLRequestSlowHTTPJob : public URLRequestMockHTTPJob { |
| 14 public: | 14 public: |
| 15 URLRequestSlowHTTPJob(net::URLRequest* request, const FilePath& file_path); | 15 URLRequestSlowHTTPJob(net::URLRequest* request, |
| 16 net::NetworkDelegate* network_delegate, |
| 17 const FilePath& file_path); |
| 16 | 18 |
| 17 static const int kDelayMs; | 19 static const int kDelayMs; |
| 18 | 20 |
| 19 static net::URLRequest::ProtocolFactory Factory; | 21 static net::URLRequest::ProtocolFactory Factory; |
| 20 | 22 |
| 21 // Adds the testing URLs to the net::URLRequestFilter. | 23 // Adds the testing URLs to the net::URLRequestFilter. |
| 22 static void AddUrlHandler(const FilePath& base_path); | 24 static void AddUrlHandler(const FilePath& base_path); |
| 23 | 25 |
| 24 // Given the path to a file relative to the path passed to AddUrlHandler(), | 26 // Given the path to a file relative to the path passed to AddUrlHandler(), |
| 25 // construct a mock URL. | 27 // construct a mock URL. |
| 26 static GURL GetMockUrl(const FilePath& path); | 28 static GURL GetMockUrl(const FilePath& path); |
| 27 | 29 |
| 28 virtual void Start() OVERRIDE; | 30 virtual void Start() OVERRIDE; |
| 29 | 31 |
| 30 private: | 32 private: |
| 31 virtual ~URLRequestSlowHTTPJob(); | 33 virtual ~URLRequestSlowHTTPJob(); |
| 32 | 34 |
| 33 void RealStart(); | 35 void RealStart(); |
| 34 | 36 |
| 35 base::OneShotTimer<URLRequestSlowHTTPJob> delay_timer_; | 37 base::OneShotTimer<URLRequestSlowHTTPJob> delay_timer_; |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 #endif // CONTENT_TEST_NET_URL_REQUEST_SLOW_HTTP_JOB_H_ | 40 #endif // CONTENT_TEST_NET_URL_REQUEST_SLOW_HTTP_JOB_H_ |
| OLD | NEW |