1 /* 2 * Copyright (c) 2024-2025 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_SERVICE_MOCK_H 17 #define FILE_ACCESS_SERVICE_MOCK_H 18 19 #include "file_access_service_base_stub.h" 20 21 namespace OHOS { 22 namespace FileAccessFwk { 23 using Uri = OHOS::Uri; 24 class FileAccessServiceMock : public FileAccessServiceBaseStub { 25 public: FileAccessServiceMock()26 FileAccessServiceMock() {} 27 ~FileAccessServiceMock()28 ~FileAccessServiceMock() {} 29 MOCK_METHOD2(OnChange, int32_t(const Uri &uri, NotifyType notifyType)); 30 MOCK_METHOD4(RegisterNotify, int32_t(const Uri &uri, bool notifyForDescendants, 31 const sptr<IFileAccessObserver> &observer, const ConnectExtensionInfo& info)); 32 MOCK_METHOD3(UnregisterNotify, int32_t(const Uri &uri, const sptr<IFileAccessObserver> &observer, 33 const ConnectExtensionInfo& info)); 34 MOCK_METHOD2(UnregisterNotifyNoObserver, int32_t(const Uri &uri, const ConnectExtensionInfo& info)); 35 MOCK_METHOD2(GetExtensionProxy, int32_t(const ConnectExtensionInfo& info, 36 sptr<IFileAccessExtBase> &extensionProxy)); 37 MOCK_METHOD0(AsObject, sptr<IRemoteObject>()); 38 MOCK_METHOD2(CleanAllNotify, int32_t(Uri uri, const std::shared_ptr<ConnectExtensionInfo> &info)); 39 MOCK_METHOD4(OnRemoteRequest, int32_t(uint32_t code, MessageParcel &data, MessageParcel &reply, 40 MessageOption &option)); 41 MOCK_METHOD4(SendRequest, int(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); 42 MOCK_METHOD2(ConnectFileExtAbility, int32_t(const AAFwk::Want &want, 43 const sptr<AAFwk::IAbilityConnection>& connection)); 44 MOCK_METHOD1(DisConnectFileExtAbility, int32_t(const sptr<AAFwk::IAbilityConnection>& connection)); 45 }; 46 } // namespace FileAccessFwk 47 } // namespace OHOS 48 #endif // FILE_ACCESS_SERVICE_MOCK_H 49