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_download_asset_callback.h" 23 #include "iremote_stub.h" 24 #include "dfs_error.h" 25 26 namespace OHOS::FileManagement::CloudSync { 27 28 class DownloadAssetCallbackMock : public IRemoteStub<IDownloadAssetCallback> { 29 public: 30 int code_; DownloadAssetCallbackMock()31 DownloadAssetCallbackMock() : code_(0) {} ~DownloadAssetCallbackMock()32 virtual ~DownloadAssetCallbackMock() {} 33 34 MOCK_METHOD4(SendRequest, int(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); 35 InvokeSendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)36 int32_t InvokeSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) 37 { 38 code_ = code; 39 return E_OK; 40 } 41 OnFinished(const TaskId taskId,const std::string & uri,const int32_t result)42 void OnFinished(const TaskId taskId, const std::string &uri, const int32_t result) override {} 43 }; 44 45 } // namespace OHOS::FileManagement::CloudSync 46 47 #endif // MOCK_I_CLOUD_SYNC_CALLBACK_H 48