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 MOCK_I_CLOUD_SYNC_CALLBACK_H 17 #define MOCK_I_CLOUD_SYNC_CALLBACK_H 18 19 20 #include <gmock/gmock.h> 21 22 #include "i_cloud_sync_callback.h" 23 #include "i_downgrade_dl_callback.h" 24 #include "iremote_stub.h" 25 #include "dfs_error.h" 26 27 namespace OHOS::FileManagement::CloudSync { 28 29 class CloudSyncCallbackMock : public IRemoteStub<ICloudSyncCallback> { 30 public: 31 int code_; CloudSyncCallbackMock()32 CloudSyncCallbackMock() : code_(0) {} ~CloudSyncCallbackMock()33 virtual ~CloudSyncCallbackMock() {} 34 35 MOCK_METHOD4(SendRequest, int(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); 36 InvokeSendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)37 int32_t InvokeSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) 38 { 39 code_ = code; 40 return E_OK; 41 } 42 OnSyncStateChanged(CloudSyncState state,ErrorType error)43 void OnSyncStateChanged(CloudSyncState state, ErrorType error) override {} 44 }; 45 46 class DowngradeDlCallbackMock : public IRemoteStub<IDowngradeDlCallback> { 47 public: 48 DowngradeDlCallbackMock() = default; 49 virtual ~DowngradeDlCallbackMock() = default; 50 51 MOCK_METHOD4(SendRequest, int(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); 52 MOCK_METHOD1(OnDownloadProcess, void(const DowngradeProgress &progress)); 53 }; 54 } // namespace OHOS::FileManagement::CloudSync 55 56 #endif // MOCK_I_CLOUD_SYNC_CALLBACK_H 57