| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_HTML_RESPONSE_PROVIDER_IMPL_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_HTTP_SERVER_HTML_RESPONSE_PROVIDER_IMPL_H_ |
| 6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTML_RESPONSE_PROVIDER_IMPL_H_ | 6 #define IOS_WEB_PUBLIC_TEST_HTTP_SERVER_HTML_RESPONSE_PROVIDER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #import "ios/web/public/test/response_providers/data_response_provider.h" | 12 #import "ios/web/public/test/http_server/data_response_provider.h" |
| 13 #import "ios/web/public/test/response_providers/response_provider.h" | 13 #import "ios/web/public/test/http_server/response_provider.h" |
| 14 #include "net/http/http_response_headers.h" | 14 #include "net/http/http_response_headers.h" |
| 15 #include "net/http/http_status_code.h" | 15 #include "net/http/http_status_code.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 // This class encapsulates the logic needed to map a request URL to a response. | 18 // This class encapsulates the logic needed to map a request URL to a response. |
| 19 // The mapping -- between URL to response -- is maintained internally, use | 19 // The mapping -- between URL to response -- is maintained internally, use |
| 20 // |CanHandleRequest| to check if a request can be handled and use | 20 // |CanHandleRequest| to check if a request can be handled and use |
| 21 // |GetResponseHeadersAndBody| to actually handle the request. | 21 // |GetResponseHeadersAndBody| to actually handle the request. |
| 22 class HtmlResponseProviderImpl { | 22 class HtmlResponseProviderImpl { |
| 23 public: | 23 public: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Returns the headers and the response body. | 64 // Returns the headers and the response body. |
| 65 void GetResponseHeadersAndBody( | 65 void GetResponseHeadersAndBody( |
| 66 const web::ResponseProvider::Request& request, | 66 const web::ResponseProvider::Request& request, |
| 67 scoped_refptr<net::HttpResponseHeaders>* headers, | 67 scoped_refptr<net::HttpResponseHeaders>* headers, |
| 68 std::string* response_body); | 68 std::string* response_body); |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 const std::map<GURL, Response> responses_; | 71 const std::map<GURL, Response> responses_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTML_RESPONSE_PROVIDER_IMPL_H_ | 74 #endif // IOS_WEB_PUBLIC_TEST_HTTP_SERVER_HTML_RESPONSE_PROVIDER_IMPL_H_ |
| OLD | NEW |