1 /* 2 * Copyright (c) 2023 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 OHOS_CLOUD_SYNC_SA_DATA_HANDER_MOCK_H 17 #define OHOS_CLOUD_SYNC_SA_DATA_HANDER_MOCK_H 18 19 #include "data_handler.h" 20 21 #include <gmock/gmock.h> 22 #include <gtest/gtest.h> 23 namespace OHOS::FileManagement::CloudSync::Test { 24 using namespace testing; 25 using namespace testing::ext; 26 using namespace std; 27 class DataHandlerMock final : public DataHandler { 28 public: DataHandlerMock(int32_t userId,const std::string & bundleName,const std::string & table)29 DataHandlerMock(int32_t userId, const std::string &bundleName, const std::string &table) 30 : DataHandler(userId, bundleName, table) 31 { 32 } GetFetchCondition(FetchCondition & cond)33 void GetFetchCondition(FetchCondition &cond) {} OnFetchRecords(std::shared_ptr<std::vector<DriveKit::DKRecord>> & records,OnFetchParams & params)34 int32_t OnFetchRecords(std::shared_ptr<std::vector<DriveKit::DKRecord>> &records, OnFetchParams ¶ms) 35 { 36 return 0; 37 } GetRetryRecords(std::vector<DriveKit::DKRecordId> & records)38 int32_t GetRetryRecords(std::vector<DriveKit::DKRecordId> &records) {return 0;} 39 GetDownloadAsset(std::string cloudId,std::vector<DriveKit::DKDownloadAsset> & outAssetsToDownload)40 int32_t GetDownloadAsset(std::string cloudId, 41 std::vector<DriveKit::DKDownloadAsset> &outAssetsToDownload) {return 0;} GetAssetsToDownload(std::vector<DriveKit::DKDownloadAsset> & outAssetsToDownload)42 int32_t GetAssetsToDownload(std::vector<DriveKit::DKDownloadAsset> &outAssetsToDownload) {return 0;} 43 /* upload */ GetCreatedRecords(std::vector<DriveKit::DKRecord> & records)44 int32_t GetCreatedRecords(std::vector<DriveKit::DKRecord> &records) {return 0;} GetDeletedRecords(std::vector<DriveKit::DKRecord> & records)45 int32_t GetDeletedRecords(std::vector<DriveKit::DKRecord> &records) {return 0;} GetMetaModifiedRecords(std::vector<DriveKit::DKRecord> & records)46 int32_t GetMetaModifiedRecords(std::vector<DriveKit::DKRecord> &records) {return 0;} GetFileModifiedRecords(std::vector<DriveKit::DKRecord> & records)47 int32_t GetFileModifiedRecords(std::vector<DriveKit::DKRecord> &records) {return 0;} 48 49 /* upload callback */ OnCreateRecords(const std::map<DriveKit::DKRecordId,DriveKit::DKRecordOperResult> & map)50 int32_t OnCreateRecords(const std::map<DriveKit::DKRecordId, 51 DriveKit::DKRecordOperResult> &map) {return 0;} OnDeleteRecords(const std::map<DriveKit::DKRecordId,DriveKit::DKRecordOperResult> & map)52 int32_t OnDeleteRecords(const std::map<DriveKit::DKRecordId, 53 DriveKit::DKRecordOperResult> &map) {return 0;} OnModifyMdirtyRecords(const std::map<DriveKit::DKRecordId,DriveKit::DKRecordOperResult> & map)54 int32_t OnModifyMdirtyRecords(const std::map<DriveKit::DKRecordId, 55 DriveKit::DKRecordOperResult> &map) {return 0;} OnModifyFdirtyRecords(const std::map<DriveKit::DKRecordId,DriveKit::DKRecordOperResult> & map)56 int32_t OnModifyFdirtyRecords(const std::map<DriveKit::DKRecordId, 57 DriveKit::DKRecordOperResult> &map) {return 0;} OnDownloadSuccess(const DriveKit::DKDownloadAsset & asset)58 int32_t OnDownloadSuccess(const DriveKit::DKDownloadAsset &asset) {return 0;} OnDownloadThumb(const std::map<DriveKit::DKDownloadAsset,DriveKit::DKDownloadResult> & resultMap)59 int32_t OnDownloadThumb(const std::map<DriveKit::DKDownloadAsset, DriveKit::DKDownloadResult> &resultMap) 60 { 61 return 0; 62 } OnDownloadThumb(const DriveKit::DKDownloadAsset & asset)63 int32_t OnDownloadThumb(const DriveKit::DKDownloadAsset &asset) 64 { 65 return 0; 66 } Clean(const int action)67 int32_t Clean(const int action) {return 0;} 68 }; 69 } 70 #endif 71