1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FILE_ACCESS_EXT_ABILITY_MOCK_H 17 #define FILE_ACCESS_EXT_ABILITY_MOCK_H 18 19 #include "file_access_ext_ability.h" 20 21 namespace OHOS { 22 namespace FileAccessFwk { 23 using namespace AbilityRuntime; 24 25 class FileAccessExtAbilityMock : public FileAccessExtAbility { 26 public: 27 void Init(const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &record, 28 const std::shared_ptr<AppExecFwk::OHOSApplication> &application, 29 std::shared_ptr<AppExecFwk::AbilityHandler> &handler, 30 const sptr<IRemoteObject> &token) override {}; 31 void OnStart(const AAFwk::Want &want) override {}; 32 sptr<IRemoteObject> OnConnect(const AAFwk::Want &want) override { return 0; }; 33 int OpenFile(const Uri &uri, const int flags, int &fd) override { return 0; }; 34 int CreateFile(const Uri &parent, const std::string &displayName, Uri &newFile) override { return 0; }; 35 int Mkdir(const Uri &parent, const std::string &displayName, Uri &newFile) override { return 0; }; 36 int Delete(const Uri &sourceFile) override { return 0; }; 37 int Move(const Uri &sourceFile, const Uri &targetParent, Uri &newFile) override { return 0; }; 38 int Copy(const Uri &sourceUri, const Uri &destUri, std::vector<Result> ©Result, bool force = false) override 39 { return 0; }; 40 int CopyFile(const Uri &sourceUri, const Uri &destUri, const std::string &fileName, 41 Uri &newFileUri) override { return 0; }; 42 int Rename(const Uri &sourceFile, const std::string &displayName, Uri &newFile) override { return 0; }; 43 int ListFile(const FileInfo &fileInfo, const int64_t offset, const int64_t maxCount, const FileFilter &filter, 44 std::vector<FileInfo> &fileInfoVec) override { return 0; }; 45 int ScanFile(const FileInfo &fileInfo, const int64_t offset, const int64_t maxCount, const FileFilter &filter, 46 std::vector<FileInfo> &fileInfoVec) override { return 0; }; 47 int GetFileInfoFromUri(const Uri &selectFile, FileInfo &fileInfo) override { return 0; }; 48 int GetFileInfoFromRelativePath(const std::string &selectFile, FileInfo &fileInfo) override { return 0; }; 49 int GetRoots(std::vector<RootInfo> &rootInfoVec) override { return 0; }; 50 int Access(const Uri &uri, bool &isExist) override { return 0; }; 51 int Query(const Uri &uri, std::vector<std::string> &columns, std::vector<std::string> &results) override 52 { return 0; }; 53 int StartWatcher(const Uri &uri) override { return 0; }; 54 int StopWatcher(const Uri &uri) override { return 0; }; 55 int MoveItem(const Uri &sourceFile, const Uri &targetParent, std::vector<Result> &moveResult, 56 bool force = false) override { return 0; }; 57 int MoveFile(const Uri &sourceFile, const Uri &targetParent, std::string &fileName, Uri &newFile) override 58 { return 0; }; 59 int GetFileInfoNum(const std::string &sourceFileUri, const FileFilter &filter, bool recursion, 60 uint32_t &counts) override { return 0; }; 61 }; 62 } // namespace FileAccessFwk 63 } // namespace OHOS 64 #endif // FILE_ACCESS_EXT_ABILITY_MOCK_H