| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ | 5 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ |
| 6 #define NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ | 6 #define NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 URLRequestMockDataJob(URLRequest* request, | 24 URLRequestMockDataJob(URLRequest* request, |
| 25 NetworkDelegate* network_delegate, | 25 NetworkDelegate* network_delegate, |
| 26 const std::string& data, | 26 const std::string& data, |
| 27 int data_repeat_count, | 27 int data_repeat_count, |
| 28 bool request_client_certificate); | 28 bool request_client_certificate); |
| 29 | 29 |
| 30 void Start() override; | 30 void Start() override; |
| 31 int ReadRawData(IOBuffer* buf, int buf_size) override; | 31 int ReadRawData(IOBuffer* buf, int buf_size) override; |
| 32 void GetResponseInfo(HttpResponseInfo* info) override; | 32 void GetResponseInfo(HttpResponseInfo* info) override; |
| 33 void ContinueWithCertificate(X509Certificate* client_cert, | 33 void ContinueWithCertificate( |
| 34 SSLPrivateKey* client_private_key) override; | 34 scoped_refptr<X509Certificate> client_cert, |
| 35 scoped_refptr<SSLPrivateKey> client_private_key) override; |
| 35 | 36 |
| 36 // Adds the testing URLs to the URLRequestFilter. | 37 // Adds the testing URLs to the URLRequestFilter. |
| 37 static void AddUrlHandler(); | 38 static void AddUrlHandler(); |
| 38 static void AddUrlHandlerForHostname(const std::string& hostname); | 39 static void AddUrlHandlerForHostname(const std::string& hostname); |
| 39 | 40 |
| 40 // Given data and repeat cound, constructs a mock URL that will return that | 41 // Given data and repeat cound, constructs a mock URL that will return that |
| 41 // data repeated |repeat_count| times when started. |data| must be safe for | 42 // data repeated |repeat_count| times when started. |data| must be safe for |
| 42 // URL. | 43 // URL. |
| 43 static GURL GetMockHttpUrl(const std::string& data, int repeat_count); | 44 static GURL GetMockHttpUrl(const std::string& data, int repeat_count); |
| 44 static GURL GetMockHttpsUrl(const std::string& data, int repeat_count); | 45 static GURL GetMockHttpsUrl(const std::string& data, int repeat_count); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 std::string data_; | 66 std::string data_; |
| 66 size_t data_offset_; | 67 size_t data_offset_; |
| 67 bool request_client_certificate_; | 68 bool request_client_certificate_; |
| 68 base::WeakPtrFactory<URLRequestMockDataJob> weak_factory_; | 69 base::WeakPtrFactory<URLRequestMockDataJob> weak_factory_; |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 } // namespace net | 72 } // namespace net |
| 72 | 73 |
| 73 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ | 74 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ |
| OLD | NEW |