OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_DATA_RESPONSE_PROVIDER_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_HTTP_SERVER_DATA_RESPONSE_PROVIDER_H_ |
6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_DATA_RESPONSE_PROVIDER_H_ | 6 #define IOS_WEB_PUBLIC_TEST_HTTP_SERVER_DATA_RESPONSE_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #import "ios/web/public/test/response_providers/response_provider.h" | 12 #import "ios/web/public/test/http_server/response_provider.h" |
13 #include "net/http/http_response_headers.h" | 13 #include "net/http/http_response_headers.h" |
14 | 14 |
15 namespace web { | 15 namespace web { |
16 | 16 |
17 // An abstract ResponseProvider that returns a GCDWebServerDataResponse for a | 17 // An abstract ResponseProvider that returns a GCDWebServerDataResponse for a |
18 // request. This class encapsulates the logic to convert the response headers | 18 // request. This class encapsulates the logic to convert the response headers |
19 // and body received from |GetResponseHeadersAndBody| into a | 19 // and body received from |GetResponseHeadersAndBody| into a |
20 // GCDWebServerDataResponse. | 20 // GCDWebServerDataResponse. |
21 class DataResponseProvider : public ResponseProvider { | 21 class DataResponseProvider : public ResponseProvider { |
22 public: | 22 public: |
23 // ResponseProvider implementation. | 23 // ResponseProvider implementation. |
24 GCDWebServerResponse* GetGCDWebServerResponse(const Request& request) final; | 24 GCDWebServerResponse* GetGCDWebServerResponse(const Request& request) final; |
25 | 25 |
26 // Returns the headers and the response body. Will only be called if the | 26 // Returns the headers and the response body. Will only be called if the |
27 // provider can handle the request. | 27 // provider can handle the request. |
28 // Note: This should actually be under protected but since this is used by | 28 // Note: This should actually be under protected but since this is used by |
29 // an adapter in order to work with the old MockHttpServer it is under | 29 // an adapter in order to work with the old MockHttpServer it is under |
30 // public. | 30 // public. |
31 virtual void GetResponseHeadersAndBody( | 31 virtual void GetResponseHeadersAndBody( |
32 const Request& request, | 32 const Request& request, |
33 scoped_refptr<net::HttpResponseHeaders>* headers, | 33 scoped_refptr<net::HttpResponseHeaders>* headers, |
34 std::string* response_body) = 0; | 34 std::string* response_body) = 0; |
35 }; | 35 }; |
36 | 36 |
37 } // namespace web | 37 } // namespace web |
38 | 38 |
39 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_DATA_RESPONSE_PROVIDER_H_ | 39 #endif // IOS_WEB_PUBLIC_TEST_HTTP_SERVER_DATA_RESPONSE_PROVIDER_H_ |
OLD | NEW |