| 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 URLRequestJob class that pulls the net and http headers from disk. | 5 // A URLRequestJob class that pulls the net and http headers from disk. |
| 6 | 6 |
| 7 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ | 7 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ |
| 8 #define NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ | 8 #define NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 namespace net { | 27 namespace net { |
| 28 | 28 |
| 29 class URLRequestMockHTTPJob : public URLRequestFileJob { | 29 class URLRequestMockHTTPJob : public URLRequestFileJob { |
| 30 public: | 30 public: |
| 31 // Note that all file IO is done using |worker_pool|. | 31 // Note that all file IO is done using |worker_pool|. |
| 32 URLRequestMockHTTPJob(URLRequest* request, | 32 URLRequestMockHTTPJob(URLRequest* request, |
| 33 NetworkDelegate* network_delegate, | 33 NetworkDelegate* network_delegate, |
| 34 const base::FilePath& file_path, | 34 const base::FilePath& file_path, |
| 35 const scoped_refptr<base::TaskRunner>& task_runner); | 35 const scoped_refptr<base::TaskRunner>& task_runner); |
| 36 | 36 |
| 37 virtual void Start() OVERRIDE; | 37 virtual void Start() override; |
| 38 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 38 virtual bool GetMimeType(std::string* mime_type) const override; |
| 39 virtual int GetResponseCode() const OVERRIDE; | 39 virtual int GetResponseCode() const override; |
| 40 virtual bool GetCharset(std::string* charset) OVERRIDE; | 40 virtual bool GetCharset(std::string* charset) override; |
| 41 virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; | 41 virtual void GetResponseInfo(HttpResponseInfo* info) override; |
| 42 virtual bool IsRedirectResponse(GURL* location, | 42 virtual bool IsRedirectResponse(GURL* location, |
| 43 int* http_status_code) OVERRIDE; | 43 int* http_status_code) override; |
| 44 | 44 |
| 45 // Adds the testing URLs to the URLRequestFilter. | 45 // Adds the testing URLs to the URLRequestFilter. |
| 46 static void AddUrlHandler( | 46 static void AddUrlHandler( |
| 47 const base::FilePath& base_path, | 47 const base::FilePath& base_path, |
| 48 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); | 48 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); |
| 49 | 49 |
| 50 // Respond to all HTTP requests of |hostname| with contents of the file | 50 // Respond to all HTTP requests of |hostname| with contents of the file |
| 51 // located at |file_path|. | 51 // located at |file_path|. |
| 52 static void AddHostnameToFileHandler( | 52 static void AddHostnameToFileHandler( |
| 53 const std::string& hostname, | 53 const std::string& hostname, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 83 const scoped_refptr<base::TaskRunner> task_runner_; | 83 const scoped_refptr<base::TaskRunner> task_runner_; |
| 84 | 84 |
| 85 base::WeakPtrFactory<URLRequestMockHTTPJob> weak_ptr_factory_; | 85 base::WeakPtrFactory<URLRequestMockHTTPJob> weak_ptr_factory_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(URLRequestMockHTTPJob); | 87 DISALLOW_COPY_AND_ASSIGN(URLRequestMockHTTPJob); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace net | 90 } // namespace net |
| 91 | 91 |
| 92 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ | 92 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ |
| OLD | NEW |