| 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_AUTOMATION_URL_REQUEST_MOCK_HTTP_JOB_H__ | 7 #ifndef CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_HTTP_JOB_H__ |
| 8 #define CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_HTTP_JOB_H__ | 8 #define CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_HTTP_JOB_H__ |
| 9 | 9 |
| 10 #include <string> |
| 11 |
| 10 #include "net/url_request/url_request_file_job.h" | 12 #include "net/url_request/url_request_file_job.h" |
| 11 | 13 |
| 12 class URLRequestMockHTTPJob : public URLRequestFileJob { | 14 class URLRequestMockHTTPJob : public URLRequestFileJob { |
| 13 public: | 15 public: |
| 14 URLRequestMockHTTPJob(URLRequest* request, const FilePath& file_path); | 16 URLRequestMockHTTPJob(URLRequest* request, const FilePath& file_path); |
| 15 virtual ~URLRequestMockHTTPJob() { } | 17 virtual ~URLRequestMockHTTPJob() { } |
| 16 | 18 |
| 17 virtual bool GetMimeType(std::string* mime_type); | 19 virtual bool GetMimeType(std::string* mime_type) const; |
| 18 virtual bool GetCharset(std::string* charset); | 20 virtual bool GetCharset(std::string* charset); |
| 19 virtual void GetResponseInfo(net::HttpResponseInfo* info); | 21 virtual void GetResponseInfo(net::HttpResponseInfo* info); |
| 20 | 22 |
| 21 static URLRequest::ProtocolFactory Factory; | 23 static URLRequest::ProtocolFactory Factory; |
| 22 | 24 |
| 23 // For UI tests: adds the testing URLs to the URLRequestFilter. | 25 // For UI tests: adds the testing URLs to the URLRequestFilter. |
| 24 static void AddUITestUrls(const std::wstring& base_path); | 26 static void AddUITestUrls(const std::wstring& base_path); |
| 25 | 27 |
| 26 // Given the path to a file relative to base_path_, construct a mock URL. | 28 // Given the path to a file relative to base_path_, construct a mock URL. |
| 27 static GURL GetMockUrl(const std::wstring& path); | 29 static GURL GetMockUrl(const std::wstring& path); |
| 28 | 30 |
| 29 private: | 31 private: |
| 32 void GetResponseInfoConst(net::HttpResponseInfo* info) const; |
| 33 |
| 30 // This is the file path leading to the root of the directory to use as the | 34 // This is the file path leading to the root of the directory to use as the |
| 31 // root of the http server. | 35 // root of the http server. |
| 32 static std::wstring base_path_; | 36 static std::wstring base_path_; |
| 33 }; | 37 }; |
| 34 | 38 |
| 35 # endif // CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_HTTP_JOB_H__ | 39 # endif // CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_HTTP_JOB_H__ |
| 36 | 40 |
| OLD | NEW |