OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 net::URLRequestJob class that pulls the content and http headers from disk. | 5 // A net::URLRequestJob class that pulls the content and http headers from disk. |
6 | 6 |
7 #ifndef CONTENT_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ | 7 #ifndef CONTENT_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ |
8 #define CONTENT_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ | 8 #define CONTENT_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 virtual bool GetMimeType(std::string* mime_type) const; | 22 virtual bool GetMimeType(std::string* mime_type) const; |
23 virtual bool GetCharset(std::string* charset); | 23 virtual bool GetCharset(std::string* charset); |
24 virtual void GetResponseInfo(net::HttpResponseInfo* info); | 24 virtual void GetResponseInfo(net::HttpResponseInfo* info); |
25 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | 25 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); |
26 | 26 |
27 static net::URLRequest::ProtocolFactory Factory; | 27 static net::URLRequest::ProtocolFactory Factory; |
28 | 28 |
29 // Adds the testing URLs to the net::URLRequestFilter. | 29 // Adds the testing URLs to the net::URLRequestFilter. |
30 static void AddUrlHandler(const FilePath& base_path); | 30 static void AddUrlHandler(const FilePath& base_path); |
31 | 31 |
32 // Given the path to a file relative to base_path_, construct a mock URL. | 32 // Given the path to a file relative to BasePath(), construct a mock URL. |
33 static GURL GetMockUrl(const FilePath& path); | 33 static GURL GetMockUrl(const FilePath& path); |
34 | 34 |
35 // Given the path to a file relative to base_path_, | 35 // Given the path to a file relative to BasePath(), |
36 // construct a mock URL for view source. | 36 // construct a mock URL for view source. |
37 static GURL GetMockViewSourceUrl(const FilePath& path); | 37 static GURL GetMockViewSourceUrl(const FilePath& path); |
38 | 38 |
39 protected: | 39 protected: |
40 virtual ~URLRequestMockHTTPJob() { } | 40 virtual ~URLRequestMockHTTPJob() { } |
41 | 41 |
42 static FilePath GetOnDiskPath(const FilePath& base_path, | 42 static FilePath GetOnDiskPath(const FilePath& base_path, |
43 net::URLRequest* request, | 43 net::URLRequest* request, |
44 const std::string& scheme); | 44 const std::string& scheme); |
45 | 45 |
46 private: | 46 private: |
47 void GetResponseInfoConst(net::HttpResponseInfo* info) const; | 47 void GetResponseInfoConst(net::HttpResponseInfo* info) const; |
48 | 48 |
49 // This is the file path leading to the root of the directory to use as the | 49 // This is the file path leading to the root of the directory to use as the |
50 // root of the http server. | 50 // root of the http server. |
51 static FilePath base_path_; | 51 static FilePath& BasePath(); |
Mark Mentovai
2011/11/07 22:34:15
You’re making this return a non-const reference, a
Nico
2011/11/07 23:29:21
Done.
| |
52 }; | 52 }; |
53 | 53 |
54 #endif // CONTENT_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ | 54 #endif // CONTENT_BROWSER_NET_URL_REQUEST_MOCK_HTTP_JOB_H_ |
OLD | NEW |