| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 content and http headers from disk. | 5 // A URLRequestJob class that pulls the content and http headers from disk. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ | 7 #ifndef CHROME_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ |
| 8 #define CHROME_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ | 8 #define CHROME_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "net/url_request/url_request_file_job.h" | 12 #include "net/url_request/url_request_file_job.h" |
| 13 | 13 |
| 14 class FilePath; |
| 15 |
| 14 class URLRequestMockHTTPJob : public URLRequestFileJob { | 16 class URLRequestMockHTTPJob : public URLRequestFileJob { |
| 15 public: | 17 public: |
| 16 URLRequestMockHTTPJob(URLRequest* request, const FilePath& file_path); | 18 URLRequestMockHTTPJob(URLRequest* request, const FilePath& file_path); |
| 17 virtual ~URLRequestMockHTTPJob() { } | 19 virtual ~URLRequestMockHTTPJob() { } |
| 18 | 20 |
| 19 virtual bool GetMimeType(std::string* mime_type) const; | 21 virtual bool GetMimeType(std::string* mime_type) const; |
| 20 virtual bool GetCharset(std::string* charset); | 22 virtual bool GetCharset(std::string* charset); |
| 21 virtual void GetResponseInfo(net::HttpResponseInfo* info); | 23 virtual void GetResponseInfo(net::HttpResponseInfo* info); |
| 22 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | 24 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); |
| 23 | 25 |
| 24 static URLRequest::ProtocolFactory Factory; | 26 static URLRequest::ProtocolFactory Factory; |
| 25 | 27 |
| 26 // Adds the testing URLs to the URLRequestFilter. | 28 // Adds the testing URLs to the URLRequestFilter. |
| 27 static void AddUrlHandler(const std::wstring& base_path); | 29 static void AddUrlHandler(const FilePath& base_path); |
| 28 | 30 |
| 29 // Given the path to a file relative to base_path_, construct a mock URL. | 31 // Given the path to a file relative to base_path_, construct a mock URL. |
| 30 static GURL GetMockUrl(const std::wstring& path); | 32 static GURL GetMockUrl(const FilePath& path); |
| 31 | 33 |
| 32 protected: | 34 protected: |
| 33 static FilePath GetOnDiskPath(const std::wstring& base_path, | 35 static FilePath GetOnDiskPath(const FilePath& base_path, |
| 34 URLRequest* request, | 36 URLRequest* request, |
| 35 const std::string& scheme); | 37 const std::string& scheme); |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 void GetResponseInfoConst(net::HttpResponseInfo* info) const; | 40 void GetResponseInfoConst(net::HttpResponseInfo* info) const; |
| 39 | 41 |
| 40 // This is the file path leading to the root of the directory to use as the | 42 // This is the file path leading to the root of the directory to use as the |
| 41 // root of the http server. | 43 // root of the http server. |
| 42 static std::wstring base_path_; | 44 static FilePath base_path_; |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 # endif // CHROME_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ | 47 # endif // CHROME_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ |
| OLD | NEW |