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