1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. All rights reserved. 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_DRIVE_KIT_RECORD_MOCK_H 17 #define OHOS_CLOUD_SYNC_SA_DRIVE_KIT_RECORD_MOCK_H 18 19 #include "dk_record.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 using namespace DriveKit; 28 using DKFieldKey = std::string; 29 using DKRecordData = std::map<DKFieldKey, DKRecordField>; 30 31 class DKRecordMock : public DKRecord { 32 public: ~DKRecordMock()33 ~DKRecordMock() {} 34 MOCK_METHOD0(GetRecordId, DKRecordId()); 35 MOCK_METHOD0(GetRecordType, DKRecordType()); 36 MOCK_METHOD0(GetRecordCreateInfo, DKRecordsResponse()); 37 MOCK_METHOD0(GetRecordModifiedInfo, DKRecordsResponse()); 38 MOCK_METHOD1(GetRecordData, void(DKRecordData &fields)); 39 MOCK_METHOD1(StealRecordData, void(DKRecordData &fields)); 40 MOCK_METHOD0(GetIsDelete, bool()); 41 MOCK_METHOD0(GetVersion, unsigned long()); 42 MOCK_METHOD0(GetCreateTime, uint64_t()); 43 MOCK_METHOD0(GetEditedTime, uint64_t()); 44 MOCK_METHOD1(SetRecordId, void(DKRecordId id)); 45 MOCK_METHOD1(SetRecordType, void(DKRecordType type)); 46 MOCK_METHOD1(SetCreateInfo, void(DKRecordsResponse create)); 47 MOCK_METHOD1(SetModifiedInfo, void(DKRecordsResponse modified)); 48 MOCK_METHOD1(SetRecordData, void(const DKRecordData &fields)); 49 MOCK_METHOD1(SetRecordData, void(DKRecordData &&fields)); 50 MOCK_METHOD1(SetDelete, void(bool isDelete)); 51 MOCK_METHOD1(SetVersion, void(unsigned long version)); 52 MOCK_METHOD1(SetNewCreate, void(bool isNew)); 53 MOCK_METHOD1(SetCreateTime, void(uint64_t createdTime)); 54 MOCK_METHOD1(SetEditedTime, void(uint64_t editedTime)); 55 MOCK_METHOD1(SetBaseCursor, void(std::string cursor)); 56 }; 57 } // namespace OHOS::FileManagement::CloudSync::Test 58 59 #endif 60