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