| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_DATA_RESPONSE_PROVIDER_H_ | |
| 6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_DATA_RESPONSE_PROVIDER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #import "ios/web/public/test/response_providers/response_provider.h" | |
| 13 #include "net/http/http_response_headers.h" | |
| 14 | |
| 15 namespace web { | |
| 16 | |
| 17 // An abstract ResponseProvider that returns a GCDWebServerDataResponse for a | |
| 18 // request. This class encapsulates the logic to convert the response headers | |
| 19 // and body received from |GetResponseHeadersAndBody| into a | |
| 20 // GCDWebServerDataResponse. | |
| 21 class DataResponseProvider : public ResponseProvider { | |
| 22 public: | |
| 23 // ResponseProvider implementation. | |
| 24 GCDWebServerResponse* GetGCDWebServerResponse(const Request& request) final; | |
| 25 | |
| 26 // Returns the headers and the response body. Will only be called if the | |
| 27 // provider can handle the request. | |
| 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 | |
| 30 // public. | |
| 31 virtual void GetResponseHeadersAndBody( | |
| 32 const Request& request, | |
| 33 scoped_refptr<net::HttpResponseHeaders>* headers, | |
| 34 std::string* response_body) = 0; | |
| 35 }; | |
| 36 | |
| 37 } // namespace web | |
| 38 | |
| 39 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_DATA_RESPONSE_PROVIDER_H_ | |
| OLD | NEW |