| 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_FILE_BASED_RESPONSE_PROVIDER_IMPL
_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_FILE_BASED_RESPONSE_PROVIDER_IMPL
_H_ |
| 6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_FILE_BASED_RESPONSE_PROVIDER_IMPL
_H_ | 6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_FILE_BASED_RESPONSE_PROVIDER_IMPL
_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "ios/web/public/test/response_providers/response_provider.h" | 9 #import "ios/web/public/test/response_providers/response_provider.h" |
| 10 | 10 |
| 11 class GURL; | 11 class GURL; |
| 12 | 12 |
| 13 namespace web { | 13 namespace web { |
| 14 | 14 |
| 15 // FileBasedMockResponseProvider tries to resolve URL as if it were a path | 15 // FileBasedMockResponseProvider tries to resolve URL as if it were a path |
| 16 // relative to |path| on the filesystem. Use |BuildTargetPath| to resolve URLs | 16 // relative to |path| on the filesystem. Use |BuildTargetPath| to resolve URLs |
| 17 // to paths on the filesystem. | 17 // to paths on the filesystem. |
| 18 class FileBasedResponseProviderImpl { | 18 class FileBasedResponseProviderImpl { |
| 19 public: | 19 public: |
| 20 explicit FileBasedResponseProviderImpl(const base::FilePath& path); | 20 explicit FileBasedResponseProviderImpl(const base::FilePath& path); |
| 21 virtual ~FileBasedResponseProviderImpl(); | 21 virtual ~FileBasedResponseProviderImpl(); |
| 22 | 22 |
| 23 // Returns true if the request's URL when converted to a path on the app | 23 // Returns true if the request's URL when converted to a path on the app |
| 24 // bundle has a file present. | 24 // bundle has a file present. |
| 25 bool CanHandleRequest(const ResponseProvider::Request& request); | 25 bool CanHandleRequest(const ResponseProvider::Request& request); |
| 26 // Converts |url| to a path on the app bundle. Used to resolve URLs on to the | 26 // Converts |url| to a path on the app bundle. Used to resolve URLs on to the |
| 27 // app bundle. | 27 // app bundle. |
| 28 base::FilePath BuildTargetPath(const GURL& url); | 28 base::FilePath BuildTargetPath(const GURL& url); |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 // The path according to which URLs are resolved from. | 31 // The path according to which URLs are resolved from. |
| 32 base::FilePath path_; | 32 base::FilePath path_; |
| 33 }; | 33 }; |
| 34 } | 34 } |
| 35 | 35 |
| 36 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_FILE_BASED_RESPONSE_PROVIDER_I
MPL_H_ | 36 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_FILE_BASED_RESPONSE_PROVIDER_I
MPL_H_ |
| OLD | NEW |