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 30 matching lines...) Expand all Loading... |
41 void GetResponseInfo(HttpResponseInfo* info) override; | 41 void GetResponseInfo(HttpResponseInfo* info) override; |
42 bool IsRedirectResponse(GURL* location, int* http_status_code) override; | 42 bool IsRedirectResponse(GURL* location, int* http_status_code) override; |
43 | 43 |
44 // Adds the testing URLs to the URLRequestFilter, both under HTTP and HTTPS. | 44 // Adds the testing URLs to the URLRequestFilter, both under HTTP and HTTPS. |
45 static void AddUrlHandlers( | 45 static void AddUrlHandlers( |
46 const base::FilePath& base_path, | 46 const base::FilePath& base_path, |
47 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); | 47 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); |
48 | 48 |
49 // Given the path to a file relative to the path passed to AddUrlHandler(), | 49 // Given the path to a file relative to the path passed to AddUrlHandler(), |
50 // construct a mock URL. | 50 // construct a mock URL. |
| 51 static GURL GetMockUrl(const std::string& path); |
| 52 static GURL GetMockHttpsUrl(const std::string& path); |
| 53 |
| 54 // Like above, but takes a FilePath. These methods are deprecated. Prefer the |
| 55 // std::string versions. See http://crbug.com/496936. |
51 static GURL GetMockUrl(const base::FilePath& path); | 56 static GURL GetMockUrl(const base::FilePath& path); |
52 static GURL GetMockHttpsUrl(const base::FilePath& path); | 57 static GURL GetMockHttpsUrl(const base::FilePath& path); |
53 | 58 |
54 // Returns a URLRequestJobFactory::ProtocolHandler that serves | 59 // Returns a URLRequestJobFactory::ProtocolHandler that serves |
55 // URLRequestMockHTTPJob's responding like an HTTP server. |base_path| is the | 60 // URLRequestMockHTTPJob's responding like an HTTP server. |base_path| is the |
56 // file path leading to the root of the directory to use as the root of the | 61 // file path leading to the root of the directory to use as the root of the |
57 // HTTP server. | 62 // HTTP server. |
58 static scoped_ptr<URLRequestInterceptor> CreateInterceptor( | 63 static scoped_ptr<URLRequestInterceptor> CreateInterceptor( |
59 const base::FilePath& base_path, | 64 const base::FilePath& base_path, |
60 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); | 65 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); |
(...skipping 16 matching lines...) Expand all Loading... |
77 const scoped_refptr<base::TaskRunner> task_runner_; | 82 const scoped_refptr<base::TaskRunner> task_runner_; |
78 | 83 |
79 base::WeakPtrFactory<URLRequestMockHTTPJob> weak_ptr_factory_; | 84 base::WeakPtrFactory<URLRequestMockHTTPJob> weak_ptr_factory_; |
80 | 85 |
81 DISALLOW_COPY_AND_ASSIGN(URLRequestMockHTTPJob); | 86 DISALLOW_COPY_AND_ASSIGN(URLRequestMockHTTPJob); |
82 }; | 87 }; |
83 | 88 |
84 } // namespace net | 89 } // namespace net |
85 | 90 |
86 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ | 91 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ |
OLD | NEW |