| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); | 51 static GURL GetMockUrl(const std::string& path); |
| 52 static GURL GetMockHttpsUrl(const std::string& path); | 52 static GURL GetMockHttpsUrl(const std::string& path); |
| 53 | 53 |
| 54 // Like above, but takes a FilePath. These methods are deprecated. Prefer the | |
| 55 // std::string versions. See http://crbug.com/496936. | |
| 56 static GURL GetMockUrl(const base::FilePath& path); | |
| 57 | |
| 58 // Returns a URLRequestJobFactory::ProtocolHandler that serves | 54 // Returns a URLRequestJobFactory::ProtocolHandler that serves |
| 59 // URLRequestMockHTTPJob's responding like an HTTP server. |base_path| is the | 55 // URLRequestMockHTTPJob's responding like an HTTP server. |base_path| is the |
| 60 // file path leading to the root of the directory to use as the root of the | 56 // file path leading to the root of the directory to use as the root of the |
| 61 // HTTP server. | 57 // HTTP server. |
| 62 static scoped_ptr<URLRequestInterceptor> CreateInterceptor( | 58 static scoped_ptr<URLRequestInterceptor> CreateInterceptor( |
| 63 const base::FilePath& base_path, | 59 const base::FilePath& base_path, |
| 64 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); | 60 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); |
| 65 | 61 |
| 66 // Returns a URLRequestJobFactory::ProtocolHandler that serves | 62 // Returns a URLRequestJobFactory::ProtocolHandler that serves |
| 67 // URLRequestMockHTTPJob's responding like an HTTP server. It responds to all | 63 // URLRequestMockHTTPJob's responding like an HTTP server. It responds to all |
| (...skipping 13 matching lines...) Expand all Loading... |
| 81 const scoped_refptr<base::TaskRunner> task_runner_; | 77 const scoped_refptr<base::TaskRunner> task_runner_; |
| 82 | 78 |
| 83 base::WeakPtrFactory<URLRequestMockHTTPJob> weak_ptr_factory_; | 79 base::WeakPtrFactory<URLRequestMockHTTPJob> weak_ptr_factory_; |
| 84 | 80 |
| 85 DISALLOW_COPY_AND_ASSIGN(URLRequestMockHTTPJob); | 81 DISALLOW_COPY_AND_ASSIGN(URLRequestMockHTTPJob); |
| 86 }; | 82 }; |
| 87 | 83 |
| 88 } // namespace net | 84 } // namespace net |
| 89 | 85 |
| 90 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ | 86 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ |
| OLD | NEW |