1 /* 2 * Copyright (c) 2022 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 BASE_NOTIFICATION_MOCK_I_REMOTE_OBJECT_H 17 #define BASE_NOTIFICATION_MOCK_I_REMOTE_OBJECT_H 18 19 #include "gmock/gmock.h" 20 21 #include "iremote_broker.h" 22 #include "iremote_object.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 class MockIRemoteObject : public IRemoteObject { 27 public: MockIRemoteObject()28 MockIRemoteObject() : IRemoteObject(u"mock_i_remote_object") {} 29 ~MockIRemoteObject()30 ~MockIRemoteObject() {} 31 GetObjectRefCount()32 int32_t GetObjectRefCount() override 33 { 34 return 0; 35 } 36 37 MOCK_METHOD(int, SendRequest, (uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); 38 IsProxyObject()39 bool IsProxyObject() const override 40 { 41 return true; 42 } 43 CheckObjectLegality()44 bool CheckObjectLegality() const override 45 { 46 return true; 47 } 48 AddDeathRecipient(const sptr<DeathRecipient> & recipient)49 bool AddDeathRecipient(const sptr<DeathRecipient> &recipient) override 50 { 51 return true; 52 } 53 RemoveDeathRecipient(const sptr<DeathRecipient> & recipient)54 bool RemoveDeathRecipient(const sptr<DeathRecipient> &recipient) override 55 { 56 return true; 57 } 58 Marshalling(Parcel & parcel)59 bool Marshalling(Parcel &parcel) const override 60 { 61 return true; 62 } 63 AsInterface()64 sptr<IRemoteBroker> AsInterface() override 65 { 66 return nullptr; 67 } 68 Dump(int fd,const std::vector<std::u16string> & args)69 int Dump(int fd, const std::vector<std::u16string> &args) override 70 { 71 return 0; 72 } 73 GetObjectDescriptor()74 std::u16string GetObjectDescriptor() const 75 { 76 std::u16string descriptor = std::u16string(); 77 return descriptor; 78 } 79 }; 80 } // namespace Notification 81 } // namespace OHOS 82 #endif 83