QUIC - cleanup changes to sync chromium tree with internal source.
[chromium-blink-merge.git] / ios / web / public / test / response_providers / data_response_provider.h
blob3ae5faebdbf0bb5753cd649654dfc5f9030836c5
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.
5 #ifndef IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_DATA_RESPONSE_PROVIDER_H_
6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_DATA_RESPONSE_PROVIDER_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "ios/web/public/test/response_providers/response_provider.h"
13 #include "net/http/http_response_headers.h"
15 namespace web {
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;
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;
37 } // namespace web
39 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_DATA_RESPONSE_PROVIDER_H_