QUIC - cleanup changes to sync chromium tree with internal source.
[chromium-blink-merge.git] / ios / web / public / test / response_providers / file_based_response_provider.mm
blob4c9fa1786a36f2a73584cb74bbacfdb688d65d02
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 #include "ios/web/public/test/response_providers/file_based_response_provider.h"
7 #include "base/files/file_path.h"
8 #include "base/strings/sys_string_conversions.h"
9 #import "ios/third_party/gcdwebserver/src/GCDWebServer/Responses/GCDWebServerFileResponse.h"
11 namespace web {
13 FileBasedResponseProvider::FileBasedResponseProvider(const base::FilePath& path)
14     : response_provider_impl_(new FileBasedResponseProviderImpl(path)) {
17 FileBasedResponseProvider::~FileBasedResponseProvider() {
20 bool FileBasedResponseProvider::CanHandleRequest(const Request& request) {
21   return response_provider_impl_->CanHandleRequest(request);
24 GCDWebServerResponse* FileBasedResponseProvider::GetGCDWebServerResponse(
25     const Request& request) {
26   const base::FilePath file_path =
27       response_provider_impl_->BuildTargetPath(request.url);
28   NSString* path = base::SysUTF8ToNSString(file_path.value());
29   return [GCDWebServerFileResponse responseWithFile:path];
32 }  // namespace web