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_STRING_RESPONSE_PROVIDER_H_ | |
6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_STRING_RESPONSE_PROVIDER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #import "ios/web/public/test/response_providers/data_response_provider.h" | |
12 | |
13 namespace web { | |
14 | |
15 // A response provider that returns a string for all requests. Used for testing | |
16 // purposes. | |
17 class StringResponseProvider : public web::DataResponseProvider { | |
18 public: | |
19 explicit StringResponseProvider(const std::string& response_body); | |
20 | |
21 // web::DataResponseProvider methods. | |
22 bool CanHandleRequest(const Request& request) override; | |
23 void GetResponseHeadersAndBody( | |
24 const Request& request, | |
25 scoped_refptr<net::HttpResponseHeaders>* headers, | |
26 std::string* response_body) override; | |
27 | |
28 private: | |
29 // The string that is returned in the response body. | |
30 std::string response_body_; | |
31 DISALLOW_COPY_AND_ASSIGN(StringResponseProvider); | |
32 }; | |
33 | |
34 } // namespace web | |
35 | |
36 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_STRING_RESPONSE_PROVIDER_H_ | |
OLD | NEW |